-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathprompts.h
681 lines (618 loc) · 14.2 KB
/
prompts.h
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
#ifndef PROMPTS_H
#define PROMPTS_H
#define P0_clear 100
#define P0_banner 101
#define P0_manual 102
#define P0_auto 103
#define P0_setup 104
#define P0_stage 105
#define P0_iodine 106
#define P0_prepare 107
#if USE_HLT == true
#define P0_manhlt 108
#endif
#define P0_manmlt 109
#define P0_manpump 110
#if Distilling == true
#define P0_distilling 111
#endif
#define P1_clear 200
#define P1_pBKwater 201
#define P1_pHLTwater 202
#define P1_ready 203
#define P1_aborted 204
#define P1_cool 205
#define P1_whirl 206
#define P1_twhirl 207
#define P1_prime 208
#define P1_resume 209
#define P2_clear 300
#define P2_malt_add 301
#define P2_malt_rem 302
#define P2_norecipe 303
#define P3_clear 400
#define P3_xMAS 401
#define P3_xBPQ 402
#if USE_HLT == true
#define P3_HBPQ 403
#endif
#define P3_UD0Q 404
#define P3_UD1Q 405
#define P3_xx0Q 406
#define P3_xx1Q 407
#define P3_proceed 408
#define P3_xxxO 409
#define P3_xxSO 410
#define P3_QQxO 411
#define P3_SGQO 412
#define P3_xGQO 413
#define P3_SxQO 414
#define P3_UDPQ 415
#define P3_UDRx 416
#define P3_xxRx 417
#define P3_QQBO 418
#define P3_OOxO 419
#define P3_UDxQ 420
#if DebugErrors == true
#define P3_erase 421
#endif
#if Distilling == true
#define P3_UDBQ 422
#endif
#define X6Y1_temp 501
#define X1Y1_temp 502
#define X11Y1_setpoint 503
#define X1Y2_blank 504
#define X1Y2_timer 505
#define X11Y2_blank 506
#define X11Y2_pwm 507
#define X11Y2_timer 508
#if (USE_HLT == true || TempVapor == true)
#define X6Y2_temp 509
#define X1Y2_temp 510
#endif
#if USE_HLT == true
#define X1Y2_setpoint 511
#define X11Y2_setpoint 512
#endif
#if langNL == true
const char *stageName[] = { "Maisch In ",
"Maisch #1 ",
"Maisch #2 ",
"Maisch #3 ",
"Maisch #4 ",
"Maisch #5 ",
"Maisch #6 ",
"Maisch Uit",
"Koken ",
"Koelen ",
"Whirlpool ",
"Whirlpool ",
"Whirlpool ",
"Whirlpool "
};
#else
const char *stageName[] = { "Mash In ",
"Mash #1 ",
"Mash #2 ",
"Mash #3 ",
"Mash #4 ",
"Mash #5 ",
"Mash #6 ",
"Mash Out ",
"Boil ",
"Cooling ",
"Whirlpool ",
"Whirlpool ",
"Whirlpool ",
"Whirlpool "
};
#endif
void LCD_Integer(int value, int digits) {
char mymsg[8];
dtostrf(value, digits, 0, mymsg);
lcd.print(mymsg);
}
void LCD_Float(float value, int digits, int decimals) {
char mymsg[21];
dtostrf(value, digits, decimals, mymsg);
lcd.print(mymsg);
}
void LCDSpace (byte Num) {
for (byte i = 0; i < Num; i++)
lcd.write(32);
}
/*
LCD messages
*/
void Prompt(int Pmpt) {
if (Pmpt == 0)
return;
if ((Pmpt >= 100) && (Pmpt < 200)) {
lcd.setCursor(0, 0);
} else if ((Pmpt >= 200) && (Pmpt < 300)) {
lcd.setCursor(0, 1);
} else if ((Pmpt >= 300) && (Pmpt < 400)) {
lcd.setCursor(0, 2);
} else if ((Pmpt >= 400) && (Pmpt < 500)) {
lcd.setCursor(0, 3);
}
switch (Pmpt) {
case P0_clear:
LCDSpace(20);
return;
case P0_banner:
lcd.print(F("MBSE ArdRims " VERSION " \x07"));
return;
case P0_manual:
#if langNL == true
lcd.print(F(" HANDBEDIENING "));
#else
lcd.print(F(" MANUAL MODE "));
#endif
return;
case P0_auto:
#if langNL == true
lcd.print(F(" AUTOMATISCH "));
#else
lcd.print(F(" AUTOMATIC MODE "));
#endif
return;
case P0_setup:
#if langNL == true
lcd.print(F(" INSTELLINGEN "));
#else
lcd.print(F(" SETUP MODE "));
#endif
return;
case P0_stage:
lcd.print(F(" AUTO --> "));
lcd.print(stageName[CurrentState]);
return;
case P0_iodine:
#if langNL == true
lcd.print(F(" ** JODIUM PROEF ** "));
#else
lcd.print(F(" ** IODINE TEST ** "));
#endif
return;
case P0_prepare:
#if langNL == true
lcd.print(F(" ** OPWARMEN ** "));
#else
lcd.print(F(" ** PRE-HEAT ** "));
#endif
return;
#if USE_HLT == true
case P0_manhlt:
#if langNL == true
lcd.print(F(" HWAT BEDIENING "));
#else
lcd.print(F(" HLT CONTROL "));
#endif
return;
#endif
case P0_manmlt:
#if langNL == true
lcd.print(F(" KOOK BEDIENING "));
#else
lcd.print(F(" BOIL CONTROL "));
#endif
return;
case P0_manpump:
#if langNL == true
lcd.print(F(" POMP BEDIENING "));
#else
lcd.print(F(" PUMP CONTROL "));
#endif
return;
#if Distilling == true
case P0_distilling:
#if langNL == true
lcd.print(F(" DISTILLEREN "));
#else
lcd.print(F(" DISTILLATION "));
#endif
return;
#endif
case P1_clear:
LCDSpace(18);
return;
case P1_pBKwater:
#if langNL == true
lcd.print(F("Maischwater Aanw? "));
#else
lcd.print(F(" Have Mash water? "));
#endif
return;
#if USE_HLT == true
case P1_pHLTwater:
#if langNL == true
lcd.print(F(" Spoelwater Aanw? "));
#else
lcd.print(F("Have Sparge water?"));
#endif
return;
#endif
case P1_ready:
#if langNL == true
lcd.print(F(" Brouwen is Klaar "));
#else
lcd.print(F(" Brew is finished "));
#endif
return;
case P1_aborted:
#if langNL == true
lcd.print(F("Brouwen Afgebroken"));
#else
lcd.print(F(" Brew aborted "));
#endif
return;
case P1_cool:
#if langNL == true
lcd.print(F(" START KOELEN "));
#else
lcd.print(F(" START COOLING "));
#endif
return;
case P1_whirl:
#if langNL == true
lcd.print(F(" START WHIRLPOOL "));
#else
lcd.print(F(" START WHIRLPOOL "));
#endif
return;
case P1_twhirl:
#if langNL == true
lcd.print(F(" Whirlpool Tijd "));
#else
lcd.print(F(" Whirlpool Time "));
#endif
return;
case P1_prime:
#if langNL == true
lcd.print(F(" Pomp Ontluchten "));
#else
lcd.print(F(" Pump Prime "));
#endif
return;
case P1_resume:
#if langNL == true
lcd.print(F(" Hervat Proces? "));
#else
lcd.print(F(" Resume Process? "));
#endif
return;
case P2_clear:
LCDSpace(20);
return;
case P2_malt_add:
#if langNL == true
lcd.print(F(" Mout Storten "));
#else
lcd.print(F(" Add Malt "));
#endif
return;
case P2_malt_rem:
#if langNL == true
lcd.print(F(" Mout Verwijderen "));
#else
lcd.print(F(" Remove Malt "));
#endif
return;
case P2_norecipe:
#if langNL == true
lcd.print(F(" GEEN RECEPTEN! "));
#else
lcd.print(F(" NO RECIPES! "));
#endif
return;
case P3_clear:
LCDSpace(20);
return;
case P3_xMAS:
#if langNL == true
#if Distilling == true
lcd.print(F("DIST HAND AUTO SETUP"));
#else
lcd.print(F(" -- HAND AUTO SETUP"));
#endif
#else
#if Distilling == true
lcd.print(F("DIST MAN AUTO SETUP"));
#else
lcd.print(F(" -- MAN AUTO SETUP"));
#endif
#endif
return;
case P3_xBPQ:
#if langNL == true
lcd.print(F(" -- KOOK POMP STOP "));
#else
lcd.print(F(" -- BK PUMP QUIT "));
#endif
return;
#if USE_HLT == true
case P3_HBPQ:
#if langNL == true
lcd.print(F("HWAT KOOK POMP STOP "));
#else
lcd.print(F("HLT BK PUMP QUIT "));
#endif
return;
#endif
case P3_UD1Q:
#if langNL == true
lcd.print(F("Op Neer Aan Terug"));
#else
lcd.print(F("Up Down On Quit "));
#endif
return;
case P3_UD0Q:
#if langNL == true
lcd.print(F("Op Neer Uit Terug"));
#else
lcd.print(F("Up Down Off Quit "));
#endif
return;
case P3_xx1Q:
#if langNL == true
lcd.print(F(" -- -- Aan Terug"));
#else
lcd.print(F(" -- -- On Quit "));
#endif
return;
case P3_xx0Q:
#if langNL == true
lcd.print(F(" -- -- Uit Terug"));
#else
lcd.print(F(" -- -- Off Quit "));
#endif
return;
case P3_proceed:
#if langNL == true
lcd.print(F("Doorgaan: Ja Nee "));
#else
lcd.print(F("Continue: Yes No "));
#endif
return;
case P3_xxxO:
#if langNL == true
lcd.print(F(" Ok "));
#else
lcd.print(F(" Ok "));
#endif
return;
case P3_xxSO:
#if langNL == true
lcd.print(F(" Niet Ok "));
#else
lcd.print(F(" Skip Ok "));
#endif
return;
case P3_QQxO:
#if langNL == true
lcd.print(F(" Op Neer Ok "));
#else
lcd.print(F(" Up Down Ok "));
#endif
return;
case P3_SGQO:
#if langNL == true
lcd.print(F(" Op Neer Terug Ok"));
#else
lcd.print(F(" Up Down Quit Ok "));
#endif
return;
case P3_xGQO:
#if langNL == true
lcd.print(F(" -- Neer Terug Ok"));
#else
lcd.print(F(" -- Down Quit Ok "));
#endif
return;
case P3_SxQO:
#if langNL == true
lcd.print(F(" Op -- Terug Ok"));
#else
lcd.print(F(" Up -- Quit Ok "));
#endif
return;
case P3_UDPQ:
#if langNL == true
lcd.print(F(" Op Neer Pomp Terug"));
#else
lcd.print(F(" Up Down Pump Quit"));
#endif
return;
case P3_UDRx:
#if langNL == true
lcd.print(F(" Op Neer Pauze "));
#else
lcd.print(F(" Up Down Pause "));
#endif
return;
case P3_xxRx:
#if langNL == true
lcd.print(F(" Pauze "));
#else
lcd.print(F(" Pause "));
#endif
return;
case P3_QQBO:
#if langNL == true
lcd.print(F("OP* *NEER Terug Ok "));
#else
lcd.print(F("UP* *DWN Back Ok "));
#endif
return;
case P3_OOxO:
#if langNL == true
lcd.print(F(" On Off Ok "));
#else
lcd.print(F("Aan Uit Ok "));
#endif
return;
case P3_UDxQ:
#if langNL == true
lcd.print(F(" Op Neer Terug"));
#else
lcd.print(F(" Up Down Quit"));
#endif
return;
#if DebugErrors == true
case P3_erase:
lcd.print(F("Clear all: Yes No "));
return;
#endif
#if Distilling == true
case P3_UDBQ:
lcd.print(F(" Op Neer KOOK STOP"));
return;
#endif
case X6Y1_temp:
case X1Y1_temp:
if (Pmpt == X6Y1_temp)
lcd.setCursor(6, 1);
else
lcd.setCursor(1, 1);
LCD_Float(Temp_MLT, 6, 2);
lcd.write((byte)0);
return;
case X11Y1_setpoint:
lcd.setCursor(11, 1);
LCD_Float(Setpoint, 6, 2);
lcd.write(2);
return;
case X11Y2_pwm:
lcd.setCursor(11, 2);
lcd.print(F("PWM="));
LCD_Integer(int((Output * 100 ) / 255), 3);
lcd.print(F("%"));
return;
case X11Y2_blank:
lcd.setCursor(11, 2);
LCDSpace(9);
return;
case X1Y2_blank:
lcd.setCursor(1, 2);
LCDSpace(9);
return;
case X1Y2_timer:
(TimeUp) ? TimerShow(TimeSpent, 1, 2) : TimerShow(TimeLeft, 1, 2);
return;
case X11Y2_timer:
(TimeUp) ? TimerShow(TimeSpent, 11, 2) : TimerShow(TimeLeft, 11, 2);
return;
#if (USE_HLT == true || TempVapor == true)
case X6Y2_temp:
case X1Y2_temp:
if (Pmpt == X6Y2_temp)
lcd.setCursor(6, 2);
else
lcd.setCursor(1, 2);
LCD_Float(Temp_HLT, 6, 2);
lcd.write((byte)0);
lcd.write(32);
return;
#endif
#if USE_HLT == true
case X11Y2_setpoint:
case X1Y2_setpoint:
(Pmpt == X11Y2_setpoint) ? lcd.setCursor(11, 2) : lcd.setCursor(1, 2);
LCD_Float(HLT_SetPoint, 6, 2);
lcd.write(2);
return;
#endif
default:
Serial.print("Unknown prompt ");
Serial.println(Pmpt);
break;
}
}
boolean PromptForMashWater(boolean Mash) {
#if USE_HLT == true
(Mash) ? Prompt(P1_pBKwater) : Prompt(P1_pHLTwater);
#else
Prompt(P1_pBKwater);
#endif
Prompt(P3_proceed);
while (true) {
AllThreads();
byte button = ReadKey();
if (button == buttonStart)
return true;
if (button == buttonEnter)
return false;
}
}
/*
Wait for confirm
Type = 1 choices Yes ---
Type = 2 choices Yes No
Pid = true run PID
Pid = false no PID
P0, P1, P2, P3 prompts to display or zero
*/
boolean WaitForConfirm(byte Type, boolean Pid, boolean Hlt, int P0, int P1, int P2, int P3) {
BuzzerPlay(BUZZ_Prompt);
while (true) {
AllThreads();
byte button = ReadKey();
Input = Temp_MLT;
Prompt(P0);
Prompt(P1);
Prompt(P2);
Prompt(P3);
if (P1 == 0) {
Prompt(X1Y1_temp);
Prompt(X11Y1_setpoint);
}
if (Pid)
PID_Heat(true);
#if USE_HLT == true
if (Hlt && HLT_SetPoint)
HLT_Heat();
#endif
if (button == buttonStart)
return true;
if (Type == 2 && (button == buttonEnter))
return false;
}
}
/*
Returns true if Yes
false if No
*/
boolean Pause() {
bk_heat_off();
pump_off();
#if USE_HLT == true
HLT_off();
#endif
lcd.setCursor(0, 0);
#if langNL == true
lcd.print(F(" -- PAUZE PAUZE -- "));
lcd.setCursor(1, 2);
lcd.print(F( "-- PAUZE PAUZE --"));
#else
lcd.print(F(" -- PAUSE PAUSE -- "));
lcd.setCursor(1, 2);
lcd.print(F( "-- PAUSE PAUSE --"));
#endif
Prompt(P3_proceed);
while (true) {
AllThreads();
byte button = ReadKey();
Prompt(X1Y1_temp);
Prompt(X11Y1_setpoint);
if (button == buttonStart)
break;
if ((button == buttonEnter) && kp_repeat_count)
return false;
}
Prompt(P0_clear);
Prompt(P2_clear);
return true;
}
#endif