forked from brewtrollergit/brewtroller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UI.pde
2808 lines (2535 loc) · 96.2 KB
/
UI.pde
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
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright (C) 2009, 2010 Matt Reba, Jeremiah Dillingham
This file is part of BrewTroller.
BrewTroller is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BrewTroller is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with BrewTroller. If not, see <http://www.gnu.org/licenses/>.
BrewTroller - Open Source Brewing Computer
Software Lead: Matt Reba (matt_AT_brewtroller_DOT_com)
Hardware Lead: Jeremiah Dillingham (jeremiah_AT_brewtroller_DOT_com)
Documentation, Forums and more information available at http://www.brewtroller.com
*/
#ifndef NOUI
//*****************************************************************************************************************************
// Begin UI Code
//*****************************************************************************************************************************
//**********************************************************************************
// UI Definitions
//**********************************************************************************
#define SCREEN_HOME 0
#define SCREEN_FILL 1
#define SCREEN_MASH 2
#define SCREEN_SPARGE 3
#define SCREEN_BOIL 4
#define SCREEN_CHILL 5
#define SCREEN_AUX 6
//**********************************************************************************
// UI Strings
//**********************************************************************************
const char OK[] PROGMEM = "Ok";
const char CANCEL[] PROGMEM = "Cancel";
const char EXIT[] PROGMEM = "Exit";
const char ABORT[] PROGMEM = "Abort";
const char MENU[] PROGMEM = "Menu";
const char SPACE[] PROGMEM = " ";
const char INIT_EEPROM[] PROGMEM = "Initialize EEPROM";
const char CONTINUE[] PROGMEM = "Continue";
prog_char FILLHLT[] PROGMEM = "Fill HLT";
prog_char FILLMASH[] PROGMEM = "Fill Mash";
prog_char ADDGRAIN[] PROGMEM = "Add Grain";
prog_char MASHHEAT[] PROGMEM = "Mash Heat";
prog_char MASHIDLE[] PROGMEM = "Mash Idle";
prog_char SPARGEIN[] PROGMEM = "Sparge In";
prog_char SPARGEOUT[] PROGMEM = "Sparge Out";
prog_char BOILADDS[] PROGMEM = "Boil Additions";
prog_char KETTLELID[] PROGMEM = "Kettle Lid";
prog_char CHILLH2O[] PROGMEM = "Chill H2O";
prog_char CHILLBEER[] PROGMEM = "Chill Beer";
prog_char BOILRECIRC[] PROGMEM = "Boil Recirc";
prog_char DRAIN[] PROGMEM = "Drain";
prog_char HLTHEAT[] PROGMEM = "HLT Heat";
prog_char HLTIDLE[] PROGMEM = "HLT Idle";
prog_char KETTLEHEAT[] PROGMEM = "Kettle Heat";
prog_char KETTLEIDLE[] PROGMEM = "Kettle Idle";
prog_char USER1[] PROGMEM = "User Valve 1";
prog_char USER2[] PROGMEM = "User Valve 2";
prog_char USER3[] PROGMEM = "User Valve 3";
prog_char DOUGHIN[] PROGMEM = "Dough In:";
prog_char ACID[] PROGMEM = "Acid Rest:";
prog_char PROTEIN[] PROGMEM = "Protein Rest:";
prog_char SACCH[] PROGMEM = "Sacch Rest:";
prog_char SACCH2[] PROGMEM = "Sacch2 Rest:";
prog_char MASHOUT[] PROGMEM = "Mash Out:";
PROGMEM const char *TITLE_MASHSTEP[] = {
DOUGHIN,
ACID,
PROTEIN,
SACCH,
SACCH2,
MASHOUT
};
PROGMEM const char *TITLE_VLV[] = {
FILLHLT,
FILLMASH,
ADDGRAIN,
MASHHEAT,
MASHIDLE,
SPARGEIN,
SPARGEOUT,
BOILADDS,
KETTLELID,
CHILLH2O,
CHILLBEER,
BOILRECIRC,
DRAIN,
HLTHEAT,
HLTIDLE,
KETTLEHEAT,
KETTLEIDLE,
USER1,
USER2,
USER3
};
const char ALLOFF[] PROGMEM = "All Off";
const char FILLBOTH[] PROGMEM = "Fill Both";
const char FLYSPARGE[] PROGMEM = "Fly Sparge";
const char CHILLNORM[] PROGMEM = "Chill Both";
#ifndef UI_NO_SETUP
prog_char TITLE_VS_HLT[] PROGMEM = "HLT";
prog_char TITLE_VS_MASH[] PROGMEM = "Mash";
prog_char TITLE_VS_KETTLE[] PROGMEM = "Kettle";
#ifdef PID_FLOW_CONTROL
prog_char TITLE_VS_PUMP[] PROGMEM = "Pump";
#elif defined USESTEAM
prog_char TITLE_VS_STEAM[] PROGMEM = "Steam";
#endif
PROGMEM const char *TITLE_VS[] = {
TITLE_VS_HLT,
TITLE_VS_MASH,
TITLE_VS_KETTLE
#ifdef PID_FLOW_CONTROL
, TITLE_VS_PUMP
#elif defined USESTEAM
, TITLE_VS_STEAM
#endif
};
const char PIDCYCLE[] PROGMEM = " PID Cycle";
const char PIDGAIN[] PROGMEM = " PID Gain";
const char HYSTERESIS[] PROGMEM = " Hysteresis";
#ifdef PID_FLOW_CONTROL
const char PUMPFLOW[] PROGMEM = "Pump Flow Rate";
#elif defined USESTEAM
const char STEAMPRESS[] PROGMEM = "Steam Target";
const char STEAMSENSOR[] PROGMEM = "Steam Sensor Sens";
const char STEAMZERO[] PROGMEM = "Steam Zero Calib";
#endif
const char CAPACITY[] PROGMEM = " Capacity";
const char DEADSPACE[] PROGMEM = " Dead Space";
const char CALIBRATION[] PROGMEM = " Calibration";
#endif
const char HLTDESC[] PROGMEM = "Hot Liquor Tank";
const char MASHDESC[] PROGMEM = "Mash Tun";
const char SEC[] PROGMEM = "s";
#ifdef USEMETRIC
const char VOLUNIT[] PROGMEM = "l";
const char WTUNIT[] PROGMEM = "kg";
const char TUNIT[] PROGMEM = "C";
#ifdef PID_FLOW_CONTROL
const char PUNIT[] PROGMEM = "0.1*l/m";
#else
const char PUNIT[] PROGMEM = "kPa";
#endif
#else
const char VOLUNIT[] PROGMEM = "gal";
const char WTUNIT[] PROGMEM = "lb";
const char TUNIT[] PROGMEM = "F";
#ifdef PID_FLOW_CONTROL
const char PUNIT[] PROGMEM = "0.1*q/m";
#else
const char PUNIT[] PROGMEM = "psi";
#endif
#endif
//**********************************************************************************
// UI Custom LCD Chars
//**********************************************************************************
const byte CHARFIELD[] PROGMEM = {B11111, B00000, B00000, B00000, B00000, B00000, B00000, B00000};
const byte CHARCURSOR[] PROGMEM = {B11111, B11111, B00000, B00000, B00000, B00000, B00000, B00000};
const byte CHARSEL[] PROGMEM = {B10001, B11111, B00000, B00000, B00000, B00000, B00000, B00000};
#ifdef LOGO_TROLL
const byte BMP0[] PROGMEM = {B00000, B00000, B00000, B00000, B00011, B01111, B11111, B11111};
const byte BMP1[] PROGMEM = {B00000, B00000, B00000, B00000, B11100, B11110, B11111, B11111};
const byte BMP2[] PROGMEM = {B00001, B00011, B00111, B01111, B00001, B00011, B01111, B11111};
const byte BMP3[] PROGMEM = {B11111, B11111, B10001, B00011, B01111, B11111, B11111, B11111};
const byte BMP4[] PROGMEM = {B01111, B01110, B01100, B00001, B01111, B00111, B00011, B11101};
const byte BMP5[] PROGMEM = {B11111, B00111, B00111, B11111, B11111, B11111, B11110, B11001};
const byte BMP6[] PROGMEM = {B11111, B11111, B11110, B11101, B11011, B00111, B11111, B11111};
#endif
#ifdef LOGO_BREWTROLLER
const byte BMP0[] PROGMEM = {B00000, B00000, B00000, B11111, B10001, B10001, B11111, B00001};
const byte BMP1[] PROGMEM = {B00000, B00000, B00000, B00000, B00000, B00011, B01100, B01111};
const byte BMP2[] PROGMEM = {B00000, B00000, B00000, B00000, B00000, B11100, B00011, B11111};
const byte BMP3[] PROGMEM = {B00100, B01100, B01111, B00111, B00100, B01100, B01111, B00111};
const byte BMP4[] PROGMEM = {B00010, B00011, B11111, B11110, B00010, B00011, B11111, B11110};
#endif
const byte UNLOCK_ICON[] PROGMEM = {B00110, B01001, B01001, B01000, B01111, B01111, B01111, B00000};
const byte PROG_ICON[] PROGMEM = {B00001, B11101, B10101, B11101, B10001, B10001, B00001, B11111};
const byte BELL[] PROGMEM = {B00100, B01110, B01110, B01110, B11111, B00000, B00100, B00000};
//**********************************************************************************
// UI Globals
//**********************************************************************************
byte activeScreen;
boolean screenLock;
unsigned long timerLastPrint;
boolean doInit = 1;
//**********************************************************************************
// uiInit: One time intialization of all UI logic
//**********************************************************************************
void uiInit() {
LCD.init();
#ifndef ENCODER_I2C
#ifndef ENCODER_OLD_CONSTRUCTOR
Encoder.begin(ENCODER_TYPE, ENTER_PIN, ENCA_PIN, ENCB_PIN);
#else
Encoder.begin(ENCODER_TYPE, ENTER_PIN, ENCA_PIN, ENCB_PIN, ENTER_INT, ENCA_INT);
#endif
#ifdef ENCODER_ACTIVELOW
Encoder.setActiveLow(1);
#endif
#else
Encoder.begin(ENCODER_I2CADDR);
#endif
//Check to see if EEPROM Initialization is needed
if (checkConfig()) {
LCD.clear();
LCD.print_P(0, 0, PSTR("Missing Config"));
if (confirmChoice(INIT_EEPROM, 3)) UIinitEEPROM();
LCD.clear();
}
setActive(SCREEN_HOME);
unlockUI();
}
void UIinitEEPROM() {
LCD.clear();
LCD.print_P(1, 0, INIT_EEPROM);
LCD.print_P(2, 3, PSTR("Please Wait..."));
LCD.update();
initEEPROM();
//Apply any EEPROM updates
checkConfig();
}
void uiEvent(byte eventID, byte eventParam) {
if (eventID == EVENT_STEPINIT) {
if (eventParam == STEP_FILL
|| eventParam == STEP_REFILL
) setActive(SCREEN_FILL);
else if (eventParam == STEP_DELAY
|| eventParam == STEP_PREHEAT
|| eventParam == STEP_DOUGHIN
|| eventParam == STEP_ACID
|| eventParam == STEP_PROTEIN
|| eventParam == STEP_SACCH
|| eventParam == STEP_SACCH2
|| eventParam == STEP_MASHOUT
|| eventParam == STEP_MASHHOLD
) setActive(SCREEN_MASH);
else if (eventParam == STEP_ADDGRAIN
|| eventParam == STEP_SPARGE
) setActive(SCREEN_SPARGE);
else if (eventParam == STEP_BOIL) setActive(SCREEN_BOIL);
else if (eventParam == STEP_CHILL) setActive(SCREEN_CHILL);
}
else if (eventID == EVENT_STEPEXIT) doInit = 1;
}
//**********************************************************************************
// unlockUI: Unlock active screen to select another
//**********************************************************************************
void unlockUI() {
Encoder.setMin(SCREEN_HOME);
Encoder.setMax(SCREEN_AUX);
Encoder.setCount(activeScreen);
screenLock = 0;
//Reinit screen to show unlock icon hide parts not visible while locked
doInit = 1;
}
void lockUI() {
screenLock = 1;
//Recall screenInit to setup encoder and other functions available only when locked
doInit = 1;
}
//**********************************************************************************
// screenCore: Called in main loop to handle all UI functions
//**********************************************************************************
void uiCore() {
if (estop) uiEstop();
if (!screenLock) {
int encValue = Encoder.change();
if (encValue >= 0) {
setActive(encValue);
}
}
if (doInit) {
screenInit();
doInit = 0;
}
screenEnter();
screenRefresh();
}
void setActive(byte screen) {
activeScreen = screen;
doInit = 1;
}
//**********************************************************************************
// screenInit: Initialize active screen
//**********************************************************************************
void screenInit() {
LCD.clear();
LCD.setCustChar_P(7, UNLOCK_ICON);
//Print Program Active Char (Overwritten if no program active)
if (activeScreen != SCREEN_HOME) {
LCD.setCustChar_P(6, PROG_ICON);
LCD.writeCustChar(0, 0, 6);
LCD.setCustChar_P(5, BELL);
}
if (activeScreen == SCREEN_HOME) {
//Screen Init: Home
#ifdef LOGO_TROLL
LCD.setCustChar_P(0, BMP0);
LCD.setCustChar_P(1, BMP1);
LCD.setCustChar_P(2, BMP2);
LCD.setCustChar_P(3, BMP3);
LCD.setCustChar_P(4, BMP4);
LCD.setCustChar_P(5, BMP5);
LCD.setCustChar_P(6, BMP6);
LCD.writeCustChar(0, 1, 0);
LCD.writeCustChar(0, 2, 1);
LCD.writeCustChar(1, 0, 2);
LCD.writeCustChar(1, 1, 3);
LCD.writeCustChar(1, 2, 255);
LCD.writeCustChar(2, 0, 4);
LCD.writeCustChar(2, 1, 5);
LCD.writeCustChar(2, 2, 6);
LCD.print_P(3, 0, BT);
LCD.print_P(3, 12, BTVER);
LCD.lPad(3, 16, itoa(BUILD, buf, 10), 4, '0');
#endif
#ifdef LOGO_BREWTROLLER
LCD.setCustChar_P(0, BMP0);
LCD.setCustChar_P(1, BMP1);
LCD.setCustChar_P(2, BMP2);
LCD.setCustChar_P(3, BMP3);
LCD.setCustChar_P(4, BMP4);
LCD.writeCustChar(0, 0, 0);
LCD.writeCustChar(0, 1, 1);
LCD.writeCustChar(0, 2, 2);
LCD.writeCustChar(1, 1, 3);
LCD.writeCustChar(1, 2, 4);
LCD.print_P(1, 4, BT);
LCD.print_P(1, 16, BTVER);
LCD.print_P(2, 4, PSTR("Build"));
LCD.lPad(2, 10, itoa(BUILD, buf, 10), 4, '0');
LCD.print_P(3, 0, PSTR("www.brewtroller.com"));
#endif
} else if (activeScreen == SCREEN_FILL) {
//Screen Init: Fill/Refill
if (stepIsActive(STEP_FILL)) LCD.print_P(0, 1, PSTR("Fill"));
else if (stepIsActive(STEP_REFILL)) LCD.print_P(0, 1, PSTR("Refill"));
else LCD.print_P(0, 0, PSTR("Fill"));
LCD.print_P(0, 11, PSTR("HLT"));
LCD.print_P(0, 16, PSTR("Mash"));
LCD.print_P(1, 1, PSTR("Target"));
LCD.print_P(2, 1, PSTR("Actual"));
vftoa(tgtVol[VS_HLT], buf, 1000, 1);
truncFloat(buf, 5);
LCD.lPad(1, 9, buf, 5, ' ');
vftoa(tgtVol[VS_MASH], buf, 1000, 1);
truncFloat(buf, 5);
LCD.lPad(1, 15, buf, 5, ' ');
if (screenLock) {
LCD.print_P(3, 0, PSTR(">"));
LCD.print_P(3, 10, PSTR("<"));
LCD.print_P(3, 1, CONTINUE);
Encoder.setMin(0);
Encoder.setMax(5);
Encoder.setCount(0);
}
} else if (activeScreen == SCREEN_MASH) {
//Screen Init: Preheat/Mash
//Delay Start Indication
timerLastPrint = 0;
if (stepIsActive(STEP_DELAY)) LCD.print_P(0, 1, PSTR("Delay"));
else if (stepIsActive(STEP_PREHEAT)) LCD.print_P(0, 1, PSTR("Preheat"));
else if (stepIsActive(STEP_DOUGHIN)) LCD.print_P(0, 1, PSTR("Dough In"));
else if (stepIsActive(STEP_ACID)) LCD.print_P(0, 1, PSTR("Acid"));
else if (stepIsActive(STEP_PROTEIN)) LCD.print_P(0, 1, PSTR("Protein"));
else if (stepIsActive(STEP_SACCH)) LCD.print_P(0, 1, PSTR("Sacch"));
else if (stepIsActive(STEP_SACCH2)) LCD.print_P(0, 1, PSTR("Sacch2"));
else if (stepIsActive(STEP_MASHOUT)) LCD.print_P(0, 1, PSTR("Mash Out"));
else if (stepIsActive(STEP_MASHHOLD)) LCD.print_P(0, 1, PSTR("End Mash"));
else LCD.print_P(0, 0, PSTR("Mash"));
// For DIRECT_FIRED_RIMS (and possibly just RIMS), we need a different layout here.
#ifdef DIRECT_FIRED_RIMS
// This is the RIMS screen
LCD.print_P(0, 9, PSTR("At"));
LCD.print_P(0, 15, PSTR("Set"));
LCD.print_P(1, 1, PSTR("HLT"));
LCD.print_P(2, 1, PSTR("Mash"));
LCD.print_P(3, 1, PSTR("RIMS"));
LCD.print_P(1, 13, TUNIT);
LCD.print_P(1, 19, TUNIT);
LCD.print_P(2, 13, TUNIT);
LCD.print_P(2, 19, TUNIT);
LCD.print_P(3, 13, TUNIT);
LCD.print_P(3, 19, TUNIT);
#else
// This is the standard screen
LCD.print_P(0, 11, PSTR("HLT"));
LCD.print_P(0, 16, PSTR("Mash"));
LCD.print_P(1, 1, PSTR("Target"));
LCD.print_P(2, 1, PSTR("Actual"));
LCD.print_P(1, 13, TUNIT);
LCD.print_P(1, 19, TUNIT);
LCD.print_P(2, 13, TUNIT);
LCD.print_P(2, 19, TUNIT);
#endif
} else if (activeScreen == SCREEN_SPARGE) {
//Screen Init: Sparge
if (stepIsActive(STEP_SPARGE)) LCD.print_P(0, 1, PSTR("Sparge"));
else if (stepIsActive(STEP_ADDGRAIN)) LCD.print_P(0, 1, PSTR("Grain In"));
else LCD.print_P(0, 0, PSTR("Sparge"));
LCD.print_P(1, 1, PSTR("HLT"));
LCD.print_P(2, 1, PSTR("Mash"));
LCD.print_P(3, 1, PSTR("Kettle"));
LCD.print_P(1, 8, PSTR("---"));
LCD.print_P(2, 8, PSTR("---"));
LCD.print_P(3, 8, PSTR("---"));
LCD.print_P(1, 14, PSTR("--.---"));
LCD.print_P(2, 14, PSTR("--.---"));
LCD.print_P(3, 14, PSTR("--.---"));
LCD.print_P(1, 12, TUNIT);
LCD.print_P(2, 12, TUNIT);
LCD.print_P(3, 12, TUNIT);
if (screenLock) {
LCD.print_P(0, 8, PSTR(">"));
LCD.print_P(0, 19, PSTR("<"));
LCD.print_P(0, 10, CONTINUE);
Encoder.setMin(0);
Encoder.setMax(7);
Encoder.setCount(0);
}
} else if (activeScreen == SCREEN_BOIL) {
//Screen Init: Boil
timerLastPrint = 0;
if (stepIsActive(STEP_BOIL)) LCD.print_P(0, 1, PSTR("Boil"));
else LCD.print_P(0,0,PSTR("Boil"));
LCD.print_P(1, 19, TUNIT);
if (screenLock) {
Encoder.setMin(0);
Encoder.setMax(PIDLIMIT_KETTLE);
Encoder.setCount(PIDOutput[VS_KETTLE]/PIDCycle[VS_KETTLE]);
//If Kettle is off keep it off until unlocked
if (!setpoint[VS_KETTLE]) boilControlState = CONTROLSTATE_OFF;
}
} else if (activeScreen == SCREEN_CHILL) {
//Screen Init: Chill
if (stepIsActive(STEP_CHILL)) LCD.print_P(0, 1, PSTR("Chill"));
else LCD.print_P(0, 0, PSTR("Chill"));
LCD.print_P(0, 11, PSTR("Beer"));
LCD.print_P(0, 17, PSTR("H2O"));
LCD.print_P(1, 8, PSTR("In"));
LCD.print_P(2, 7, PSTR("Out"));
LCD.print_P(1, 14, TUNIT);
LCD.print_P(1, 19, TUNIT);
LCD.print_P(2, 14, TUNIT);
LCD.print_P(2, 19, TUNIT);
if (screenLock) {
LCD.print_P(3, 0, PSTR(">"));
LCD.print_P(3, 11, PSTR("<"));
LCD.print_P(3, 2, CONTINUE);
Encoder.setMin(0);
Encoder.setMax(6);
Encoder.setCount(0);
}
} else if (activeScreen == SCREEN_AUX) {
//Screen Init: AUX
LCD.print_P(0,0,PSTR("AUX Temps"));
LCD.print_P(1,1,PSTR("AUX1"));
LCD.print_P(2,1,PSTR("AUX2"));
LCD.print_P(1, 11, TUNIT);
LCD.print_P(2, 11, TUNIT);
#ifndef DIRECT_FIRED_RIMS
LCD.print_P(3, 1, PSTR("AUX3"));
LCD.print_P(3, 11, TUNIT);
#endif
}
//Write Unlock symbol to upper right corner
if (!screenLock) LCD.writeCustChar(0, 19, 7);
}
//**********************************************************************************
// screenRefresh: Refresh active screen
//**********************************************************************************
void screenRefresh() {
if (activeScreen == SCREEN_HOME) {
//Refresh Screen: Home
} else if (activeScreen == SCREEN_FILL) {
vftoa(volAvg[VS_HLT], buf, 1000, 1);
truncFloat(buf, 5);
LCD.lPad(2, 9, buf, 5, ' ');
vftoa(volAvg[VS_MASH], buf, 1000, 1);
truncFloat(buf, 5);
LCD.lPad(2, 15, buf, 5, ' ');
if (vlvConfigIsActive(VLV_FILLHLT)) LCD.print_P(3, 11, PSTR("On "));
else LCD.print_P(3, 11, PSTR("Off"));
if (vlvConfigIsActive(VLV_FILLMASH)) LCD.print_P(3, 17, PSTR(" On"));
else LCD.print_P(3, 17, PSTR("Off"));
if (screenLock) {
int encValue = Encoder.change();
if (encValue >= 0) {
LCD.rPad(3, 1, "", 9, ' ');
if (encValue == 0) LCD.print_P(3, 1, CONTINUE);
else if (encValue == 1) LCD.print_P(3, 1, FILLHLT);
else if (encValue == 2) LCD.print_P(3, 1, FILLMASH);
else if (encValue == 3) LCD.print_P(3, 1, FILLBOTH);
else if (encValue == 4) LCD.print_P(3, 2, ALLOFF);
else if (encValue == 5) LCD.print_P(3, 3, MENU);
}
}
} else if (activeScreen == SCREEN_MASH) {
//Refresh Screen: Preheat/Mash
// The DIRECT_FIRED_RIMS option uses a different screen layout, so the logic just
// does not work. So two blocks are required.
#ifdef DIRECT_FIRED_RIMS
byte vessels[3] = {VS_HLT, VS_MASH, VS_MASH};
byte temps[3] = {TS_HLT, TS_MASH, RIMS_TEMP_SENSOR};
byte heatSources[3] = {VS_HLT, VS_MASH, VS_STEAM};
for (byte i = 0; i <= 2; i++) {
vftoa(setpoint[vessels[i]], buf, 100, 1);
truncFloat(buf, 4);
LCD.lPad(i + 1, 15, buf, 4, ' ');
vftoa(temp[temps[i]], buf, 100, 1);
truncFloat(buf, 4);
if (temp[temps[i]] == BAD_TEMP) {
LCD.print_P(i + 1, 1, PSTR("12345678----"));
// LCD.print_P(i + 1, 9, PSTR("----"));
} else {
LCD.lPad(i + 1, 9, buf, 4, ' ');
}
if (PIDEnabled[vessels[i]]) {
// There is no good way to currently show this.
// Removing for now.
LCD.print_P(i + 1, 6, PSTR("#"));
} else if (heatStatus[heatSources[i]]) {
LCD.print_P(i + 1, 6, PSTR("*"));
} else {
LCD.print_P(i + 1, 6, PSTR("-"));
}
// This over-writes the RIMS row, so commented out.
// printTimer(TIMER_MASH, 3, 0);
}
#else
for (byte i = VS_HLT; i <= VS_MASH; i++) {
vftoa(setpoint[i], buf, 100, 1);
truncFloat(buf, 4);
LCD.lPad(1, i * 6 + 9, buf, 4, ' ');
vftoa(temp[i], buf, 100, 1);
truncFloat(buf, 4);
if (temp[i] == BAD_TEMP) {
LCD.print_P(2, i * 6 + 9, PSTR("----"));
} else {
LCD.lPad(2, i * 6 + 9, buf, 4, ' ');
}
byte pct;
if (PIDEnabled[i]) {
pct = PIDOutput[i] / PIDCycle[i];
if (pct == 0) strcpy_P(buf, PSTR("Off"));
else if (pct == 100) strcpy_P(buf, PSTR(" On"));
else { itoa(pct, buf, 10); strcat(buf, "%"); }
} else if (heatStatus[i]) {
strcpy_P(buf, PSTR(" On"));
pct = 100;
} else {
strcpy_P(buf, PSTR("Off"));
pct = 0;
}
LCD.lPad(3, i * 6 + 11, buf, 3, ' ');
printTimer(TIMER_MASH, 3, 0);
}
#endif
} else if (activeScreen == SCREEN_SPARGE) {
//Refresh Screen: Sparge
#ifdef VOLUME_MANUAL
// In manual volume mode show the target volumes instead of the current volumes
vftoa(tgtVol[VS_HLT], buf, 1000, 1);
truncFloat(buf, 6);
LCD.lPad(1, 14, buf, 6, ' ');
vftoa(tgtVol[VS_MASH], buf, 1000, 1);
truncFloat(buf, 6);
LCD.lPad(2, 14, buf, 6, ' ');
vftoa(tgtVol[VS_KETTLE], buf, 1000, 1);
truncFloat(buf, 6);
LCD.lPad(3, 14, buf, 6, ' ');
#else
vftoa(volAvg[VS_HLT], buf, 1000, 1);
truncFloat(buf, 6);
LCD.lPad(1, 14, buf, 6, ' ');
vftoa(volAvg[VS_MASH], buf, 1000, 1);
truncFloat(buf, 6);
LCD.lPad(2, 14, buf, 6, ' ');
vftoa(volAvg[VS_KETTLE], buf, 1000, 1);
truncFloat(buf, 6);
LCD.lPad(3, 14, buf, 6, ' ');
#endif
if (screenLock) {
int encValue = Encoder.change();
if (encValue >= 0) {
LCD.rPad(0, 9, "", 10, ' ');
if (encValue == 0) LCD.print_P(0, 10, CONTINUE);
else if (encValue == 1) LCD.print_P(0, 9, SPARGEIN);
else if (encValue == 2) LCD.print_P(0, 9, SPARGEOUT);
else if (encValue == 3) LCD.print_P(0, 9, FLYSPARGE);
else if (encValue == 4) LCD.print_P(0, 9, MASHHEAT);
else if (encValue == 5) LCD.print_P(0, 9, MASHIDLE);
else if (encValue == 6) LCD.print_P(0, 11, ALLOFF);
else if (encValue == 7) LCD.print_P(0, 12, MENU);
}
}
// Not sure what to do here, due to the very serious design
// defect of using temperature sensors IDs as the index variable.
for (byte i = TS_HLT; i <= TS_KETTLE; i++) {
vftoa(temp[i], buf, 100, 1);
truncFloat(buf, 4);
if (temp[i] == BAD_TEMP) LCD.print_P(i + 1, 8, PSTR("----")); else LCD.lPad(i + 1, 8, buf, 4, ' ');
}
} else if (activeScreen == SCREEN_BOIL) {
//Refresh Screen: Boil
if (screenLock) {
switch (boilControlState) {
case CONTROLSTATE_OFF:
LCD.print_P(0, 14, PSTR(" Off"));
break;
case CONTROLSTATE_AUTO:
LCD.print_P(0, 14, PSTR(" Auto"));
break;
case CONTROLSTATE_ON:
LCD.print_P(0, 14, PSTR("Manual"));
break;
}
}
printTimer(TIMER_BOIL, 3, 0);
vftoa(volAvg[VS_KETTLE], buf, 1000, 1);
truncFloat(buf, 5);
LCD.lPad(2, 15, buf, 5, ' ');
if (PIDEnabled[TS_KETTLE]) {
byte pct = PIDOutput[TS_KETTLE] / PIDCycle[TS_KETTLE];
if (pct == 0) strcpy_P(buf, PSTR("Off"));
else if (pct == 100) strcpy_P(buf, PSTR(" On"));
else { itoa(pct, buf, 10); strcat(buf, "%"); }
} else if (heatStatus[TS_KETTLE]) {
strcpy_P(buf, PSTR(" On"));
} else {
strcpy_P(buf, PSTR("Off"));
}
LCD.lPad(3, 17, buf, 3, ' ');
vftoa(temp[TS_KETTLE], buf, 100, 1);
truncFloat(buf, 5);
if (temp[TS_KETTLE] == BAD_TEMP) LCD.print_P(1, 14, PSTR("-----")); else LCD.lPad(1, 14, buf, 5, ' ');
if (screenLock) {
if (boilControlState != CONTROLSTATE_OFF) {
int encValue = Encoder.change();
if (encValue >= 0) {
boilControlState = CONTROLSTATE_ON;
setpoint[VS_KETTLE] = encValue ? getBoilTemp() * SETPOINT_MULT : 0;
PIDOutput[VS_KETTLE] = PIDCycle[VS_KETTLE] * encValue;
}
}
if (boilControlState == CONTROLSTATE_AUTO) Encoder.setCount(PIDOutput[VS_KETTLE] / PIDCycle[VS_KETTLE]);
}
} else if (activeScreen == SCREEN_CHILL) {
//Refresh Screen: Chill
if (screenLock) {
int encValue = Encoder.change();
if (encValue >= 0) {
LCD.rPad(3, 1, "", 10, ' ');
if (encValue == 0) LCD.print_P(3, 2, CONTINUE);
else if (encValue == 1) LCD.print_P(3, 1, CHILLNORM);
else if (encValue == 2) LCD.print_P(3, 1, CHILLH2O);
else if (encValue == 3) LCD.print_P(3, 1, CHILLBEER);
else if (encValue == 4) LCD.print_P(3, 2, ALLOFF);
else if (encValue == 5) LCD.print_P(3, 4, PSTR("Auto"));
else if (encValue == 6) LCD.print_P(3, 3, ABORT);
}
}
if (temp[TS_KETTLE] == BAD_TEMP) LCD.print_P(1, 11, PSTR("---")); else LCD.lPad(1, 11, itoa(temp[TS_KETTLE] / 100, buf, 10), 3, ' ');
if (temp[TS_BEEROUT] == BAD_TEMP) LCD.print_P(2, 11, PSTR("---")); else LCD.lPad(2, 11, itoa(temp[TS_BEEROUT] / 100, buf, 10), 3, ' ');
if (temp[TS_H2OIN] == BAD_TEMP) LCD.print_P(1, 16, PSTR("---")); else LCD.lPad(1, 16, itoa(temp[TS_H2OIN] / 100, buf, 10), 3, ' ');
if (temp[TS_H2OOUT] == BAD_TEMP) LCD.print_P(2, 16, PSTR("---")); else LCD.lPad(2, 16, itoa(temp[TS_H2OOUT] / 100, buf, 10), 3, ' ');
if (vlvConfigIsActive(VLV_CHILLBEER)) LCD.print_P(3, 12, PSTR(" On")); else LCD.print_P(3, 12, PSTR("Off"));
if (vlvConfigIsActive(VLV_CHILLH2O)) LCD.print_P(3, 17, PSTR(" On")); else LCD.print_P(3, 17, PSTR("Off"));
} else if (activeScreen == SCREEN_AUX) {
//Screen Refresh: AUX
#ifndef DIRECT_FIRED_RIMS
for (byte i = TS_AUX1; i <= TS_AUX3; i++)
#else
for (byte i = TS_AUX1; i <= TS_AUX2; i++)
#endif
{
if (temp[i] == BAD_TEMP) {
LCD.print_P(i - 5, 6, PSTR("-----"));
} else {
vftoa(temp[i], buf, 100, 1);
truncFloat(buf, 5);
LCD.lPad(i - 5, 6, buf, 5, ' ');
}
}
}
}
//**********************************************************************************
// screenEnter: Check enterStatus and handle based on screenLock and activeScreen
//**********************************************************************************
void screenEnter() {
if (Encoder.cancel()) {
//Unlock screens
unlockUI();
} else if (Encoder.ok()) {
if (alarmStatus) setAlarm(0);
else if (!screenLock) lockUI();
else {
if (activeScreen == SCREEN_HOME) {
//Screen Enter: Home
menu homeMenu(3, 9);
while(1) {
//Item updated on each cycle
homeMenu.setItem_P(EXIT, 255);
homeMenu.setItem_P(PSTR("Edit Program"), 1);
homeMenu.setItem_P(PSTR("Start Program"), 2);
homeMenu.setItem_P(DRAIN, 3);
if (vlvConfigIsActive(VLV_DRAIN)) homeMenu.appendItem_P(PSTR(": On"), 3);
else homeMenu.appendItem_P(PSTR(": Off"), 3);
homeMenu.setItem_P(USER1, 4);
if (vlvConfigIsActive(VLV_USER1)) homeMenu.appendItem_P(PSTR(": On"), 4);
else homeMenu.appendItem_P(PSTR(": Off"), 4);
homeMenu.setItem_P(USER2, 5);
if (vlvConfigIsActive(VLV_USER2)) homeMenu.appendItem_P(PSTR(": On"), 5);
else homeMenu.appendItem_P(PSTR(": Off"), 5);
homeMenu.setItem_P(USER3, 6);
if (vlvConfigIsActive(VLV_USER3)) homeMenu.appendItem_P(PSTR(": On"), 6);
else homeMenu.appendItem_P(PSTR(": Off"), 6);
homeMenu.setItem_P(PSTR("Reset All"), 7);
#ifndef UI_NO_SETUP
homeMenu.setItem_P(PSTR("System Setup"), 8);
#endif
byte lastOption = scrollMenu("Main Menu", &homeMenu);
if (lastOption == 1) editProgramMenu();
else if (lastOption == 2) {
startProgramMenu();
if (activeScreen == SCREEN_FILL) {
doInit = 1;
break;
}
}
else if (lastOption == 3) {
//Drain
if (vlvConfigIsActive(VLV_DRAIN)) bitClear(actProfiles, VLV_DRAIN);
else {
if (zoneIsActive(ZONE_MASH) || zoneIsActive(ZONE_BOIL)) {
LCD.clear();
LCD.print_P(0, 0, PSTR("Cannot drain while"));
LCD.print_P(1, 0, PSTR("mash or boil zone"));
LCD.print_P(2, 0, PSTR("is active"));
LCD.print(3, 4, ">");
LCD.print_P(3, 6, CONTINUE);
LCD.print(3, 15, "<");
while (!Encoder.ok()) brewCore();
} else bitSet(actProfiles, VLV_DRAIN);
}
}
else if (lastOption >= 4 && lastOption <= 6) {
//User Valve 1-3
if (vlvConfigIsActive(lastOption + 13)) bitClear(actProfiles, lastOption + 13);
else bitSet(actProfiles, lastOption + 13);
}
else if (lastOption == 7) {
//Reset All
if (confirmAbort()) {
resetOutputs();
clearTimer(TIMER_MASH);
clearTimer(TIMER_BOIL);
}
}
#ifndef UI_NO_SETUP
else if (lastOption == 8) menuSetup();
#endif
else {
//On exit of the Main menu go back to Splash/Home screen.
setActive(SCREEN_HOME);
unlockUI();
break;
}
}
doInit = 1;
} else if (activeScreen == SCREEN_FILL) {
//Sceeen Enter: Fill/Refill
int encValue = Encoder.getCount();
if (encValue == 0) continueClick();
else if (encValue == 1) { autoValve[AV_FILL] = 0; bitClear(actProfiles, VLV_FILLMASH); bitSet(actProfiles, VLV_FILLHLT);}
else if (encValue == 2) { autoValve[AV_FILL] = 0; bitClear(actProfiles, VLV_FILLHLT); bitSet(actProfiles, VLV_FILLMASH);}
else if (encValue == 3) { autoValve[AV_FILL] = 0; bitSet(actProfiles, VLV_FILLHLT); bitSet(actProfiles, VLV_FILLMASH);}
else if (encValue == 4) { autoValve[AV_FILL] = 0; bitClear(actProfiles, VLV_FILLHLT); bitClear(actProfiles, VLV_FILLMASH);}
else if (encValue == 5) {
menu fillMenu(3, 6);
fillMenu.setItem_P(PSTR("Auto Fill"), 0);
fillMenu.setItem_P(PSTR("HLT Target"), 1);
fillMenu.setItem_P(PSTR("Mash Target"), 2);
fillMenu.setItem_P(CONTINUE, 3);
fillMenu.setItem_P(ABORT, 4);
fillMenu.setItem_P(EXIT, 255);
byte lastOption = scrollMenu("Fill Menu", &fillMenu);
if (lastOption == 0) { if(tgtVol[VS_HLT] || tgtVol[VS_MASH]) autoValve[AV_FILL] = 1; }
else if (lastOption == 1) tgtVol[VS_HLT] = getValue_P(PSTR("HLT Target Vol"), tgtVol[VS_HLT], 1000, 9999999, VOLUNIT);
else if (lastOption == 2) tgtVol[VS_MASH] = getValue_P(PSTR("Mash Target Vol"), tgtVol[VS_MASH], 1000, 9999999, VOLUNIT);
else if (lastOption == 3) continueClick();
else if (lastOption == 4) {
if (confirmAbort()) {
if (stepIsActive(STEP_FILL)) stepExit(STEP_FILL);
else stepExit(STEP_REFILL); //Abort STEP_REFILL or manual operation
}
}
doInit = 1;
}
} else if (activeScreen == SCREEN_MASH) {
//Screen Enter: Preheat/Mash
menu mashMenu(3, 7);
mashMenu.setItem_P(PSTR("HLT Setpoint:"), 0);
vftoa(setpoint[VS_HLT], buf, 100, 1);
truncFloat(buf, 4);
mashMenu.appendItem(buf, 0);
mashMenu.appendItem_P(TUNIT, 0);
mashMenu.setItem_P(PSTR("Mash Setpoint:"), 1);
vftoa(setpoint[VS_MASH], buf, 100, 1);
truncFloat(buf, 4);
mashMenu.appendItem(buf, 1);
mashMenu.appendItem_P(TUNIT, 1);
mashMenu.setItem_P(PSTR("Set Timer"), 2);
if (timerStatus[TIMER_MASH]) mashMenu.setItem_P(PSTR("Pause Timer"), 3);
else mashMenu.setItem_P(PSTR("Start Timer"), 3);
mashMenu.setItem_P(CONTINUE, 4);
mashMenu.setItem_P(ABORT, 5);
mashMenu.setItem_P(EXIT, 255);
byte lastOption = scrollMenu("Mash Menu", &mashMenu);
if (lastOption == 0) setSetpoint(VS_HLT, getValue_P(PSTR("HLT Setpoint"), setpoint[VS_HLT] / SETPOINT_MULT, SETPOINT_DIV, 255, TUNIT));
else if (lastOption == 1) setSetpoint(VS_MASH, getValue_P(PSTR("Mash Setpoint"), setpoint[VS_MASH] / SETPOINT_MULT, SETPOINT_DIV, 255, TUNIT));
else if (lastOption == 2) {
setTimer(TIMER_MASH, getTimerValue(PSTR("Mash Timer"), timerValue[TIMER_MASH] / 60000, 1));
//Force Preheated
preheated[VS_MASH] = 1;
}
else if (lastOption == 3) {
pauseTimer(TIMER_MASH);
//Force Preheated
preheated[VS_MASH] = 1;
}
else if (lastOption == 4) {
byte brewstep = PROGRAM_IDLE;
if (stepIsActive(STEP_DELAY)) brewstep = STEP_DELAY;
else if (stepIsActive(STEP_DOUGHIN)) brewstep = STEP_DOUGHIN;
else if (stepIsActive(STEP_PREHEAT)) brewstep = STEP_PREHEAT;
else if (stepIsActive(STEP_ACID)) brewstep = STEP_ACID;
else if (stepIsActive(STEP_PROTEIN)) brewstep = STEP_PROTEIN;
else if (stepIsActive(STEP_SACCH)) brewstep = STEP_SACCH;
else if (stepIsActive(STEP_SACCH2)) brewstep = STEP_SACCH2;
else if (stepIsActive(STEP_MASHOUT)) brewstep = STEP_MASHOUT;
else if (stepIsActive(STEP_MASHHOLD)) brewstep = STEP_MASHHOLD;
if(brewstep != PROGRAM_IDLE) {
if (stepAdvance(brewstep)) {
//Failed to advance step
stepAdvanceFailDialog();
}
} else activeScreen = SCREEN_SPARGE;
} else if (lastOption == 5) {
if (confirmAbort()) {
if (stepIsActive(STEP_DELAY)) stepExit(STEP_DELAY);
else if (stepIsActive(STEP_DOUGHIN)) stepExit(STEP_DOUGHIN);
else if (stepIsActive(STEP_PREHEAT)) stepExit(STEP_PREHEAT);
else if (stepIsActive(STEP_ACID)) stepExit(STEP_ACID);
else if (stepIsActive(STEP_PROTEIN)) stepExit(STEP_PROTEIN);
else if (stepIsActive(STEP_SACCH)) stepExit(STEP_SACCH);
else if (stepIsActive(STEP_SACCH2)) stepExit(STEP_SACCH2);
else if (stepIsActive(STEP_MASHOUT)) stepExit(STEP_MASHOUT);
else stepExit(STEP_MASHHOLD); //Abort STEP_MASHOUT or manual operation
}
}
doInit = 1;
} else if (activeScreen == SCREEN_SPARGE) {
//Screen Enter: Sparge
int encValue = Encoder.getCount();
if (encValue == 0) continueClick();
else if (encValue == 1) { resetSpargeValves(); bitSet(actProfiles, VLV_SPARGEIN); }
else if (encValue == 2) { resetSpargeValves(); bitSet(actProfiles, VLV_SPARGEOUT); }
else if (encValue == 3) { resetSpargeValves(); bitSet(actProfiles, VLV_SPARGEIN); bitSet(actProfiles, VLV_SPARGEOUT); }
else if (encValue == 4) { resetSpargeValves(); bitSet(actProfiles, VLV_MASHHEAT); }
else if (encValue == 5) { resetSpargeValves(); bitSet(actProfiles, VLV_MASHIDLE); }
else if (encValue == 6) { resetSpargeValves(); }
else if (encValue == 7) {
menu spargeMenu(3, 8);
spargeMenu.setItem_P(PSTR("Auto In"), 0);
spargeMenu.setItem_P(PSTR("Auto Out"), 1);
spargeMenu.setItem_P(PSTR("Auto Fly"), 2);
spargeMenu.setItem_P(PSTR("HLT Target"), 3);
spargeMenu.setItem_P(PSTR("Kettle Target"), 4);
spargeMenu.setItem_P(CONTINUE, 5);
spargeMenu.setItem_P(ABORT, 6);
spargeMenu.setItem_P(EXIT, 255);
byte lastOption = scrollMenu("Sparge Menu", &spargeMenu);
if (lastOption == 0) { resetSpargeValves(); if(tgtVol[VS_HLT]) autoValve[AV_SPARGEIN] = 1; }
else if (lastOption == 1) { resetSpargeValves(); if(tgtVol[VS_KETTLE]) autoValve[AV_SPARGEOUT] = 1; }
else if (lastOption == 2) { resetSpargeValves(); if(tgtVol[VS_KETTLE]) autoValve[AV_FLYSPARGE] = 1; }
else if (lastOption == 3) tgtVol[VS_HLT] = getValue_P(PSTR("HLT Target Vol"), tgtVol[VS_HLT], 1000, 9999999, VOLUNIT);