@@ -34,26 +34,17 @@ void SerialLogger::log(SensorID id, AlertLevel lvl, float v) {
3434void SerialLogger::log (SensorID id, AlertLevel lvl, bool v) {
3535 const char * levelNames[] = {" OK" , " WARN_LOW" , " WARN_HIGH" , " CRIT_LOW" , " CRIT_HIGH" , " INFO" };
3636
37- // Enhanced logging for ESC errors - show decoded error details
38- if (id == SensorID::ESC_Running_Error) {
37+ // Enhanced logging for ESC errors - show decoded error details
38+ if (id == SensorID::ESC_OverCurrent_Error || id == SensorID::ESC_LockedRotor_Error ||
39+ id == SensorID::ESC_OverTemp_Error || id == SensorID::ESC_OverVolt_Error ||
40+ id == SensorID::ESC_VoltageDrop_Error || id == SensorID::ESC_ThrottleSat_Warning) {
3941 if (v) {
4042 USBSerial.printf (" [%lu] [%s] %s = %s (0x%04X: %s)\n " ,
4143 millis (), levelNames[(int )lvl], sensorIDToString (id),
4244 v ? " ON" : " OFF" , monitoringEscData.running_error ,
4345 decodeRunningError (monitoringEscData.running_error ).c_str ());
4446 } else {
45- USBSerial.printf (" [%lu] [%s] %s = %s (critical errors cleared)\n " ,
46- millis (), levelNames[(int )lvl], sensorIDToString (id),
47- v ? " ON" : " OFF" );
48- }
49- } else if (id == SensorID::ESC_Running_Warning) {
50- if (v) {
51- USBSerial.printf (" [%lu] [%s] %s = %s (0x%04X: %s)\n " ,
52- millis (), levelNames[(int )lvl], sensorIDToString (id),
53- v ? " ON" : " OFF" , monitoringEscData.running_error ,
54- decodeRunningError (monitoringEscData.running_error ).c_str ());
55- } else {
56- USBSerial.printf (" [%lu] [%s] %s = %s (warnings cleared)\n " ,
47+ USBSerial.printf (" [%lu] [%s] %s = %s (cleared)\n " ,
5748 millis (), levelNames[(int )lvl], sensorIDToString (id),
5849 v ? " ON" : " OFF" );
5950 }
@@ -81,8 +72,15 @@ const char* sensorIDToString(SensorID id) {
8172 case SensorID::ESC_MCU_Temp: return " ESC_MCU_Temp" ;
8273 case SensorID::ESC_CAP_Temp: return " ESC_CAP_Temp" ;
8374 case SensorID::Motor_Temp: return " Motor_Temp" ;
84- case SensorID::ESC_Running_Error: return " ESC_Run_Err" ;
85- case SensorID::ESC_Running_Warning: return " ESC_Run_Warn" ;
75+ // ESC Running Errors (Critical)
76+ case SensorID::ESC_OverCurrent_Error: return " ESC_OverCurrent_Error" ;
77+ case SensorID::ESC_LockedRotor_Error: return " ESC_LockedRotor_Error" ;
78+ case SensorID::ESC_OverTemp_Error: return " ESC_OverTemp_Error" ;
79+ case SensorID::ESC_OverVolt_Error: return " ESC_OverVolt_Error" ;
80+ case SensorID::ESC_VoltageDrop_Error: return " ESC_VoltageDrop_Error" ;
81+ // ESC Running Warnings
82+ case SensorID::ESC_ThrottleSat_Warning: return " ESC_ThrottleSat_Warning" ;
83+ // ESC Self-Check Errors
8684 case SensorID::ESC_SelfCheck_Error: return " ESC_Boot_Err" ;
8785
8886 // BMS
@@ -118,8 +116,15 @@ const char* sensorIDToAbbreviation(SensorID id) {
118116 case SensorID::ESC_MCU_Temp: return " ESC-C" ; // Controller temp
119117 case SensorID::ESC_CAP_Temp: return " ESC-P" ; // Capacitor temp
120118 case SensorID::Motor_Temp: return " MTR-T" ; // Motor temp
121- case SensorID::ESC_Running_Error: return " ESC-RE" ; // Running error
122- case SensorID::ESC_Running_Warning: return " ESC-RW" ; // Running warning
119+ // ESC Running Errors (Critical) - with bit numbers
120+ case SensorID::ESC_OverCurrent_Error: return " ESC-RE-0" ; // Bit 0
121+ case SensorID::ESC_LockedRotor_Error: return " ESC-RE-1" ; // Bit 1
122+ case SensorID::ESC_OverTemp_Error: return " ESC-RE-2" ; // Bit 2
123+ case SensorID::ESC_OverVolt_Error: return " ESC-RE-6" ; // Bit 6
124+ case SensorID::ESC_VoltageDrop_Error: return " ESC-RE-7" ; // Bit 7
125+ // ESC Running Warnings - with bit numbers
126+ case SensorID::ESC_ThrottleSat_Warning: return " ESC-RW-5" ; // Bit 5
127+ // ESC Self-Check Errors
123128 case SensorID::ESC_SelfCheck_Error: return " ESC-SE" ; // Self-check error
124129
125130 // BMS (Battery Management System)
@@ -216,23 +221,43 @@ void addESCMonitors() {
216221 &multiLogger);
217222 monitors.push_back (motorTemp);
218223
219- // ESC Running Error Monitor
220- static BooleanMonitor* escRunningError = new BooleanMonitor (
221- SensorID::ESC_Running_Error,
222- []() { return hasCriticalRunningError (monitoringEscData.running_error ); },
223- true , // Alert when true (when errors are present)
224- AlertLevel::CRIT_HIGH,
225- &multiLogger);
226- monitors.push_back (escRunningError);
227-
228- // ESC Running Warning Monitor (for throttle saturation, etc.)
229- static BooleanMonitor* escRunningWarning = new BooleanMonitor (
230- SensorID::ESC_Running_Warning,
231- []() { return hasWarningRunningError (monitoringEscData.running_error ); },
232- true , // Alert when true (when warnings are present)
233- AlertLevel::WARN_HIGH,
234- &multiLogger);
235- monitors.push_back (escRunningWarning);
224+ // Individual ESC Running Error Monitors (Critical)
225+ static BooleanMonitor* escOverCurrentError = new BooleanMonitor (
226+ SensorID::ESC_OverCurrent_Error,
227+ []() { return hasOverCurrentError (monitoringEscData.running_error ); },
228+ true , AlertLevel::CRIT_HIGH, &multiLogger);
229+ monitors.push_back (escOverCurrentError);
230+
231+ static BooleanMonitor* escLockedRotorError = new BooleanMonitor (
232+ SensorID::ESC_LockedRotor_Error,
233+ []() { return hasLockedRotorError (monitoringEscData.running_error ); },
234+ true , AlertLevel::CRIT_HIGH, &multiLogger);
235+ monitors.push_back (escLockedRotorError);
236+
237+ static BooleanMonitor* escOverTempError = new BooleanMonitor (
238+ SensorID::ESC_OverTemp_Error,
239+ []() { return hasOverTempError (monitoringEscData.running_error ); },
240+ true , AlertLevel::CRIT_HIGH, &multiLogger);
241+ monitors.push_back (escOverTempError);
242+
243+ static BooleanMonitor* escOverVoltError = new BooleanMonitor (
244+ SensorID::ESC_OverVolt_Error,
245+ []() { return hasOverVoltError (monitoringEscData.running_error ); },
246+ true , AlertLevel::CRIT_HIGH, &multiLogger);
247+ monitors.push_back (escOverVoltError);
248+
249+ static BooleanMonitor* escVoltageDropError = new BooleanMonitor (
250+ SensorID::ESC_VoltageDrop_Error,
251+ []() { return hasVoltagDropError (monitoringEscData.running_error ); },
252+ true , AlertLevel::CRIT_HIGH, &multiLogger);
253+ monitors.push_back (escVoltageDropError);
254+
255+ // Individual ESC Running Warning Monitors
256+ static BooleanMonitor* escThrottleSatWarning = new BooleanMonitor (
257+ SensorID::ESC_ThrottleSat_Warning,
258+ []() { return hasThrottleSatWarning (monitoringEscData.running_error ); },
259+ true , AlertLevel::WARN_HIGH, &multiLogger);
260+ monitors.push_back (escThrottleSatWarning);
236261
237262 // ESC Self-Check Error Monitor
238263 static BooleanMonitor* escSelfCheckError = new BooleanMonitor (
0 commit comments