-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwetroom.ino
764 lines (645 loc) · 16.7 KB
/
wetroom.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
/*
Mostly by Phil Davies
*/
#include <Arduino.h>
#include <avr/wdt.h>
#include "Adafruit_BMP085_U.h"
#include "Buffer.h"
#include "Message.h"
#include "pins.h"
#include "motors.h"
#include "timerUtil.h"
#include "Timer4.h"
#include "DHT22.h"
#include "SamplesBuffer.h"
#include "Pressure.h"
#include "sharedVars.h"
#include "FlowMeter.h"
#include "Constants.h"
#include "UI.h"
#include "EepromUtil.h"
#include "Diverter.h"
#include "Buttons.h"
#include "Extractor.h"
#include "Ticks.h"
#include "Lights.h"
#include "magnetometer.h"
#include "Interrupts.h"
#define WIRELESS 0
#if WIRELESS
#include "TX433.h"
#define LOG(s) {Serial.print(s);if (broadcast){tx433->print(s);tx433->send();}}
#else
#define LOG(s) {Serial.print(s);}
#endif
/*
* Assume hardware integrity and update software if there's a hardware failure!
*/
#define _USING_DHT
#define _TIMER4
int m1Lvl = 0;
Ticks ticks;
uint64_t lastTimeWaterDetected;
uint64_t timeLeveLastOk;
bool panicking;
bool dhtOk;
uint32_t eventsLogged;
uint32_t flowPulsesThisSecond;
bool floatA;
bool floatB;
bool panickingEnable;
int timeToPanic;
int timeSinceLastOk;
bool calibratedSinceLastPump;
byte lightBlinker;
bool startupCommplete;
bool dangerLevel;
int16_t maxDeltaFlowPulses;
uint64_t tMinLastActivity;
uint64_t tMinLastCalibration;
long int adjustedMagFld;
long int magfldLow = 0, magfldHigh = 0;
uint8_t led = 0;
String CMD_PUMP_KICK = "p - kick pumps into life";
String CMD_LEAK_RATE = "l - pump bucket leak rate";
String CMD_EXTRACTOR_KICK = "x - kick extractors into life";
String CMD_FAKE_PRESSURE = "fnnn - fake pressure dif reading to nnn";
String CMD_CYCLE_DISPLAYMODE = "d - cycle display mode";
String CMD_RESYNC = "s - sync pressure sensors";
String CMD_RESET = "r - reset some counters";
String CMD_DIVERT = "c - cycle diverter";
String CMD_SET_MAG_TRIP = "m - mag fld trip";
String CMD_VIEW_SETTINGS = "v - view settings";
String CMD_UPDATE_UPTION = "o - update option o v";
float meanPressureDifferential;
Interrupts interrupts;
Buttons buttons;
Diverter *diverter;
Lights lights = Lights();
#if USE_PRESSURE
Pressure pressure;
#endif
RTC_DS1307 *rtc;
FlowMeter *flowMeter;
UI *oled;
Extractor extractor;
Pump pump = Pump();
Motors motors = Motors();
ButtonLights buttonLights = ButtonLights();
Magnetometer *magnetometer;
#if WIRELESS
TX433 *tx433;
#endif
#define countdownTick(v) if (v > 0) v -= 1; if (v < 0) v = 0
void setup() {
Serial.begin(115200);
log("Hello");
eventsLogged = 0;
ticks = Ticks();
lastTimeWaterDetected = 0;
extractor = Extractor();
lightBlinker = 0;
maxDeltaFlowPulses = 0;
calibratedSinceLastPump = false;
startupCommplete = false;
dhtOk = false;
log("Load settings from Eeprom...");
loadFromEeprom();
log("...loaded, set outputs and pin modes");
Output(PIN_LED, ON);
Output(PIN_MOTOR1_PWM, OFF);
Output(PIN_MOTOR2_PWM, OFF);
Output(PIN_EXTRACTOR_FAN, OC_OFF);
Output(PIN_RL1, RL_OFF);
Output(PIN_RL2, RL_OFF);
Output(PIN_RL3, RL_OFF);
Output(PIN_RL4, RL_OFF);
Output(PIN_RL5, RL_OFF);
Output(PIN_RL6, RL_OFF);
Output(PIN_RL7, RL_OFF);
Output(PIN_RL8, RL_OFF);
Output(PIN_POWERSHOWER_PUMP_ENABLE, OC_OFF);
//initialising light
Output(PIN_SHOWERLIGHTS_PWM, OFF);
Output(PIN_BMP_XCLR_AIR, OFF);
Output(PIN_BMP_XCLR_WATER, OFF);
Output(PIN_OUTPUT_OVERHEAD_A, ON);
Output(PIN_OUTPUT_OVERHEAD_B, OFF);
Output(PIN_OUTPUT_WAND_A, OFF);
Output(PIN_OUTPUT_WAND_A, ON);
pinMode(PIN_WATER_LEVEL_A, INPUT_PULLUP);
pinMode(PIN_WATER_LEVEL_B, INPUT_PULLUP);
pinMode(PIN_BUTTON_LIGHTS, INPUT_PULLUP);
pinMode(PIN_BUTTON_EXTRACTOR, INPUT_PULLUP);
pinMode(PIN_BUTTON_PUMP, INPUT_PULLUP);
pinMode(PIN_SHOWER_FLOW_METER, INPUT_PULLUP);
pinMode(PIN_BTN_DIAL, INPUT_PULLUP);
pinMode(PIN_BUTTON_DIVERTER, INPUT_PULLUP);
pinMode(PIN_ANA_HUMIDITY1, INPUT_PULLUP);
pinMode(PIN_ANA_HUMIDITY2, INPUT_PULLUP);
pinMode(PIN_DIAL_A, INPUT_PULLUP);
pinMode(PIN_DIAL_B, INPUT_PULLUP);
log("...done, set pwm freqs");
setPwmFrequency(PIN_MOTOR1_PWM, 1);
setPwmFrequency(PIN_MOTOR2_PWM, 1);
log("...done, set motor speed");
#if WIRELESS
tx433 = new TX433(3000, PIN_UNUSED, PIN_433_TXDATA, PIN_433_TXENABLE, 0);
#endif
motors.setSpeed(0);
timeLeveLastOk = ticks.getSecond();
panicking = false;
log("...done, init I2C");
Wire.begin();
#if MAGNETOMETER
log("...done, Calib magnet");
magnetometer = new Magnetometer(12345);
log("...done, show details");
/* Display some basic information on this sensor */
magnetometer->displaySensorDetails();
#endif
log("...done, init RTC");
rtc = new RTC_DS1307();
rtc->begin();
log("...done, init flow meter");
flowMeter = new FlowMeter();
#if USE_PRESSURE
pressure = Pressure();
pressure.init();
#endif
log("Oled init...");
const char *date = __DATE__;
const char *time = __TIME__;
const char *rev = "$Rev: 726 $";
char header[32];
memset(header, ' ', 32);
char *bufP = header;
strncpy(bufP, date, 7);
bufP += 7;
strncpy(bufP, time, 5);
bufP += 6;
strncpy(bufP, rev + 1, 9);
bufP += 9;
*bufP = '\0';
oled = new UI(header);
log("Oled inited");
/* Initialise the sensor */
if (getOptionValue(OPT_DST_WRONG)) {
// rtc->adjust(DateTime(__DATE__, __TIME__));
DateTime now = rtc->now();
rtc->adjust(DateTime(now.year(), now.month(), now.day(), now.hour() - 1, now.minute(), now.second()));
setAndSaveOptionValue(OPT_DST_WRONG, false);
}
diverter = new Diverter();
interrupts = Interrupts();
buttonLights.startCycling();
wdt_enable(WDTO_8S);
log("Initialized");
}
void loop() {
led = 1 - led;
digitalWrite(PIN_LED, led);
handleEvents();
handleCommand();
ticks.update();
if (ticks.isNextTick())
doPerTickActions();
if (ticks.isNextTenth()) {
doPerSecondActions(ticks.thisTenth % 10);
doPerTenthSecondActions();
}
}
void log(const char msg[]) {
Serial.println(msg);
delay(100);
}
void doPerTenthSecondActions() {
/*
* Set pump and its light
*/
motors.setSpeed(pump.getEffectiveMotorSpeed());
buttonLights.buttonLight(BL_PUMP, pump.requested());
if (ticks.getTenth() % 7 == 0)
lightBlinker = ++lightBlinker % 5;
extractor.actionExtractorFan();
}
void doPerTickActions() {
buttons.check();
interrupts.tick();
}
void doPerSecondActions(int tenthsDigit) {
lights.tick();
switch (tenthsDigit) {
case 0:
dangerLevel = false;
wdt_reset();
break;
case 1:
/*
* Things that happen every second
*/
checkCalendar();
break;
case 2:
checkStartHumidityMeasurement();
break;
case 3:
magnetometerActions();
break;
case 4:
checkStartupComplete();
extractor.tick();
break;
case 5:
checkPressureSensor();
break;
case 6:
checkFlowSensor();
break;
case 7:
break;
case 8:
checkPanic();
diverter->tick();
pump.tick();
break;
case 9:
extractor.tick();
checkResyncSensorsOnIdle();
detailedLogging();
oled->update();
oled->showInstantaneousLevel();
if (!dangerLevel) {
timeLeveLastOk = ticks.getSecond();
}
//every hour
if (ticks.getSecond() % 3600 == 0) {
//check to see if we need to put the clock back or forward
rtc->checkDst();
}
break;
default:
break;
}
}
void checkStartupComplete() {
//Check if startup period is up
if (!startupCommplete && ticks.uptime() >= getOptionValue(OPT_STARTUP_VISUAL)) {
startupCommplete = true;
buttonLights.stopCycling();
//make sure button lights are displaying what they should be now.
buttonLights.buttonLight(BL_RESET, OC_ON);
diverter->restoreFromEeprom();
}
//if the pump's been off for N seconds, recalibrate
// if (pump.doOffActions(300)) {
// magnetometer->calibrate();
// }
}
void checkPressureSensor() {
#if USE_PRESSURE
meanPressureDifferential = pressure.measurePressureDifferential();
if (meanPressureDifferential > getOptionValue(OPT_SWITCHON_PRESSURE)) {
uint32_t excessPressure = (uint16_t) meanPressureDifferential - getOptionValue(OPT_SWITCHON_PRESSURE);
Serial.print("pDif sw");
// pump.requestMinSpeed(excessPressure * getOptionValue(OPT_PRESSURE_GAIN) / 100);
// if (meanPressureDifferential > getOptionValue(OPT_DANGER_PRESSURE_DIF)) {
// dangerLevel = true;
// }
}
#endif
}
void checkFlowSensor() {
#if FLOW_SENSOR
flowPulsesThisSecond = flowMeter->deltaTicks();
//full speed is ~533 ml/sec or ~239 pulses, ~20 pulses per sec
// millilitresPerSecond = pulses * 1000 / PULSES_PER_LITRE;
maxDeltaFlowPulses = max(maxDeltaFlowPulses, flowPulsesThisSecond);
if (flowPulsesThisSecond > getOptionValue(OPT_FLOW_TRIP)) {
Serial.print("flw sw");
if (flowPulsesThisSecond > getOptionValue(OPT_FLOW_POWERPUMP_TRIP) && getOptionValue(OPT_POWER_ENABLE)) {
digitalWrite(PIN_POWERSHOWER_PUMP_ENABLE, OC_ON);
} else {
digitalWrite(PIN_POWERSHOWER_PUMP_ENABLE, OC_OFF);
}
uint16_t minPumpSpeedRequestedByFlow = flowPulsesThisSecond * getOptionValue(OPT_FLOW_GAIN);
diverter->primeForPurge();
if (minPumpSpeedRequestedByFlow > 0) {
#if PUMP_ON_FLOW
pump.requestMinSpeed(minPumpSpeedRequestedByFlow);
#endif
lights.switchAllOn();
if (dhtGetTemp10() > getOptionValue(OPT_COLD_TEMP)) {
extractor.start(3);
}
}
}
#endif
}
void checkStartHumidityMeasurement() {
/*
* Other stuff
*/
if (ticks.getSecond() % 8 == 0) {
// every few seconds initiate a humidity measurement, but not if the shower's running and it's cold :)
bool warm = dhtGetTemp10() >= getOptionValue(OPT_COLD_TEMP);
bool showerStopped = flowPulsesThisSecond == 0;
if (warm || showerStopped) {
extractor.checkExtractor();
}
#ifdef _USING_DHT
startDHT();
#endif
}
}
void checkResyncSensorsOnIdle() {
/*
* 10 minutes after all activity ceased, re-sync pressure sensors
*/
if (!pump.requested() && flowPulsesThisSecond == 0) {
if (pump.beenOffForSeconds() >= 600 && !calibratedSinceLastPump) {
#if USE_PRESSURE
pressure.calibratePressureSensors();
#endif
// magnetometer->calibrate(); // not sure this is really worth it
calibratedSinceLastPump = true;
}
}
}
void magnetometerActions() {
#if MAGNETOMETER
if (magnetometer->isPresent()) {
bool ok = magnetometer->read();
if (!ok) {
Serial.println("Mag read FAIL");
} else {
adjustedMagFld = magnetometer->getX() - magnetometer->getY() - (int16_t) getOptionValue(OPT_MAG_CAL_OFS);
if (pump.doOffActions(30)) {
Serial.print("Pump off, magfld low ");
Serial.print(magfldLow);
Serial.print(", high ");
Serial.print(magfldHigh);
Serial.print(", swing ");
Serial.println(magfldHigh - magfldLow);
magfldLow = magfldHigh = adjustedMagFld;
}
magfldLow = min (magfldLow, adjustedMagFld);
magfldHigh = max (magfldHigh, adjustedMagFld);
if (adjustedMagFld > getOptionValue(OPT_MAGFIELD_TRIP)) {
uint16_t effectiveMagFld = adjustedMagFld - getOptionValue(OPT_MAGFIELD_TRIP);
if (effectiveMagFld > MAX_FIELD_SWING) {
Serial.println("Ignoring spurious mag fld reading");
} else {
Serial.print("mag sw, spd req: ");
//say 0-240 -> 0-480 fair enough
uint16_t spdReq = effectiveMagFld * getOptionValue(OPT_MAGFIELD_GAIN) / 10;
pump.requestMinSpeed(spdReq);
Serial.print("rq spd: ");
Serial.print(spdReq);
Serial.println();
if (adjustedMagFld > getOptionValue(OPT_MAGFIELD_DANGER)) {
Serial.print("Danger magfield! ");
Serial.println(adjustedMagFld);
dangerLevel = true;
}
}
}
}
}
#endif
}
void checkPanic() {
/*
* Panic control - check if the level has been danger for > 10s, if so switch the shower pump off
*/
timeSinceLastOk = ticks.getSecond() - timeLeveLastOk;
//panic if time since last ok > OPT_MAXTIME_FULL_DRAIN
timeToPanic = ((int) getOptionValue(OPT_MAXTIME_FULL_DRAIN)) - timeSinceLastOk;
panicking = (timeToPanic <= 0);
if (panicking) {
Serial.print("Panicking! ");
Serial.print((uint32_t) timeLeveLastOk);
Serial.print(" lastOK, time ");
Serial.print((uint32_t) ticks.getSecond());
Serial.print("Max: ");
Serial.print(((int) getOptionValue(OPT_MAXTIME_FULL_DRAIN)));
Serial.println();
digitalWrite(PIN_POWERSHOWER_PUMP_ENABLE, OC_OFF);
}
}
void checkCalendar() {
//Calendar things
//daily calibration?
DateTime now = rtc->now();
int hour = now.hour();
int minute = now.minute();
int doW = now.dayOfWk();
#if USE_PRESSURE
if (tMinLastCalibration > 60 * 24 && tMinLastActivity > 20) {
if (hour > 3 && hour < 5) {
oled->showCalibMsg();
pressure.calibratePressureSensors();
oled->showStatus();
}
}
#endif
#if ELSA_ALARM
//Elsa alarm
//we want the following to only work on weekdays, so DoW == 1-5 not 0 or 7. doW % 7 is 0 for Sunday and 6 for Saturday..
if (hour == 14 && minute == 45 && doW != 0 && doW != 6 && !lights.getAlarm()) {
lights.setAlarm(true);
} else if (hour == 15 && minute == 30 && doW != 0 && doW != 6 && lights.getAlarm()) {
lights.setAlarm(false);
}
#endif
}
void detailedLogging() {
bool broadcast = ticks.thisSecond % 5 == 0;
LOG(" mg:");
LOG(adjustedMagFld);
LOG('/');
LOG(getOptionValue(OPT_MAGFIELD_TRIP));
#if USE_PRESSURE
LOG(" pD:");
LOG(pressure.getMeanPressureDifferential());
#endif
/*
LOG(" dT: ")
LOG(dhtGetTemp());
LOG(" wT:");
LOG(pressure.getDrainTemp());
LOG(" aT:");
LOG(pressure.getAirTemp());
*/
LOG(" Fl:");
LOG(flowPulsesThisSecond);
LOG(" Gp:");
LOG(pump.leakyBucket);
LOG(" Hu:");
LOG(extractor.humidity);
LOG('/');
LOG(getOptionValue(OPT_HUMIDITY_THRESHOLD));
/*
LOG(" Hu1:");
LOG(analogRead(PIN_ANA_HUMIDITY1));
LOG(" Hu2:");
LOG(analogRead(PIN_ANA_HUMIDITY2));
LOG(" aP:");
LOG(pressure.getAirPressure());
LOG(" wP:");
LOG(pressure.getDrainPressure());
*/
/* Display the results (magnetic vector values are in micro-Tesla (uT)) */
/*
LOG(" X:");
LOG(magnetometer->getX());
LOG(" Y:");
LOG(magnetometer->getY());
LOG(" Z:");
LOG(magnetometer->getZ());
*/
LOG("$");
Serial.println();
}
void handleEvents() {
Message *msg = messageQueue.getNextMessage();
if (msg) {
switch (msg->event) {
case Event::DHT_TIMEOUT_LOW:
Serial.println("DHT TIMEOUT - is it even connected?");
// showDhtState(); // addSample(pDiff);
if (dhtOk) {
buttonLights.errorCode(ERROR_DHT_TIMEOUT_LOW);
dhtOk = false;
}
break;
case Event::DHT_TIMEOUT_HIGH:
Serial.println("DHT TIMEOUT - is it even connected?");
// showDhtState(); // addSample(pDiff);
if (dhtOk) {
buttonLights.errorCode(ERROR_DHT_TIMEOUT_HIGH);
dhtOk = false;
}
break;
case Event::TIMER4:
if (dhtOk) {
buttonLights.errorCode(ERROR_TIMER4);
dhtOk = false;
}
Serial.println("Timer4 TIMEOUT");
break;
case Event::DHT_CONVERSION:
// Serial.println("DHT conversion");
if (!dhtOk) {
buttonLights.clearError();
dhtOk = true;
}
extractor.recordHumidity();
break;
case Event::DHT_CHECKSUM:
Serial.println("DHT Checksum error");
// showDhtState();
if (dhtOk) {
buttonLights.errorCode(ERROR_DHT_CHECKSUM);
dhtOk = false;
}
break;
case Event::KEYPRESS_SHORT:
Serial.println("Short keypress");
oled->shortPress();
break;
default:
Serial.print("Unknown msg:");
Serial.println(msg->event);
break;
}
}
}
void handleCommand() {
if (Serial.available()) {
int option;
uint16_t value;
uint16_t command = Serial.read();
switch (command) {
case '?':
showCommands();
break;
case 'p':
Serial.println(CMD_PUMP_KICK);
Serial.print("kick sw");
pump.requestMinSpeed(300);
break;
case 'l':
Serial.println(CMD_LEAK_RATE);
alterValue(OPT_PUMP_LEAKY_BUCKET_LEAK_RATE);
break;
case 'm':
Serial.println(CMD_SET_MAG_TRIP);
alterValue(OPT_MAGFIELD_TRIP);
break;
case 'o':
Serial.println(CMD_UPDATE_UPTION);
option = Serial.parseInt();
alterValue(option);
break;
case 'x':
Serial.println(CMD_EXTRACTOR_KICK);
extractor.recalibrateToChangeState();
break;
case 'f':
Serial.println(CMD_FAKE_PRESSURE);
#if PRESSURE_SENSOR
pressure.setFakeDifferential(Serial.parseInt());
#endif
break;
case 'd':
Serial.println("Diverter");
diverter->cycle();
break;
case 's':
Serial.println(CMD_RESYNC);
oled->showCalibMsg();
#if PRESSURE_SENSOR
pressure.calibratePressureSensors();
#endif
oled->showStatus();
break;
case 'c':
Serial.println(CMD_DIVERT);
diverter->cycle();
break;
case 'r':
Serial.println(CMD_RESET);
interrupts.resetInterruptCounts();
resetEepromToDefaults();
break;
case 'v':
Serial.println(CMD_VIEW_SETTINGS);
listCurrentValues();
break;
default:
Serial.print("Unknown command ");
Serial.println((char) command);
showCommands();
break;
}
}
}
void alterValue(int option) {
uint16_t value = getOptionValue(option);
Serial.print(getOptionName(option));
Serial.print(": ");
Serial.print(value);
value = Serial.parseInt();
setAndSaveOptionValue(option, value);
Serial.print(" -> ");
Serial.println(value);
}
void showCommands() {
Serial.println("Commands:");
Serial.println(CMD_PUMP_KICK);
Serial.println(CMD_LEAK_RATE);
Serial.println(CMD_EXTRACTOR_KICK);
Serial.println(CMD_FAKE_PRESSURE);
Serial.println(CMD_RESYNC);
}