|
@@ -94,8 +94,22 @@ void wifi_send_status_broadcast(void) {
|
94
|
94
|
|
95
|
95
|
ws += F("\"switches\": [ ");
|
96
|
96
|
for (int i = 0; i < SWITCH_COUNT; i++) {
|
|
97
|
+ bool v = get_plants()->getSwitches()->getPin(i);
|
|
98
|
+
|
|
99
|
+#ifdef INVERT_SENSOR_BOTTOM
|
|
100
|
+ if (i == 0) {
|
|
101
|
+ v = !v;
|
|
102
|
+ }
|
|
103
|
+#endif // INVERT_SENSOR_BOTTOM
|
|
104
|
+
|
|
105
|
+#ifdef INVERT_SENSOR_TOP
|
|
106
|
+ if (i == 1) {
|
|
107
|
+ v = !v;
|
|
108
|
+ }
|
|
109
|
+#endif // INVERT_SENSOR_TOP
|
|
110
|
+
|
97
|
111
|
ws += "\"";
|
98
|
|
- ws += get_plants()->getSwitches()->getPin(i) ? "1" : "0";
|
|
112
|
+ ws += v ? "1" : "0";
|
99
|
113
|
ws += "\"";
|
100
|
114
|
|
101
|
115
|
if (i < (SWITCH_COUNT - 1)) {
|
|
@@ -298,7 +312,21 @@ void handleRoot() {
|
298
|
312
|
message += F("<div class='container'>\n");
|
299
|
313
|
for (int i = 0; i < SWITCH_COUNT; i++) {
|
300
|
314
|
message += F("<div class='switch' style='background-color: ");
|
301
|
|
- if (get_plants()->getSwitches()->getPin(i)) {
|
|
315
|
+ bool v = get_plants()->getSwitches()->getPin(i);
|
|
316
|
+
|
|
317
|
+#ifdef INVERT_SENSOR_BOTTOM
|
|
318
|
+ if (i == 0) {
|
|
319
|
+ v = !v;
|
|
320
|
+ }
|
|
321
|
+#endif // INVERT_SENSOR_BOTTOM
|
|
322
|
+
|
|
323
|
+#ifdef INVERT_SENSOR_TOP
|
|
324
|
+ if (i == 1) {
|
|
325
|
+ v = !v;
|
|
326
|
+ }
|
|
327
|
+#endif // INVERT_SENSOR_TOP
|
|
328
|
+
|
|
329
|
+ if (v) {
|
302
|
330
|
message += F("red");
|
303
|
331
|
} else {
|
304
|
332
|
message += F("green");
|