Closed bel-lau closed 2 months ago
@bel-lau can you give some sample DSDL that this fails for?
Here's an example based on the files we had issues with, followed by a snippet from the generated file containing the extra bracket. I added a comment to the line with the extra bracket.
Alarm.uavcan
bool set # Flag whether alarm is set or cleared.
uint8[<=90] text # Descriptive message.
203.ControllerAlarms.uavcan
uint32 timestamp
Alarm[7] alarms # Array of alarms
---
bool ack
perfusion_controller.ControllerAlarms_req.h starting at line 45
#ifdef __cplusplus
extern "C"
{
#endif
uint32_t perfusion_controller_ControllerAlarmsRequest_encode(struct perfusion_controller_ControllerAlarmsRequest* msg, uint8_t* buffer
#if CANARD_ENABLE_TAO_OPTION
, bool tao
#endif
);
bool perfusion_controller_ControllerAlarmsRequest_decode(const CanardRxTransfer* transfer, struct perfusion_controller_ControllerAlarmsRequest* msg);
#if defined(CANARD_DSDLC_INTERNAL)
static inline void _perfusion_controller_ControllerAlarmsRequest_encode(uint8_t* buffer, uint32_t* bit_ofs, struct perfusion_controller_ControllerAlarmsRequest* msg, bool tao);
static inline void _perfusion_controller_ControllerAlarmsRequest_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct perfusion_controller_ControllerAlarmsRequest* msg, bool tao);
void _perfusion_controller_ControllerAlarmsRequest_encode(uint8_t* buffer, uint32_t* bit_ofs, struct perfusion_controller_ControllerAlarmsRequest* msg, bool tao) {
(void)buffer;
(void)bit_ofs;
(void)msg;
(void)tao;
canardEncodeScalar(buffer, *bit_ofs, 32, &msg->timestamp);
*bit_ofs += 32;
for (size_t i=0; i < 7; i++) {
_perfusion_controller_Alarm_encode(buffer, bit_ofs, &msg->alarms[i], tao && i==msg->alarms.len);
}
}
void _perfusion_controller_ControllerAlarmsRequest_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct perfusion_controller_ControllerAlarmsRequest* msg, bool tao) {
(void)transfer;
(void)bit_ofs;
(void)msg;
(void)tao;
canardDecodeScalar(transfer, *bit_ofs, 32, false, &msg->timestamp);
*bit_ofs += 32;
for (size_t i=0; i < 7; i++) {
_perfusion_controller_Alarm_decode(transfer, bit_ofs, &msg->alarms[i], tao && i==msg->alarms.len);
}
} // EXTRA BRACKET HERE
}
#endif
#ifdef CANARD_DSDLC_TEST_BUILD
struct perfusion_controller_ControllerAlarmsRequest sample_perfusion_controller_ControllerAlarmsRequest_msg(void);
#endif
#ifdef __cplusplus
} // extern "C"
#endif
Fixed an edge case that occurred when a static, compound array field is used in a service invocation message. An extra bracket was being generated towards the end of the generated req.h file.