mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Make webserver work with PWM
This commit is contained in:
parent
62778628e5
commit
3a4ea70666
1 changed files with 26 additions and 10 deletions
|
@ -685,7 +685,7 @@ String processor(const String& var) {
|
||||||
content += "<h4 style='color: red;'>Power status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
content += "<h4 style='color: red;'>Power status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||||
|
|
||||||
#ifdef CONTACTOR_CONTROL
|
#ifdef CONTACTOR_CONTROL
|
||||||
content += "<h4>Contactors controlled by Battery-Emulator: ";
|
content += "<h4>Contactors controlled by emulator, state: ";
|
||||||
if (datalayer.system.status.contactors_engaged) {
|
if (datalayer.system.status.contactors_engaged) {
|
||||||
content += "<span style='color: green;'>ON</span>";
|
content += "<span style='color: green;'>ON</span>";
|
||||||
} else {
|
} else {
|
||||||
|
@ -693,13 +693,21 @@ String processor(const String& var) {
|
||||||
}
|
}
|
||||||
content += "</h4>";
|
content += "</h4>";
|
||||||
|
|
||||||
content += "<h4>Pre Charge: ";
|
content += "<h4>Precharge: (";
|
||||||
if (digitalRead(PRECHARGE_PIN) == HIGH) {
|
content += PRECHARGE_TIME_MS;
|
||||||
content += "<span style='color: green;'>✓</span>";
|
content += " ms) Cont. Neg.: ";
|
||||||
|
#ifdef PWM_CONTACTOR_CONTROL
|
||||||
|
if (datalayer.system.status.contactors_engaged) {
|
||||||
|
content += "<span style='color: green;'>Economized</span>";
|
||||||
|
content += " Cont. Pos.: ";
|
||||||
|
content += "<span style='color: green;'>Economized</span>";
|
||||||
} else {
|
} else {
|
||||||
content += "<span style='color: red;'>✕</span>";
|
content += "<span style='color: red;'>✕</span>";
|
||||||
|
content += " Cont. Pos.: ";
|
||||||
|
content += "<span style='color: red;'>✕</span>";
|
||||||
}
|
}
|
||||||
content += " Cont. Neg.: ";
|
|
||||||
|
#else // No PWM_CONTACTOR_CONTROL , we can read the pin and see feedback. Helpful if channel overloaded
|
||||||
if (digitalRead(NEGATIVE_CONTACTOR_PIN) == HIGH) {
|
if (digitalRead(NEGATIVE_CONTACTOR_PIN) == HIGH) {
|
||||||
content += "<span style='color: green;'>✓</span>";
|
content += "<span style='color: green;'>✓</span>";
|
||||||
} else {
|
} else {
|
||||||
|
@ -712,6 +720,7 @@ String processor(const String& var) {
|
||||||
} else {
|
} else {
|
||||||
content += "<span style='color: red;'>✕</span>";
|
content += "<span style='color: red;'>✕</span>";
|
||||||
}
|
}
|
||||||
|
#endif //no PWM_CONTACTOR_CONTROL
|
||||||
content += "</h4>";
|
content += "</h4>";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -816,7 +825,7 @@ String processor(const String& var) {
|
||||||
content += "<h4 style='color: red;'>Power status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
content += "<h4 style='color: red;'>Power status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||||
|
|
||||||
#ifdef CONTACTOR_CONTROL
|
#ifdef CONTACTOR_CONTROL
|
||||||
content += "<h4>Contactors controlled by Battery-Emulator: ";
|
content += "<h4>Contactors controlled by emulator, state: ";
|
||||||
if (datalayer.system.status.contactors_battery2_engaged) {
|
if (datalayer.system.status.contactors_battery2_engaged) {
|
||||||
content += "<span style='color: green;'>ON</span>";
|
content += "<span style='color: green;'>ON</span>";
|
||||||
} else {
|
} else {
|
||||||
|
@ -824,13 +833,19 @@ String processor(const String& var) {
|
||||||
}
|
}
|
||||||
content += "</h4>";
|
content += "</h4>";
|
||||||
#ifdef CONTACTOR_CONTROL_DOUBLE_BATTERY
|
#ifdef CONTACTOR_CONTROL_DOUBLE_BATTERY
|
||||||
content += "<h4>Pre Charge: ";
|
content += "<h4>Cont. Neg.: ";
|
||||||
if (digitalRead(SECOND_PRECHARGE_PIN) == HIGH) {
|
#ifdef PWM_CONTACTOR_CONTROL
|
||||||
content += "<span style='color: green;'>✓</span>";
|
if (datalayer.system.status.contactors_battery2_engaged) {
|
||||||
|
content += "<span style='color: green;'>Economized</span>";
|
||||||
|
content += " Cont. Pos.: ";
|
||||||
|
content += "<span style='color: green;'>Economized</span>";
|
||||||
} else {
|
} else {
|
||||||
content += "<span style='color: red;'>✕</span>";
|
content += "<span style='color: red;'>✕</span>";
|
||||||
|
content += " Cont. Pos.: ";
|
||||||
|
content += "<span style='color: red;'>✕</span>";
|
||||||
}
|
}
|
||||||
content += " Cont. Neg.: ";
|
|
||||||
|
#else // No PWM_CONTACTOR_CONTROL , we can read the pin and see feedback. Helpful if channel overloaded
|
||||||
if (digitalRead(SECOND_NEGATIVE_CONTACTOR_PIN) == HIGH) {
|
if (digitalRead(SECOND_NEGATIVE_CONTACTOR_PIN) == HIGH) {
|
||||||
content += "<span style='color: green;'>✓</span>";
|
content += "<span style='color: green;'>✓</span>";
|
||||||
} else {
|
} else {
|
||||||
|
@ -843,6 +858,7 @@ String processor(const String& var) {
|
||||||
} else {
|
} else {
|
||||||
content += "<span style='color: red;'>✕</span>";
|
content += "<span style='color: red;'>✕</span>";
|
||||||
}
|
}
|
||||||
|
#endif //no PWM_CONTACTOR_CONTROL
|
||||||
content += "</h4>";
|
content += "</h4>";
|
||||||
#endif // CONTACTOR_CONTROL_DOUBLE_BATTERY
|
#endif // CONTACTOR_CONTROL_DOUBLE_BATTERY
|
||||||
#endif // CONTACTOR_CONTROL
|
#endif // CONTACTOR_CONTROL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue