From b2d8cbe3921d727f7cee80978ac0d1ba4af54f97 Mon Sep 17 00:00:00 2001 From: Gus Tahara-Edmonds Date: Sat, 1 Jun 2024 19:11:18 -0700 Subject: [PATCH] Simplify heartbeats + annotate alerts (#1282) ### Changelist A few changes that should make driving less fragile. 1. Changed the heartbeat dependency graph. Now, board A only checks the heartbeat of board B if A uses a signal from board B. There currently are a few instances of boards checking other boards' heartbeats, but then not actually using signals from them. In my mind this is unnecessary and could only lead to unnecessary faults down the line. (check me on this!). This for example means the FSM and BMS checks no other boards heartbeats. 2. Moved various faults on the VC related to the LV battery and currents to warnings. If `AccumulatorRailOvercurrentFault` and `BatteryRailOvercurrentFault` is set, we'd probably see total loss of the LV bus, so no need to just exit drive state. If just one is set, there is no immediate reason to stop driving. If there is a `LvChargeFault` or `BoostControllerFault`, there is also no need to exit drive state (we'd probably only notice the consequences of the failure on the next power cycle). By making these faults instead of warnings we reduce the chances of spurious shutdowns. 3. Added descriptions for all alerts. ### Testing Done Unit testing only. --- can_bus/quadruna/BMS/BMS_alerts.json | 128 +++++++++--------- can_bus/quadruna/BMS/BMS_rx.json | 3 +- can_bus/quadruna/CRIT/CRIT_alerts.json | 50 +++---- can_bus/quadruna/FSM/FSM_alerts.json | 4 - can_bus/quadruna/FSM/FSM_rx.json | 1 - can_bus/quadruna/RSM/RSM_alerts.json | 6 +- can_bus/quadruna/VC/VC_alerts.json | 73 +++++----- can_bus/quadruna/VC/VC_rx.json | 5 +- firmware/quadruna/BMS/src/tasks.c | 40 ++---- .../BMS/test/test_bmsBaseStateMachineTest.h | 44 +++--- .../quadruna/BMS/test/test_stateMachine.cpp | 1 - .../quadruna/CRIT/test/test_ledStatus.cpp | 2 +- firmware/quadruna/FSM/CMakeLists.txt | 1 - firmware/quadruna/FSM/src/app/app_mainState.c | 16 +-- firmware/quadruna/FSM/src/tasks.c | 52 ------- firmware/quadruna/FSM/test/test_faults.cpp | 67 --------- .../FSM/test/test_fsmBaseStateMachineTest.h | 51 ------- firmware/quadruna/RSM/src/tasks.c | 41 ++++-- .../quadruna/VC/src/app/app_currentSensing.c | 4 +- .../VC/src/app/app_lowVoltageBattery.c | 4 +- firmware/quadruna/VC/src/tasks.c | 2 +- .../VC/test/test_vcBaseStateMachineTest.h | 2 +- 22 files changed, 196 insertions(+), 401 deletions(-) diff --git a/can_bus/quadruna/BMS/BMS_alerts.json b/can_bus/quadruna/BMS/BMS_alerts.json index c4c943b8fa..99856ccdaf 100644 --- a/can_bus/quadruna/BMS/BMS_alerts.json +++ b/can_bus/quadruna/BMS/BMS_alerts.json @@ -4,115 +4,111 @@ "warnings_counts_id": 152, "faults_counts_id": 153, "warnings": { - "StackWaterMarkHighTask1Hz" : { - "id" :101, - "description" : "Example" + "StackWaterMarkHighTask1Hz": { + "id": 101, + "description": "Example" }, - "StackWaterMarkHighTask100Hz" : { - "id" :102, - "description" : "Example" + "StackWaterMarkHighTask100Hz": { + "id": 102, + "description": "Example" }, - "StackWaterMarkHighTask1kHz" :{ - "id" :103, - "description" : "Example" + "StackWaterMarkHighTask1kHz": { + "id": 103, + "description": "Example" }, "StackWaterMarkHighTaskCanRx": { - "id" :104, - "description" : "Example" + "id": 104, + "description": "Example" }, - "StackWaterMarkHighTaskCanTx":{ - "id" :105, - "description" : "Example" + "StackWaterMarkHighTaskCanTx": { + "id": 105, + "description": "Example" }, - "WatchdogTimeout" :{ - "id" :106, - "description" : "Example" + "WatchdogTimeout": { + "id": 106, + "description": "Example" }, "TxOverflow": { - "id" :107, - "description" : "Example" + "id": 107, + "description": "Example" }, - "RxOverflow" : { - "id" :108, - "description" : "Example" + "RxOverflow": { + "id": 108, + "description": "Example" + }, + "MissingVCHeartbeat": { + "id": 109, + "description": "Example" } }, "faults": { - "MissingVCHeartbeat":{ - "id" :151, - "description" : "Example" - }, - "MissingRSMHeartbeat":{ - "id" :152, - "description" : "Example" - }, - "StateMachine" :{ - "id" :154, - "description" : "Example" + "StateMachine": { + "id": 154, + "description": "Example" }, "CellUndervoltage": { - "id" :155, - "description" : "Example" + "id": 155, + "description": "Example" }, "CellOvervoltage": { - "id" :156, - "description" : "Example" + "id": 156, + "description": "Example" }, "ModuleCommunicationError": { - "id" :157, - "description" : "Example" + "id": 157, + "description": "Example" }, "CellUndertemp": { - "id" :158, - "description" : "Example" + "id": 158, + "description": "Example" }, "CellOvertemp": { - "id" :159, - "description" : "Example" + "id": 159, + "description": "Example" }, "Charger": { - "id" :160, - "description" : "Example" + "id": 160, + "description": "Example" }, "ChargerDisconnectedDuringCharge": { - "id" :161, - "description" : "Example" + "id": 161, + "description": "Example" }, "ChargerExternalShutdown": { - "id" :162, - "description" : "Example" + "id": 162, + "description": "Example" }, "TractiveSystemOvercurrent": { - "id" :163, - "description" : "Example" + "id": 163, + "description": "Example" }, "PrechargeFailure": { - "id" :164, - "description" : "Example" + "id": 164, + "description": "Example" }, "OpenWireCheckFault": { - "id" :165, - "description" : "Example" + "id": 165, + "description": "Example" }, "OpenWireCheck_Segment0_GND": { - "id" :166, - "description" : "Example" + "id": 166, + "description": "Example" }, "OpenWireCheck_Segment1_GND": { - "id" :167, - "description" : "Example" + "id": 167, + "description": "Example" }, "OpenWireCheck_Segment2_GND": { - "id" :168, - "description" : "Example" + "id": 168, + "description": "Example" }, "OpenWireCheck_Segment3_GND": { - "id" :169, - "description" : "Example" + "id": 169, + "description": "Example" }, "OpenWireCheck_Segment4_GND": { - "id" :170, - "description" : "Example" + "id": 170, + "description": "Example" } } -} +} \ No newline at end of file diff --git a/can_bus/quadruna/BMS/BMS_rx.json b/can_bus/quadruna/BMS/BMS_rx.json index ba478e61f8..476c6b4c56 100644 --- a/can_bus/quadruna/BMS/BMS_rx.json +++ b/can_bus/quadruna/BMS/BMS_rx.json @@ -1,6 +1,5 @@ { "messages": [ - "RSM_Vitals", "VC_Vitals", "BRUSA_Vitals", "Debug_Charging", @@ -8,4 +7,4 @@ "Debug_CellBalancing", "Debug_ResetSoc" ] -} +} \ No newline at end of file diff --git a/can_bus/quadruna/CRIT/CRIT_alerts.json b/can_bus/quadruna/CRIT/CRIT_alerts.json index df913756c2..b78b414a9e 100644 --- a/can_bus/quadruna/CRIT/CRIT_alerts.json +++ b/can_bus/quadruna/CRIT/CRIT_alerts.json @@ -5,54 +5,54 @@ "faults_counts_id": 551, "warnings": { "StackWaterMarkHighTask1Hz": { - "id" :201, - "description" : "Example" + "id": 201, + "description": "1Hz task stack watermark exceeded." }, "StackWaterMarkHighTask100Hz": { - "id" :202, - "description" : "Example" + "id": 202, + "description": "100Hz task stack watermark exceeded." }, "StackWaterMarkHighTask1kHz": { - "id" :203, - "description" : "Example" + "id": 203, + "description": "1kHz task stack watermark exceeded." }, "StackWaterMarkHighTaskCanRx": { - "id" :204, - "description" : "Example" + "id": 204, + "description": "CAN RX task stack watermark exceeded." }, "StackWaterMarkHighTaskCanTx": { - "id" :205, - "description" : "Example" + "id": 205, + "description": "CAN TX task stack watermark exceeded." }, "WatchdogTimeout": { - "id" :206, - "description" : "Example" + "id": 206, + "description": "Watchdog timeout detected." }, "TxOverflow": { - "id" :207, - "description" : "Example" + "id": 207, + "description": "CAN TX queue has overflowed." }, "RxOverflow": { - "id" :208, - "description" : "Example" + "id": 208, + "description": "CAN RX queue has overflowed." } }, "faults": { "MissingBMSHeartbeat": { - "id" :251, - "description" : "Example" + "id": 251, + "description": "Missing heartbeat signal from the BMS." }, "MissingFSMHeartbeat": { - "id" :252, - "description" : "Example" + "id": 252, + "description": "Missing heartbeat signal from the FSM." }, "MissingRSMHeartbeat": { - "id" :253, - "description" : "Example" + "id": 253, + "description": "Missing heartbeat signal from the RSM." }, "MissingVCHeartbeat": { - "id":254, - "description" : "Example" + "id": 254, + "description": "Missing heartbeat signal from the VC." } -} + } } \ No newline at end of file diff --git a/can_bus/quadruna/FSM/FSM_alerts.json b/can_bus/quadruna/FSM/FSM_alerts.json index d0d0d74aa6..1ea4554f50 100644 --- a/can_bus/quadruna/FSM/FSM_alerts.json +++ b/can_bus/quadruna/FSM/FSM_alerts.json @@ -97,10 +97,6 @@ "SappsOCSC": { "id": 353, "description": "Secondary accelerator pedal voltage out of acceptable range (OCSC)." - }, - "MissingBMSHeartbeat": { - "id": 354, - "description": "BMS heartbeat no longer captured." } } } \ No newline at end of file diff --git a/can_bus/quadruna/FSM/FSM_rx.json b/can_bus/quadruna/FSM/FSM_rx.json index 2009a685dc..1e4e50e8a7 100644 --- a/can_bus/quadruna/FSM/FSM_rx.json +++ b/can_bus/quadruna/FSM/FSM_rx.json @@ -1,6 +1,5 @@ { "messages": [ - "BMS_Vitals", "Debug_CanMode" ] } \ No newline at end of file diff --git a/can_bus/quadruna/RSM/RSM_alerts.json b/can_bus/quadruna/RSM/RSM_alerts.json index 544901a849..6487ba702a 100644 --- a/can_bus/quadruna/RSM/RSM_alerts.json +++ b/can_bus/quadruna/RSM/RSM_alerts.json @@ -82,9 +82,13 @@ "id": 452, "description": "VC Missing Heart beat" }, + "MissingBMSHeartbeat": { + "id": 452, + "description": "BMS Missing Heart beat" + }, "MissingFSMHeartbeat": { "id": 453, - "description": "FSM Missing Heart beat" + "description": "FSM Missing Heartbeat" } } } \ No newline at end of file diff --git a/can_bus/quadruna/VC/VC_alerts.json b/can_bus/quadruna/VC/VC_alerts.json index 3e3c7d5c74..4bdd727401 100644 --- a/can_bus/quadruna/VC/VC_alerts.json +++ b/can_bus/quadruna/VC/VC_alerts.json @@ -6,94 +6,89 @@ "warnings": { "StackWaterMarkHighTask1Hz": { "id": 501, - "description": "Example" + "description": "1Hz task stack watermark exceeded." }, "StackWaterMarkHighTask100Hz": { "id": 502, - "description": "Example" + "description": "100Hz task stack watermark exceeded." }, "StackWaterMarkHighTask1kHz": { "id": 503, - "description": "Example" + "description": "1kHz task stack watermark exceeded." }, "StackWaterMarkHighTaskCanRx": { "id": 504, - "description": "Example" + "description": "CAN RX task stack watermark exceeded." }, "StackWaterMarkHighTaskCanTx": { "id": 505, - "description": "Example" + "description": "CAN TX task stack watermark exceeded." }, "WatchdogTimeout": { "id": 506, - "description": "Example" + "description": "Watchdog timeout detected." }, "TxOverflow": { "id": 507, - "description": "Example" + "description": "CAN TX queue has overflowed." }, "RxOverflow": { "id": 508, - "description": "Example" + "description": "CAN RX queue has overflowed." }, "RegenNotAvailable": { "id": 509, - "description": "Example" + "description": "Regen is not currently available." }, - "SbgRxOverflow": { - "id": 510, - "description": "Example" - }, - "ImuIo": { + "ImuInitFailed": { "id": 516, - "description": "Example" + "description": "Initializing the embedded IMU failed." }, - "FlowRateInputOutOfRange": - { + "FlowRateInputOutOfRange": { "id": 517, "description": "Input to app_pumpControl_setFlowRate out of range" + }, + "BatteryRailOvercurrentFault": { + "id": 557, + "description": "LV rail from the 18650 batteries was overcurrent." + }, + "AccumulatorRailOvercurrentFault": { + "id": 558, + "description": "LV rail from the HV DCDC was overcurrent." + }, + "LvChargeFault": { + "id": 559, + "description": "LV battery charger has faulted." + }, + "BoostControllerFault": { + "id": 560, + "description": "Boost controller has faulted." } }, "faults": { "MissingBMSHeartbeat": { "id": 551, - "description": "Example" + "description": "Missing heartbeat signal from the BMS." }, "MissingFSMHeartbeat": { "id": 552, - "description": "Example" + "description": "Missing heartbeat signal from the FSM." }, "MissingRSMHeartbeat": { "id": 553, - "description": "Example" + "description": "Missing heartbeat signal from the RSM." }, "MissingCRITHeartbeat": { "id": 554, - "description": "Example" + "description": "Missing heartbeat signal from the CRIT." }, "LeftInverterFault": { "id": 555, - "description": "Example" + "description": "Left inverter entered fault state." }, "RightInverterFault": { "id": 556, - "description": "Example" - }, - "BatteryFault": { - "id": 557, - "description": "Example" - }, - "AccumulatorFault": { - "id": 558, - "description": "Example" - }, - "LvChargeFault": { - "id": 559, - "description": "Example" - }, - "BoostControllerFault": { - "id": 560, - "description": "Example" + "description": "Right inverter entered fault state." } } } \ No newline at end of file diff --git a/can_bus/quadruna/VC/VC_rx.json b/can_bus/quadruna/VC/VC_rx.json index 15f1abca46..c055300ea7 100644 --- a/can_bus/quadruna/VC/VC_rx.json +++ b/can_bus/quadruna/VC/VC_rx.json @@ -19,13 +19,12 @@ "FSM_Steering", "FSM_Vitals", "FSM_Wheels", + "RSM_Vitals", "INVL_InternalStates", "INVL_MotorPositionInfo", "INVL_Temperatures3", "INVR_InternalStates", "INVR_MotorPositionInfo", - "INVR_Temperatures3", - "RSM_Vitals", - "Boot_VC" + "INVR_Temperatures3" ] } \ No newline at end of file diff --git a/firmware/quadruna/BMS/src/tasks.c b/firmware/quadruna/BMS/src/tasks.c index a886d6b7a3..653813b6a7 100644 --- a/firmware/quadruna/BMS/src/tasks.c +++ b/firmware/quadruna/BMS/src/tasks.c @@ -213,50 +213,38 @@ static const GlobalsConfig globals_config = { }; // config for heartbeat monitor (can funcs and flags) -// BMS relies on RSM, VC +// BMS relies on VC static const bool heartbeatMonitorChecklist[HEARTBEAT_BOARD_COUNT] = { - [BMS_HEARTBEAT_BOARD] = false, [VC_HEARTBEAT_BOARD] = true, [RSM_HEARTBEAT_BOARD] = true, + [BMS_HEARTBEAT_BOARD] = false, [VC_HEARTBEAT_BOARD] = true, [RSM_HEARTBEAT_BOARD] = false, [FSM_HEARTBEAT_BOARD] = false, [DIM_HEARTBEAT_BOARD] = false, [CRIT_HEARTBEAT_BOARD] = false }; // heartbeatGetters - get heartbeat signals from other boards static bool (*const heartbeatGetters[HEARTBEAT_BOARD_COUNT])(void) = { - [BMS_HEARTBEAT_BOARD] = NULL, - [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_get, - [RSM_HEARTBEAT_BOARD] = app_canRx_RSM_Heartbeat_get, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_get, + [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = NULL, + [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL }; // heartbeatUpdaters - update local CAN table with heartbeat status static void (*const heartbeatUpdaters[HEARTBEAT_BOARD_COUNT])(bool) = { - [BMS_HEARTBEAT_BOARD] = NULL, - [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_update, - [RSM_HEARTBEAT_BOARD] = app_canRx_RSM_Heartbeat_update, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_update, + [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = NULL, + [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL }; // heartbeatFaultSetters - broadcast heartbeat faults over CAN static void (*const heartbeatFaultSetters[HEARTBEAT_BOARD_COUNT])(bool) = { - [BMS_HEARTBEAT_BOARD] = NULL, - [VC_HEARTBEAT_BOARD] = app_canAlerts_BMS_Fault_MissingVCHeartbeat_set, - [RSM_HEARTBEAT_BOARD] = app_canAlerts_BMS_Fault_MissingRSMHeartbeat_set, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canAlerts_BMS_Warning_MissingVCHeartbeat_set, + [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = NULL, + [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL }; // heartbeatFaultGetters - gets fault statuses over CAN static bool (*const heartbeatFaultGetters[HEARTBEAT_BOARD_COUNT])(void) = { - [BMS_HEARTBEAT_BOARD] = NULL, - [VC_HEARTBEAT_BOARD] = app_canAlerts_BMS_Fault_MissingVCHeartbeat_get, - [RSM_HEARTBEAT_BOARD] = app_canAlerts_BMS_Fault_MissingRSMHeartbeat_get, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canAlerts_BMS_Warning_MissingVCHeartbeat_get, + [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = NULL, + [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL }; const Gpio *id_to_gpio[] = { [BMS_GpioNetName_ACCEL_BRAKE_OK_3V3] = &accel_brake_ok_pin, diff --git a/firmware/quadruna/BMS/test/test_bmsBaseStateMachineTest.h b/firmware/quadruna/BMS/test/test_bmsBaseStateMachineTest.h index c99f7a0df5..87f365b2e1 100644 --- a/firmware/quadruna/BMS/test/test_bmsBaseStateMachineTest.h +++ b/firmware/quadruna/BMS/test/test_bmsBaseStateMachineTest.h @@ -122,46 +122,38 @@ class BmsBaseStateMachineTest : public BaseStateMachineTest const FaultLatch bspd_ok_latch = {}; // config for heartbeat monitor (can funcs and flags) - // BMS relies on RSM, VC + // BMS relies on VC bool heartbeatMonitorChecklist[HEARTBEAT_BOARD_COUNT] = { - [BMS_HEARTBEAT_BOARD] = false, [VC_HEARTBEAT_BOARD] = true, [RSM_HEARTBEAT_BOARD] = true, + [BMS_HEARTBEAT_BOARD] = false, [VC_HEARTBEAT_BOARD] = true, [RSM_HEARTBEAT_BOARD] = false, [FSM_HEARTBEAT_BOARD] = false, [DIM_HEARTBEAT_BOARD] = false, [CRIT_HEARTBEAT_BOARD] = false }; // heartbeatGetters - get heartbeat signals from other boards - bool (*heartbeatGetters[HEARTBEAT_BOARD_COUNT])() = { [BMS_HEARTBEAT_BOARD] = NULL, - [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_get, - [RSM_HEARTBEAT_BOARD] = app_canRx_RSM_Heartbeat_get, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL }; + bool (*heartbeatGetters[HEARTBEAT_BOARD_COUNT])() = { + [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_get, + [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = NULL, + [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL + }; // heartbeatUpdaters - update local CAN table with heartbeat status - void (*heartbeatUpdaters[HEARTBEAT_BOARD_COUNT])(bool) = { [BMS_HEARTBEAT_BOARD] = NULL, - [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_update, - [RSM_HEARTBEAT_BOARD] = app_canRx_RSM_Heartbeat_update, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL }; + void (*heartbeatUpdaters[HEARTBEAT_BOARD_COUNT])(bool) = { + [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_update, + [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = NULL, + [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL + }; // heartbeatFaultSetters - broadcast heartbeat faults over CAN void (*heartbeatFaultSetters[HEARTBEAT_BOARD_COUNT])(bool) = { - [BMS_HEARTBEAT_BOARD] = NULL, - [VC_HEARTBEAT_BOARD] = app_canAlerts_BMS_Fault_MissingVCHeartbeat_set, - [RSM_HEARTBEAT_BOARD] = app_canAlerts_BMS_Fault_MissingRSMHeartbeat_set, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canAlerts_BMS_Warning_MissingVCHeartbeat_set, + [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = NULL, + [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL }; // heartbeatFaultGetters - gets fault statuses over CAN bool (*heartbeatFaultGetters[HEARTBEAT_BOARD_COUNT])() = { - [BMS_HEARTBEAT_BOARD] = NULL, - [VC_HEARTBEAT_BOARD] = app_canAlerts_BMS_Fault_MissingVCHeartbeat_get, - [RSM_HEARTBEAT_BOARD] = app_canAlerts_BMS_Fault_MissingRSMHeartbeat_get, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canAlerts_BMS_Warning_MissingVCHeartbeat_get, + [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = NULL, + [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL }; const GlobalsConfig globals_config = { diff --git a/firmware/quadruna/BMS/test/test_stateMachine.cpp b/firmware/quadruna/BMS/test/test_stateMachine.cpp index 03ca0d5e75..d8bc28b396 100644 --- a/firmware/quadruna/BMS/test/test_stateMachine.cpp +++ b/firmware/quadruna/BMS/test/test_stateMachine.cpp @@ -373,7 +373,6 @@ TEST_F(BmsStateMachineTest, no_charger_connected_missing_hb_init_state) fake_io_airs_isNegativeClosed_returns(true); app_heartbeatMonitor_blockFaults(false); app_canRx_VC_Heartbeat_update(false); - app_canRx_RSM_Heartbeat_update(false); LetTimePass(500U); diff --git a/firmware/quadruna/CRIT/test/test_ledStatus.cpp b/firmware/quadruna/CRIT/test/test_ledStatus.cpp index 0873541eef..01dc258fc5 100644 --- a/firmware/quadruna/CRIT/test/test_ledStatus.cpp +++ b/firmware/quadruna/CRIT/test/test_ledStatus.cpp @@ -106,7 +106,7 @@ TEST_F(LedStatusTest, vc_board_status_led_control_with_warning) // Set any critical error and check that the DCM LED turns red for (const auto &[can_update, assert_func] : std::vector, std::function>>{ - { app_canRx_VC_Warning_ImuIo_update, fake_io_led_vc_status_set_callCountForArgs }, + { app_canRx_VC_Warning_ImuInitFailed_update, fake_io_led_vc_status_set_callCountForArgs }, { app_canRx_BMS_Warning_RxOverflow_update, fake_io_led_bms_status_set_callCountForArgs }, { app_canRx_FSM_Warning_LeftSuspensionOCSC_update, fake_io_led_fsm_status_set_callCountForArgs }, { app_canRx_RSM_Warning_LoadCell3OCSC_update, fake_io_led_rsm_status_set_callCountForArgs }, diff --git a/firmware/quadruna/FSM/CMakeLists.txt b/firmware/quadruna/FSM/CMakeLists.txt index 66a04f3973..f83c706a26 100644 --- a/firmware/quadruna/FSM/CMakeLists.txt +++ b/firmware/quadruna/FSM/CMakeLists.txt @@ -9,7 +9,6 @@ list(APPEND APP_SRCS "${SHARED_APP_INCLUDE_DIR}/app_rangeCheck.c" "${SHARED_APP_INCLUDE_DIR}/app_signal.c" "${SHARED_APP_INCLUDE_DIR}/app_timer.c" - "${SHARED_APP_INCLUDE_DIR}/app_heartbeatMonitor.c" "${SHARED_APP_INCLUDE_DIR}/app_shdnLoop.c" ) set(APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/app" "${SHARED_APP_INCLUDE_DIR}" "${SHARED_APP_INCLUDE_QUADRUNA_DIR}") diff --git a/firmware/quadruna/FSM/src/app/app_mainState.c b/firmware/quadruna/FSM/src/app/app_mainState.c index 5bb3cc9e06..32484dbca7 100644 --- a/firmware/quadruna/FSM/src/app/app_mainState.c +++ b/firmware/quadruna/FSM/src/app/app_mainState.c @@ -11,10 +11,11 @@ #include "app_suspension.h" #include "app_loadCell.h" #include "app_shdnLoop.h" -#include "app_heartbeatMonitor.h" void mainStateRunOnTick100Hz(void) { + app_canTx_FSM_Heartbeat_set(true); + app_apps_broadcast(); app_brake_broadcast(); app_steering_broadcast(); @@ -22,19 +23,6 @@ void mainStateRunOnTick100Hz(void) app_suspension_broadcast(); app_loadCell_broadcast(); app_shdn_loop_broadcast(); - - app_heartbeatMonitor_checkIn(); - app_heartbeatMonitor_broadcastFaults(); - - bool missing_hb = app_heartbeatMonitor_isSendingMissingHeartbeatFault(); - - if (missing_hb) - { - // Redundancy if FSM is missing heartbeats - // Suppress accelerator pedal percentages (set to 0%) - app_canTx_FSM_PappsMappedPedalPercentage_set(0); - app_canTx_FSM_SappsMappedPedalPercentage_set(0); - } } const State *app_mainState_get(void) diff --git a/firmware/quadruna/FSM/src/tasks.c b/firmware/quadruna/FSM/src/tasks.c index 8c29cba151..908bb48898 100644 --- a/firmware/quadruna/FSM/src/tasks.c +++ b/firmware/quadruna/FSM/src/tasks.c @@ -2,7 +2,6 @@ #include "main.h" #include "cmsis_os.h" -#include "app_heartbeatMonitor.h" #include "app_mainState.h" #include "app_canTx.h" @@ -128,53 +127,6 @@ static const PwmInputFreqOnlyConfig right_wheel_config = { .htim .tim_auto_reload_reg = TIM12_AUTO_RELOAD_REG, .tim_active_channel = HAL_TIM_ACTIVE_CHANNEL_1 }; -// config for heartbeat monitor (can funcs and flags) -// FSM rellies on BMS -static const bool heartbeatMonitorChecklist[HEARTBEAT_BOARD_COUNT] = { - [BMS_HEARTBEAT_BOARD] = true, [VC_HEARTBEAT_BOARD] = false, [RSM_HEARTBEAT_BOARD] = false, - [FSM_HEARTBEAT_BOARD] = false, [DIM_HEARTBEAT_BOARD] = false, [CRIT_HEARTBEAT_BOARD] = false -}; - -// heartbeatGetters - get heartbeat signals from other boards -static bool (*const heartbeatGetters[HEARTBEAT_BOARD_COUNT])(void) = { - [BMS_HEARTBEAT_BOARD] = app_canRx_BMS_Heartbeat_get, - [VC_HEARTBEAT_BOARD] = NULL, - [RSM_HEARTBEAT_BOARD] = NULL, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL -}; - -// heartbeatUpdaters - update local CAN table with heartbeat status -static void (*const heartbeatUpdaters[HEARTBEAT_BOARD_COUNT])(bool) = { - [BMS_HEARTBEAT_BOARD] = app_canRx_BMS_Heartbeat_update, - [VC_HEARTBEAT_BOARD] = NULL, - [RSM_HEARTBEAT_BOARD] = NULL, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL -}; - -// heartbeatFaultSetters - broadcast heartbeat faults over CAN -static void (*const heartbeatFaultSetters[HEARTBEAT_BOARD_COUNT])(bool) = { - [BMS_HEARTBEAT_BOARD] = app_canAlerts_FSM_Fault_MissingBMSHeartbeat_set, - [VC_HEARTBEAT_BOARD] = NULL, - [RSM_HEARTBEAT_BOARD] = NULL, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL -}; - -// heartbeatFaultGetters - gets fault statuses over CAN -static bool (*const heartbeatFaultGetters[HEARTBEAT_BOARD_COUNT])(void) = { - [BMS_HEARTBEAT_BOARD] = app_canAlerts_FSM_Fault_MissingBMSHeartbeat_get, - [VC_HEARTBEAT_BOARD] = NULL, - [RSM_HEARTBEAT_BOARD] = NULL, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL -}; - void tasks_preInit(void) { hw_bootup_enableInterruptsForApp(); @@ -218,10 +170,6 @@ void tasks_init(void) io_suspension_init(&suspension_config); io_wheels_init(&left_wheel_config, &right_wheel_config); - app_heartbeatMonitor_init( - heartbeatMonitorChecklist, heartbeatGetters, heartbeatUpdaters, &app_canTx_FSM_Heartbeat_set, - heartbeatFaultSetters, heartbeatFaultGetters); - app_stateMachine_init(app_mainState_get()); app_canTx_FSM_Hash_set(GIT_COMMIT_HASH); diff --git a/firmware/quadruna/FSM/test/test_faults.cpp b/firmware/quadruna/FSM/test/test_faults.cpp index 3550847f23..0a39baa90d 100644 --- a/firmware/quadruna/FSM/test/test_faults.cpp +++ b/firmware/quadruna/FSM/test/test_faults.cpp @@ -6,73 +6,6 @@ class FsmFaultsTest : public FsmBaseStateMachineTest { }; -TEST_F(FsmFaultsTest, check_state_transition_fault_state_heartbeat_timeout) -{ - // Test that a missing heartbeat will put the FSM into fault state. The FSM only monitors the BMS' heartbeat. - - // Re-enable heartbeat module. - app_heartbeatMonitor_blockFaults(false); - - // Start with a non-zero pedal positions to prevent false positive - int time_ms = 0; - fake_io_apps_getPrimary_returns(50.0f); - fake_io_apps_getSecondary_returns(50.0f); - LetTimePass(10); - - // Check in all heartbeats within timeout period - time_ms += HEARTBEAT_MONITOR_TIMEOUT_PERIOD_MS - 10U; - fake_io_time_getCurrentMs_returns(time_ms); - LetTimePass(HEARTBEAT_MONITOR_TIMEOUT_PERIOD_MS - 10U); - // Heartbeat faults initially present at startup until cleared - ASSERT_EQ(app_mainState_get(), app_stateMachine_getCurrentState()); - ASSERT_TRUE(app_canAlerts_FSM_Fault_MissingBMSHeartbeat_get()); - ASSERT_FLOAT_EQ(0.0f, app_canTx_FSM_PappsMappedPedalPercentage_get()); - ASSERT_FLOAT_EQ(0.0f, app_canTx_FSM_SappsMappedPedalPercentage_get()); - - app_canRx_BMS_Heartbeat_update(true); // Check in heartbeat - time_ms += 10; - fake_io_time_getCurrentMs_returns(time_ms); - LetTimePass(10); - ASSERT_EQ(app_mainState_get(), app_stateMachine_getCurrentState()); - ASSERT_FALSE(app_canAlerts_FSM_Fault_MissingBMSHeartbeat_get()); - ASSERT_NEAR(50.0f, app_canTx_FSM_PappsMappedPedalPercentage_get(), 0.5f); - ASSERT_NEAR(50.0f, app_canTx_FSM_SappsMappedPedalPercentage_get(), 0.5f); - - // Fail to check heartbeat, FSM should fault - time_ms += HEARTBEAT_MONITOR_TIMEOUT_PERIOD_MS - 10U; - fake_io_time_getCurrentMs_returns(time_ms); - LetTimePass(HEARTBEAT_MONITOR_TIMEOUT_PERIOD_MS - 10U); - ASSERT_EQ(app_mainState_get(), app_stateMachine_getCurrentState()); - ASSERT_FALSE(app_canAlerts_FSM_Fault_MissingBMSHeartbeat_get()); - ASSERT_NEAR(50.0f, app_canTx_FSM_PappsMappedPedalPercentage_get(), 0.5f); - ASSERT_NEAR(50.0f, app_canTx_FSM_SappsMappedPedalPercentage_get(), 0.5f); - - time_ms += 20; - fake_io_time_getCurrentMs_returns(time_ms); - LetTimePass(20); - ASSERT_TRUE(app_canAlerts_FSM_Fault_MissingBMSHeartbeat_get()); - ASSERT_FLOAT_EQ(0.0f, app_canTx_FSM_PappsMappedPedalPercentage_get()); - ASSERT_FLOAT_EQ(0.0f, app_canTx_FSM_SappsMappedPedalPercentage_get()); - - // Stay faulted indefinitely - time_ms += 1000; - fake_io_time_getCurrentMs_returns(time_ms); - LetTimePass(1000); - ASSERT_TRUE(app_canAlerts_FSM_Fault_MissingBMSHeartbeat_get()); - ASSERT_FLOAT_EQ(0.0f, app_canTx_FSM_PappsMappedPedalPercentage_get()); - ASSERT_FLOAT_EQ(0.0f, app_canTx_FSM_SappsMappedPedalPercentage_get()); - - // Check heartbeat back in, fault should clear and transition back to init - app_canRx_BMS_Heartbeat_update(true); // Check in heartbeat - time_ms += HEARTBEAT_MONITOR_TIMEOUT_PERIOD_MS; - fake_io_time_getCurrentMs_returns(time_ms); - LetTimePass(HEARTBEAT_MONITOR_TIMEOUT_PERIOD_MS); - ASSERT_EQ(app_mainState_get(), app_stateMachine_getCurrentState()); - ASSERT_FALSE(app_canAlerts_FSM_Fault_MissingBMSHeartbeat_get()); - ASSERT_NEAR(50.0f, app_canTx_FSM_PappsMappedPedalPercentage_get(), 0.5f); - ASSERT_NEAR(50.0f, app_canTx_FSM_SappsMappedPedalPercentage_get(), 0.5f); -} - TEST_F(FsmFaultsTest, papps_ocsc_sets_mapped_pedal_percentage_to_zero) { // For the following test we will select a secondary APPS sensor diff --git a/firmware/quadruna/FSM/test/test_fsmBaseStateMachineTest.h b/firmware/quadruna/FSM/test/test_fsmBaseStateMachineTest.h index 2881b9b019..e6814322e4 100644 --- a/firmware/quadruna/FSM/test/test_fsmBaseStateMachineTest.h +++ b/firmware/quadruna/FSM/test/test_fsmBaseStateMachineTest.h @@ -13,7 +13,6 @@ extern "C" #include "app_canTx.h" #include "app_canRx.h" #include "app_canAlerts.h" -#include "app_heartbeatMonitor.h" #include "app_stateMachine.h" #include "app_canUtils.h" #include "app_utils.h" @@ -39,14 +38,7 @@ class FsmBaseStateMachineTest : public BaseStateMachineTest app_canRx_init(); app_apps_init(); - app_heartbeatMonitor_init( - heartbeatMonitorChecklist, heartbeatGetters, heartbeatUpdaters, &app_canTx_FSM_Heartbeat_set, - heartbeatFaultSetters, heartbeatFaultGetters); app_stateMachine_init(app_mainState_get()); - - // Disable heartbeat monitor in the nominal case. To use representative heartbeat behavior, - // re-enable the heartbeat monitor. - app_heartbeatMonitor_blockFaults(true); } void TearDown() override @@ -82,47 +74,4 @@ class FsmBaseStateMachineTest : public BaseStateMachineTest fake_io_loadCell_sensor1OCSC_reset(); fake_io_loadCell_sensor2OCSC_reset(); } - - // config for heartbeat monitor (can funcs and flags) - // FSM rellies on BMS - bool heartbeatMonitorChecklist[HEARTBEAT_BOARD_COUNT] = { - [BMS_HEARTBEAT_BOARD] = true, [VC_HEARTBEAT_BOARD] = false, [RSM_HEARTBEAT_BOARD] = false, - [FSM_HEARTBEAT_BOARD] = false, [DIM_HEARTBEAT_BOARD] = false, [CRIT_HEARTBEAT_BOARD] = false - }; - - // heartbeatGetters - get heartbeat signals from other boards - bool (*heartbeatGetters[HEARTBEAT_BOARD_COUNT])() = { [BMS_HEARTBEAT_BOARD] = app_canRx_BMS_Heartbeat_get, - [VC_HEARTBEAT_BOARD] = NULL, - [RSM_HEARTBEAT_BOARD] = NULL, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL }; - - // heartbeatUpdaters - update local CAN table with heartbeat status - void (*heartbeatUpdaters[HEARTBEAT_BOARD_COUNT])(bool) = { [BMS_HEARTBEAT_BOARD] = app_canRx_BMS_Heartbeat_update, - [VC_HEARTBEAT_BOARD] = NULL, - [RSM_HEARTBEAT_BOARD] = NULL, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL }; - - // heartbeatFaultSetters - broadcast heartbeat faults over CAN - void (*heartbeatFaultSetters[HEARTBEAT_BOARD_COUNT])(bool) = { - [BMS_HEARTBEAT_BOARD] = app_canAlerts_FSM_Fault_MissingBMSHeartbeat_set, - [VC_HEARTBEAT_BOARD] = NULL, - [RSM_HEARTBEAT_BOARD] = NULL, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL - }; - - // heartbeatFaultGetters - gets fault statuses over CAN - bool (*heartbeatFaultGetters[HEARTBEAT_BOARD_COUNT])() = { - [BMS_HEARTBEAT_BOARD] = app_canAlerts_FSM_Fault_MissingBMSHeartbeat_get, - [VC_HEARTBEAT_BOARD] = NULL, - [RSM_HEARTBEAT_BOARD] = NULL, - [FSM_HEARTBEAT_BOARD] = NULL, - [DIM_HEARTBEAT_BOARD] = NULL, - [CRIT_HEARTBEAT_BOARD] = NULL - }; }; diff --git a/firmware/quadruna/RSM/src/tasks.c b/firmware/quadruna/RSM/src/tasks.c index 6c1cfb7cdd..085a20c80d 100644 --- a/firmware/quadruna/RSM/src/tasks.c +++ b/firmware/quadruna/RSM/src/tasks.c @@ -4,7 +4,6 @@ #include "app_heartbeatMonitor.h" #include "app_mainState.h" - #include "app_canTx.h" #include "app_canRx.h" #include "app_canAlerts.h" @@ -123,36 +122,48 @@ static const UART debug_uart = { .handle = &huart1 }; // config for heartbeat monitor /// RSM rellies on BMS static const bool heartbeatMonitorChecklist[HEARTBEAT_BOARD_COUNT] = { - [BMS_HEARTBEAT_BOARD] = false, [VC_HEARTBEAT_BOARD] = true, [RSM_HEARTBEAT_BOARD] = false, - [FSM_HEARTBEAT_BOARD] = true, [DIM_HEARTBEAT_BOARD] = false, [CRIT_HEARTBEAT_BOARD] = false + [BMS_HEARTBEAT_BOARD] = true, [VC_HEARTBEAT_BOARD] = true, [RSM_HEARTBEAT_BOARD] = false, + [FSM_HEARTBEAT_BOARD] = true, [DIM_HEARTBEAT_BOARD] = false, [CRIT_HEARTBEAT_BOARD] = false }; // heartbeatGetters - get heartbeat signals from other boards static bool (*const heartbeatGetters[HEARTBEAT_BOARD_COUNT])(void) = { - [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_get, - [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = app_canRx_FSM_Heartbeat_get, - [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = app_canRx_BMS_Heartbeat_get, + [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_get, + [RSM_HEARTBEAT_BOARD] = NULL, + [FSM_HEARTBEAT_BOARD] = app_canRx_FSM_Heartbeat_get, + [DIM_HEARTBEAT_BOARD] = NULL, + [CRIT_HEARTBEAT_BOARD] = NULL }; // heartbeatUpdaters - update local CAN table with heartbeat status static void (*const heartbeatUpdaters[HEARTBEAT_BOARD_COUNT])(bool) = { - [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_update, - [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_update, - [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = app_canRx_BMS_Heartbeat_update, + [VC_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_update, + [RSM_HEARTBEAT_BOARD] = NULL, + [FSM_HEARTBEAT_BOARD] = app_canRx_VC_Heartbeat_update, + [DIM_HEARTBEAT_BOARD] = NULL, + [CRIT_HEARTBEAT_BOARD] = NULL }; // heartbeatFaultSetters - broadcast heartbeat faults over CAN static void (*const heartbeatFaultSetters[HEARTBEAT_BOARD_COUNT])(bool) = { - [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingVCHeartbeat_set, - [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingFSMHeartbeat_set, - [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingBMSHeartbeat_set, + [VC_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingVCHeartbeat_set, + [RSM_HEARTBEAT_BOARD] = NULL, + [FSM_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingFSMHeartbeat_set, + [DIM_HEARTBEAT_BOARD] = NULL, + [CRIT_HEARTBEAT_BOARD] = NULL }; // heartbeatFaultGetters - gets fault statuses over CAN static bool (*const heartbeatFaultGetters[HEARTBEAT_BOARD_COUNT])(void) = { - [BMS_HEARTBEAT_BOARD] = NULL, [VC_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingVCHeartbeat_get, - [RSM_HEARTBEAT_BOARD] = NULL, [FSM_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingFSMHeartbeat_get, - [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = NULL + [BMS_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingBMSHeartbeat_get, + [VC_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingVCHeartbeat_get, + [RSM_HEARTBEAT_BOARD] = NULL, + [FSM_HEARTBEAT_BOARD] = app_canAlerts_RSM_Fault_MissingFSMHeartbeat_get, + [DIM_HEARTBEAT_BOARD] = NULL, + [CRIT_HEARTBEAT_BOARD] = NULL }; void tasks_preInit(void) diff --git a/firmware/quadruna/VC/src/app/app_currentSensing.c b/firmware/quadruna/VC/src/app/app_currentSensing.c index 33e5fecf4a..351d180c5f 100644 --- a/firmware/quadruna/VC/src/app/app_currentSensing.c +++ b/firmware/quadruna/VC/src/app/app_currentSensing.c @@ -5,8 +5,8 @@ void app_currentSensing_broadcast(void) { - app_canAlerts_VC_Fault_AccumulatorFault_set(io_currentSensing_hasAccumulatorFault()); - app_canAlerts_VC_Fault_BatteryFault_set(io_currentSensing_hasBatteryFault()); + app_canAlerts_VC_Warning_AccumulatorRailOvercurrentFault_set(io_currentSensing_hasAccumulatorFault()); + app_canAlerts_VC_Warning_BatteryRailOvercurrentFault_set(io_currentSensing_hasBatteryFault()); app_canTx_VC_AccCurrent_set(io_currentSensing_getAccumulatorCurrent()); app_canTx_VC_BatCurrent_set(io_currentSensing_getBatteryCurrent()); } \ No newline at end of file diff --git a/firmware/quadruna/VC/src/app/app_lowVoltageBattery.c b/firmware/quadruna/VC/src/app/app_lowVoltageBattery.c index d5c19614d9..9828649290 100644 --- a/firmware/quadruna/VC/src/app/app_lowVoltageBattery.c +++ b/firmware/quadruna/VC/src/app/app_lowVoltageBattery.c @@ -10,6 +10,6 @@ void app_lowVoltageBattery_broadcast(void) app_canTx_VC_AccVoltage_set(io_lowVoltageBattery_getAccVoltage()); app_canTx_VC_BoostVoltage_set(io_lowVoltageBattery_getBoostVoltage()); - app_canAlerts_VC_Fault_LvChargeFault_set(io_lowVoltageBattery_hasChargeFault() && false); // TODO - app_canAlerts_VC_Fault_BoostControllerFault_set(io_lowVoltageBattery_hasBoostControllerFault() && false); + app_canAlerts_VC_Warning_LvChargeFault_set(io_lowVoltageBattery_hasChargeFault()); + app_canAlerts_VC_Warning_BoostControllerFault_set(io_lowVoltageBattery_hasBoostControllerFault()); } diff --git a/firmware/quadruna/VC/src/tasks.c b/firmware/quadruna/VC/src/tasks.c index 1ba1fd9c51..065e48c326 100644 --- a/firmware/quadruna/VC/src/tasks.c +++ b/firmware/quadruna/VC/src/tasks.c @@ -406,7 +406,7 @@ void tasks_init(void) if (!io_imu_init()) { - app_canAlerts_VC_Warning_ImuIo_set(true); + app_canAlerts_VC_Warning_ImuInitFailed_set(true); } app_canTx_init(); diff --git a/firmware/quadruna/VC/test/test_vcBaseStateMachineTest.h b/firmware/quadruna/VC/test/test_vcBaseStateMachineTest.h index f7e1390fc2..208c5f15b3 100644 --- a/firmware/quadruna/VC/test/test_vcBaseStateMachineTest.h +++ b/firmware/quadruna/VC/test/test_vcBaseStateMachineTest.h @@ -117,7 +117,7 @@ class VcBaseStateMachineTest : public BaseStateMachineTest // heartbeatGetters - get heartbeat signals from other boards bool (*heartbeatGetters[HEARTBEAT_BOARD_COUNT])() = { [BMS_HEARTBEAT_BOARD] = app_canRx_BMS_Heartbeat_get, [VC_HEARTBEAT_BOARD] = NULL, - [RSM_HEARTBEAT_BOARD] = app_canRx_RSM_Heartbeat_get, + [RSM_HEARTBEAT_BOARD] = app_canRx_FSM_Heartbeat_get, [FSM_HEARTBEAT_BOARD] = app_canRx_FSM_Heartbeat_get, [DIM_HEARTBEAT_BOARD] = NULL, [CRIT_HEARTBEAT_BOARD] = app_canRx_CRIT_Heartbeat_get };