diff --git a/Software/src/datalayer/datalayer.h b/Software/src/datalayer/datalayer.h index 6d6be61c..bfb57ad3 100644 --- a/Software/src/datalayer/datalayer.h +++ b/Software/src/datalayer/datalayer.h @@ -71,8 +71,11 @@ typedef struct { /** A counter that increases incase a CAN CRC read error occurs */ uint16_t CAN_error_counter; /** uint8_t */ - /** A counter set each time a new message comes from battery.*/ - uint8_t CAN_battery_still_alive = 12; + /** A counter set each time a new message comes from battery. + * This value then gets decremented each 5 seconds. Incase we reach 0 + * we report the battery as missing entirely on the CAN bus. + */ + uint8_t CAN_battery_still_alive = CAN_STILL_ALIVE; /** Other */ /** The current BMS status */ diff --git a/Software/src/devboard/utils/types.h b/Software/src/devboard/utils/types.h index 78c354af..85525166 100644 --- a/Software/src/devboard/utils/types.h +++ b/Software/src/devboard/utils/types.h @@ -28,6 +28,7 @@ enum led_color { GREEN, YELLOW, RED, BLUE, RGB }; #define INTERVAL_100_MS_DELAYED 120 #define INTERVAL_500_MS_DELAYED 550 -#define CAN_STILL_ALIVE 12 +#define CAN_STILL_ALIVE \ + 12 // Set by battery each time we get a CAN message. Decrements every 5seconds. Incase we reach 0 (after 60 seconds of inactivity) #endif