mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Make webserver reflect actual second battery control status
This commit is contained in:
parent
21b801b983
commit
40717942fb
3 changed files with 15 additions and 10 deletions
|
@ -785,7 +785,7 @@ void handle_contactors() {
|
|||
set(NEGATIVE_CONTACTOR_PIN, OFF, PWM_OFF_DUTY);
|
||||
set(POSITIVE_CONTACTOR_PIN, OFF, PWM_OFF_DUTY);
|
||||
set_event(EVENT_ERROR_OPEN_CONTACTOR, 0);
|
||||
datalayer.system.status.contactor_control_closed = false;
|
||||
datalayer.system.status.contactors_engaged = false;
|
||||
return; // A fault scenario latches the contactor control. It is not possible to recover without a powercycle (and investigation why fault occured)
|
||||
}
|
||||
|
||||
|
@ -810,9 +810,11 @@ void handle_contactors() {
|
|||
if (datalayer.system.status.battery2_allows_contactor_closing) {
|
||||
set(SECOND_NEGATIVE_CONTACTOR_PIN, ON);
|
||||
set(SECOND_POSITIVE_CONTACTOR_PIN, ON);
|
||||
datalayer.system.status.contactors_battery2_engaged = true;
|
||||
} else { // Closing contactors on secondary battery not allowed
|
||||
set(SECOND_NEGATIVE_CONTACTOR_PIN, OFF);
|
||||
set(SECOND_POSITIVE_CONTACTOR_PIN, OFF);
|
||||
datalayer.system.status.contactors_battery2_engaged = false;
|
||||
}
|
||||
#endif //CONTACTOR_CONTROL_DOUBLE_BATTERY
|
||||
// Skip running the state machine below if it has already completed
|
||||
|
@ -849,7 +851,7 @@ void handle_contactors() {
|
|||
set(NEGATIVE_CONTACTOR_PIN, ON, PWM_HOLD_DUTY);
|
||||
set(POSITIVE_CONTACTOR_PIN, ON, PWM_HOLD_DUTY);
|
||||
contactorStatus = COMPLETED;
|
||||
datalayer.system.status.contactor_control_closed = true;
|
||||
datalayer.system.status.contactors_engaged = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -189,7 +189,9 @@ typedef struct {
|
|||
bool inverter_allows_contactor_closing = true;
|
||||
#ifdef CONTACTOR_CONTROL
|
||||
/** True if the contactor controlled by battery-emulator is closed */
|
||||
bool contactor_control_closed = false;
|
||||
bool contactors_engaged = false;
|
||||
/** True if the contactor controlled by battery-emulator is closed */
|
||||
bool contactors_battery2_engaged = false;
|
||||
#endif
|
||||
} DATALAYER_SYSTEM_STATUS_TYPE;
|
||||
|
||||
|
|
|
@ -733,7 +733,7 @@ String processor(const String& var) {
|
|||
|
||||
#ifdef CONTACTOR_CONTROL
|
||||
content += "<h4>Contactors controlled by Battery-Emulator: ";
|
||||
if (datalayer.system.status.contactor_control_closed) {
|
||||
if (datalayer.system.status.contactors_engaged) {
|
||||
content += "<span style='color: green;'>ON</span>";
|
||||
} else {
|
||||
content += "<span style='color: red;'>OFF</span>";
|
||||
|
@ -853,34 +853,35 @@ String processor(const String& var) {
|
|||
|
||||
#ifdef CONTACTOR_CONTROL
|
||||
content += "<h4>Contactors controlled by Battery-Emulator: ";
|
||||
if (datalayer.system.status.contactor_control_closed) {
|
||||
if (datalayer.system.status.contactors_battery2_engaged) {
|
||||
content += "<span style='color: green;'>ON</span>";
|
||||
} else {
|
||||
content += "<span style='color: red;'>OFF</span>";
|
||||
}
|
||||
content += "</h4>";
|
||||
|
||||
#ifdef CONTACTOR_CONTROL_DOUBLE_BATTERY
|
||||
content += "<h4>Pre Charge: ";
|
||||
if (digitalRead(PRECHARGE_PIN) == HIGH) {
|
||||
if (digitalRead(SECOND_PRECHARGE_PIN) == HIGH) {
|
||||
content += "<span style='color: green;'>✓</span>";
|
||||
} else {
|
||||
content += "<span style='color: red;'>✕</span>";
|
||||
}
|
||||
content += " Cont. Neg.: ";
|
||||
if (digitalRead(NEGATIVE_CONTACTOR_PIN) == HIGH) {
|
||||
if (digitalRead(SECOND_NEGATIVE_CONTACTOR_PIN) == HIGH) {
|
||||
content += "<span style='color: green;'>✓</span>";
|
||||
} else {
|
||||
content += "<span style='color: red;'>✕</span>";
|
||||
}
|
||||
|
||||
content += " Cont. Pos.: ";
|
||||
if (digitalRead(POSITIVE_CONTACTOR_PIN) == HIGH) {
|
||||
if (digitalRead(SECOND_POSITIVE_CONTACTOR_PIN) == HIGH) {
|
||||
content += "<span style='color: green;'>✓</span>";
|
||||
} else {
|
||||
content += "<span style='color: red;'>✕</span>";
|
||||
}
|
||||
content += "</h4>";
|
||||
#endif
|
||||
#endif // CONTACTOR_CONTROL_DOUBLE_BATTERY
|
||||
#endif // CONTACTOR_CONTROL
|
||||
|
||||
content += "</div>";
|
||||
content += "</div>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue