From f26130c4cf0c3f7ca834b4eb4d25cf63fad19df1 Mon Sep 17 00:00:00 2001 From: Edwin <20777515+Lucien950@users.noreply.github.com> Date: Sat, 18 Jan 2025 21:05:03 -0800 Subject: [PATCH] Heartbeat Hotfix (#1426) ### Changelist ### Testing Done ### Resolved Tickets --- firmware/quadruna/BMS/src/tasks.c | 2 ++ firmware/quadruna/CRIT/src/tasks.c | 3 ++- firmware/quadruna/RSM/src/tasks.c | 3 ++- firmware/quadruna/VC/src/tasks.c | 2 ++ firmware/shared/src/app/app_heartbeatMonitor.c | 8 ++++++++ firmware/shared/src/app/app_heartbeatMonitor.h | 2 ++ 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/firmware/quadruna/BMS/src/tasks.c b/firmware/quadruna/BMS/src/tasks.c index 938f3b14d4..9da0ed9281 100644 --- a/firmware/quadruna/BMS/src/tasks.c +++ b/firmware/quadruna/BMS/src/tasks.c @@ -42,6 +42,7 @@ #include "app_globals.h" #include "states/app_initState.h" #include "app_stateMachine.h" +#include "app_heartbeatMonitors.h" #include "shared.pb.h" #include "BMS.pb.h" @@ -289,6 +290,7 @@ void tasks_init(void) app_soc_init(); app_globals_init(&globals_config); app_stateMachine_init(app_initState_get()); + app_heartbeatMonitor_init(&hb_monitor); // broadcast commit info app_canTx_BMS_Hash_set(GIT_COMMIT_HASH); diff --git a/firmware/quadruna/CRIT/src/tasks.c b/firmware/quadruna/CRIT/src/tasks.c index 500971da6d..7fdbb75793 100644 --- a/firmware/quadruna/CRIT/src/tasks.c +++ b/firmware/quadruna/CRIT/src/tasks.c @@ -5,7 +5,7 @@ #include "shared.pb.h" #include "CRIT.pb.h" // app -#include "app_heartbeatMonitor.h" +#include "app_heartbeatMonitors.h" #include "app_stateMachine.h" #include "app_mainState.h" // io @@ -386,6 +386,7 @@ void tasks_init(void) app_canTx_init(); app_canRx_init(); + app_heartbeatMonitor_init(&hb_monitor); app_stateMachine_init(app_mainState_get()); // broadcast commit info diff --git a/firmware/quadruna/RSM/src/tasks.c b/firmware/quadruna/RSM/src/tasks.c index 4b45b34b59..1f9cf9475a 100644 --- a/firmware/quadruna/RSM/src/tasks.c +++ b/firmware/quadruna/RSM/src/tasks.c @@ -8,7 +8,7 @@ #include "app_canAlerts.h" #include "app_commitInfo.h" #include "app_coolant.h" -#include "app_heartbeatMonitor.h" +#include "app_heartbeatMonitors.h" #include "io_jsoncan.h" #include "io_canRx.h" @@ -147,6 +147,7 @@ void tasks_init(void) io_brake_light_init(&brake_light); app_coolant_init(); + app_heartbeatMonitor_init(&hb_monitor); app_stateMachine_init(app_mainState_get()); app_canTx_RSM_Hash_set(GIT_COMMIT_HASH); diff --git a/firmware/quadruna/VC/src/tasks.c b/firmware/quadruna/VC/src/tasks.c index 1f35e6a3a3..c243b7b34f 100644 --- a/firmware/quadruna/VC/src/tasks.c +++ b/firmware/quadruna/VC/src/tasks.c @@ -11,6 +11,7 @@ #include "app_canDataCapture.h" #include "app_commitInfo.h" #include "app_faultCheck.h" +#include "app_heartbeatMonitors.h" #include "io_jsoncan.h" #include "io_log.h" @@ -324,6 +325,7 @@ void tasks_init(void) app_canAlerts_VC_Warning_HighNumberOfCanDataLogs_set(io_canLogging_getCurrentLog() > HIGH_NUMBER_OF_LOGS_THRESHOLD); app_canAlerts_VC_Warning_CanLoggingSdCardNotPresent_set(!sd_card_present); + app_heartbeatMonitor_init(&hb_monitor); app_stateMachine_init(app_initState_get()); io_telemMessage_init(&modem); diff --git a/firmware/shared/src/app/app_heartbeatMonitor.c b/firmware/shared/src/app/app_heartbeatMonitor.c index 86746fe8de..56f9ab0694 100644 --- a/firmware/shared/src/app/app_heartbeatMonitor.c +++ b/firmware/shared/src/app/app_heartbeatMonitor.c @@ -1,5 +1,13 @@ #include "app_heartbeatMonitor.h" +void app_heartbeatMonitor_init(const HeartbeatMonitor *hbm) +{ + for (int i = 0; i < hbm->board_count; i++) + { + app_heartbeatBoard_init(&hbm->boards[i]); + } +} + void app_heartbeatMonitor_checkIn(const HeartbeatMonitor *hbm) { hbm->own_heartbeat(true); diff --git a/firmware/shared/src/app/app_heartbeatMonitor.h b/firmware/shared/src/app/app_heartbeatMonitor.h index 296b0c0190..40e2495e92 100644 --- a/firmware/shared/src/app/app_heartbeatMonitor.h +++ b/firmware/shared/src/app/app_heartbeatMonitor.h @@ -10,6 +10,8 @@ typedef struct void (*own_heartbeat)(bool); } HeartbeatMonitor; +void app_heartbeatMonitor_init(const HeartbeatMonitor *hbm); + void app_heartbeatMonitor_checkIn(const HeartbeatMonitor *hbm); void app_heartbeatMonitor_broadcastFaults(const HeartbeatMonitor *hbm);