diff --git a/Software/Software.ino b/Software/Software.ino index 9428aa85..ef495444 100644 --- a/Software/Software.ino +++ b/Software/Software.ino @@ -462,7 +462,7 @@ void init_contactors() { digitalWrite(PRECHARGE_PIN, LOW); #endif // Init BMS contactor -#ifdef HW_STARK // TODO: Rewrite this so LilyGo can aslo handle this BMS contactor +#ifdef HW_STARK // TODO: Rewrite this so LilyGo can also handle this BMS contactor pinMode(BMS_POWER, OUTPUT); digitalWrite(BMS_POWER, HIGH); #endif @@ -653,6 +653,7 @@ void handle_contactors() { digitalWrite(NEGATIVE_CONTACTOR_PIN, LOW); digitalWrite(POSITIVE_CONTACTOR_PIN, LOW); set_event(EVENT_ERROR_OPEN_CONTACTOR, 0); + datalayer.system.status.contactor_control_closed = false; return; // A fault scenario latches the contactor control. It is not possible to recover without a powercycle (and investigation why fault occured) } @@ -718,6 +719,7 @@ void handle_contactors() { ledcWrite(POSITIVE_PWM_Ch, PWM_Hold_Duty); #endif contactorStatus = COMPLETED; + datalayer.system.status.contactor_control_closed = true; } break; default: diff --git a/Software/src/datalayer/datalayer.h b/Software/src/datalayer/datalayer.h index f64a190e..eebcf3a6 100644 --- a/Software/src/datalayer/datalayer.h +++ b/Software/src/datalayer/datalayer.h @@ -165,6 +165,10 @@ typedef struct { bool battery2_allows_contactor_closing = false; /** True if the inverter allows for the contactors to close */ bool inverter_allows_contactor_closing = true; +#ifdef CONTACTOR_CONTROL + /** True if the contactor controlled by battery-emulator is closed */ + bool contactor_control_closed = false; +#endif } DATALAYER_SYSTEM_STATUS_TYPE; typedef struct { diff --git a/Software/src/devboard/webserver/webserver.cpp b/Software/src/devboard/webserver/webserver.cpp index 7935ce01..119c3bd3 100644 --- a/Software/src/devboard/webserver/webserver.cpp +++ b/Software/src/devboard/webserver/webserver.cpp @@ -645,6 +645,16 @@ String processor(const String& var) { else content += "

Pause status: " + String(get_emulator_pause_status().c_str()) + "

"; +#ifdef CONTACTOR_CONTROL + content += "

Contactors controlled by Battery-Emulator: "; + if (datalayer.system.status.contactor_control_closed) { + content += "ON"; + } else { + content += "OFF"; + } + content += "

"; +#endif + // Close the block content += ""; @@ -720,6 +730,17 @@ String processor(const String& var) { } else { content += ""; } + +#ifdef CONTACTOR_CONTROL + content += "

Contactors controlled by Battery-Emulator: "; + if (datalayer.system.status.contactor_control_closed) { + content += "ON"; + } else { + content += "OFF"; + } + content += "

"; +#endif + if (emulator_pause_status == NORMAL) content += "

Pause status: " + String(get_emulator_pause_status().c_str()) + "

"; else