Changes due to review comments

- Split bms_status (system status) to real_bms_status (bms status)
- Put #ifdef DEBUG_LOG around all log calls.
- Do not update bms_status (system status) directly, fire event instead from automatic precharge control
- Add Battery BMS status to webserver for MEB battery type only
This commit is contained in:
mvgalen 2025-01-14 22:26:31 +01:00
parent 753b506068
commit 9410b8732b
11 changed files with 103 additions and 50 deletions

View file

@ -168,6 +168,7 @@ void init_events(void) {
events.entries[EVENT_SOH_LOW].level = EVENT_LEVEL_ERROR;
events.entries[EVENT_HVIL_FAILURE].level = EVENT_LEVEL_ERROR;
events.entries[EVENT_PRECHARGE_FAILURE].level = EVENT_LEVEL_INFO;
events.entries[EVENT_AUTOMATIC_PRECHARGE_FAILURE].level = EVENT_LEVEL_ERROR;
events.entries[EVENT_INTERNAL_OPEN_FAULT].level = EVENT_LEVEL_ERROR;
events.entries[EVENT_INVERTER_OPEN_CONTACTOR].level = EVENT_LEVEL_INFO;
events.entries[EVENT_INTERFACE_MISSING].level = EVENT_LEVEL_INFO;
@ -340,6 +341,8 @@ const char* get_event_message_string(EVENTS_ENUM_TYPE event) {
"Battery will be disabled!";
case EVENT_PRECHARGE_FAILURE:
return "Battery failed to precharge. Check that capacitor is seated on high voltage output.";
case EVENT_AUTOMATIC_PRECHARGE_FAILURE:
return "Automatic precharge failed to reach target voltae.";
case EVENT_INTERNAL_OPEN_FAULT:
return "High voltage cable removed while battery running. Opening contactors!";
case EVENT_INVERTER_OPEN_CONTACTOR:
@ -501,15 +504,9 @@ static void update_bms_status(void) {
break;
case EVENT_LEVEL_UPDATE:
datalayer.battery.status.bms_status = UPDATING;
#ifdef DOUBLE_BATTERY
datalayer.battery2.status.bms_status = UPDATING;
#endif
break;
case EVENT_LEVEL_ERROR:
datalayer.battery.status.bms_status = FAULT;
#ifdef DOUBLE_BATTERY
datalayer.battery2.status.bms_status = FAULT;
#endif
break;
default:
break;