From 4001544dd7930642251573217eed257e24387c5c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 9 Oct 2024 14:32:04 +1100 Subject: [PATCH] DroneCAN: added NO_SIGNAL code --- bootloader/DroneCAN/DroneCAN.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bootloader/DroneCAN/DroneCAN.c b/bootloader/DroneCAN/DroneCAN.c index e8859ec4..cf0babcf 100644 --- a/bootloader/DroneCAN/DroneCAN.c +++ b/bootloader/DroneCAN/DroneCAN.c @@ -14,6 +14,7 @@ #include "sys_can.h" #include #include +#include // include the headers for the generated DroneCAN messages from the // dronecan_dsdlc compiler @@ -80,6 +81,7 @@ enum boot_code { FAIL_REASON_BAD_LENGTH_DESCRIPTOR = 16, FAIL_REASON_BAD_FIRMWARE_SIGNATURE = 17, FAIL_REASON_VERIFICATION = 18, + FAIL_REASON_NO_SIGNAL = 19, }; #define APP_SIGNATURE_MAGIC1 0x68f058e6 @@ -779,7 +781,7 @@ bool DroneCAN_update() sys_can_enable_IRQ(); - return have_raw_command; + return DroneCAN_boot_ok(); } /* @@ -841,7 +843,13 @@ bool DroneCAN_boot_ok(void) return false; } + if (!have_raw_command) { + node_status.vendor_specific_status_code = FAIL_REASON_NO_SIGNAL; + return false; + } + node_status.vendor_specific_status_code = CHECK_FW_OK; + return true; }