File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ enum class SensorID {
4444 ESC_MotorIDet2_Error, // Bit 11: motor_i_det2_bad
4545 ESC_SwHwIncompat_Error, // Bit 13: sw_hw_incompatible
4646 ESC_BootloaderBad_Error, // Bit 14: bootloader_unsupported
47+ ESC_TWAI_Init_Failure, // TWAI/CAN bus initialization failure
4748
4849 // BMS
4950 BMS_MOS_Temp,
Original file line number Diff line number Diff line change @@ -10,7 +10,19 @@ extern MultiLogger multiLogger;
1010// External references to thread-safe data copies
1111extern STR_ESC_TELEMETRY_140 monitoringEscData;
1212
13+ // External reference to ESC TWAI initialization status
14+ extern bool escTwaiInitialized;
15+
1316void addESCMonitors () {
17+ // ESC TWAI Initialization (Alert when failed)
18+ static BooleanMonitor* escTwaiInitFailure = new BooleanMonitor (
19+ SensorID::ESC_TWAI_Init_Failure,
20+ SensorCategory::ESC,
21+ []() { return escTwaiInitialized; },
22+ false , // Alert when false (i.e., when initialization failed)
23+ AlertLevel::CRIT_HIGH, // Critical since ESC won't work without TWAI
24+ &multiLogger);
25+ monitors.push_back (escTwaiInitFailure);
1426 // ESC MOS Temperature Monitor - with hysteresis
1527 static HysteresisSensorMonitor* escMosTemp = new HysteresisSensorMonitor (
1628 SensorID::ESC_MOS_Temp,
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ const char* sensorIDToString(SensorID id) {
108108 case SensorID::ESC_MotorIDet2_Error: return " ESC_MotorIDet2_Error" ;
109109 case SensorID::ESC_SwHwIncompat_Error: return " ESC_SwHwIncompat_Error" ;
110110 case SensorID::ESC_BootloaderBad_Error: return " ESC_BootloaderBad_Error" ;
111+ case SensorID::ESC_TWAI_Init_Failure: return " ESC_TWAI_Init_Failure" ;
111112
112113 // BMS
113114 case SensorID::BMS_MOS_Temp: return " BMS_MOS_Temp" ;
@@ -167,6 +168,7 @@ const char* sensorIDToAbbreviation(SensorID id) {
167168 case SensorID::ESC_MotorIDet2_Error: return " MC-SE-11" ; // Bit 11
168169 case SensorID::ESC_SwHwIncompat_Error: return " MC-SE-13" ; // Bit 13
169170 case SensorID::ESC_BootloaderBad_Error: return " MC-SE-14" ; // Bit 14
171+ case SensorID::ESC_TWAI_Init_Failure: return " MC-CAN" ; // CAN/TWAI init failure
170172
171173 // BMS (Battery Management System)
172174 case SensorID::BMS_MOS_Temp: return " BC-F" ;
You can’t perform that action at this time.
0 commit comments