Skip to content

Commit

Permalink
AP_Periph: correct compilation when AP_CHECK_FIRMWARE_ENABLED is false
Browse files Browse the repository at this point in the history
the typedef won't exist in that case
  • Loading branch information
peterbarker committed Mar 16, 2024
1 parent bfbab2e commit f4e030b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Tools/AP_Periph/AP_Periph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ void AP_Periph_FW::init()
logger.init(g.log_bitmask, log_structure, ARRAY_SIZE(log_structure));
#endif

#if AP_CHECK_FIRMWARE_ENABLED
check_firmware_print();
#endif

if (hal.util->was_watchdog_reset()) {
printf("Reboot after watchdog reset\n");
Expand Down
3 changes: 3 additions & 0 deletions Tools/AP_Periph/AP_Periph.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,13 @@
void stm32_watchdog_init();
void stm32_watchdog_pat();
#endif

#if AP_CHECK_FIRMWARE_ENABLED
/*
app descriptor for firmware checking
*/
extern const app_descriptor_t app_descriptor;
#endif

extern "C" {
void can_vprintf(uint8_t severity, const char *fmt, va_list arg);
Expand Down
2 changes: 2 additions & 0 deletions Tools/AP_Periph/can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,12 @@ void AP_Periph_FW::handle_get_node_info(CanardInstance* canard_instance,
pkt.software_version.major = AP::fwversion().major;
pkt.software_version.minor = AP::fwversion().minor;
pkt.software_version.optional_field_flags = UAVCAN_PROTOCOL_SOFTWAREVERSION_OPTIONAL_FIELD_FLAG_VCS_COMMIT | UAVCAN_PROTOCOL_SOFTWAREVERSION_OPTIONAL_FIELD_FLAG_IMAGE_CRC;
#if AP_CHECK_FIRMWARE_ENABLED
pkt.software_version.vcs_commit = app_descriptor.git_hash;
uint32_t *crc = (uint32_t *)&pkt.software_version.image_crc;
crc[0] = app_descriptor.image_crc1;
crc[1] = app_descriptor.image_crc2;
#endif

readUniqueID(pkt.hardware_version.unique_id);

Expand Down

0 comments on commit f4e030b

Please sign in to comment.