forked from MaxN68it/Open-ArdBir
-
Notifications
You must be signed in to change notification settings - Fork 1
/
LCD20x4.h
733 lines (616 loc) · 13.4 KB
/
LCD20x4.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
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
char *PIDName[] ={" Kostante P ", " Kostante I ", " Kostante D ", " Finestra ms ", "Uso Resistenza", " Calibrazione "};
char *stageName[] ={" Mash In ", " Fitasi ", " Glucanasi ", " Proteasi ", " B-Amilasi ", " A-Amilasi ", " Mash Out ", " Bollitura "};
char *unitName[] ={" Scala Gradi", " Sensore ", " Ebollizione ", " Ebollizione ", " Ciclo Pompa ", " Pausa Pompa ", " Pompa on Boil ", " Fermo Pompa "};
byte Ciclo=0;
void Versione(byte locX, byte locY){
lcd.setCursor(locX, locY);
//lcd.print(F("Ver"));
lcd.print(Version);
lcd.write(7);
}
void Intestazione(){
lcd.setCursor(0,0);
lcd.print(F("Open ArdBir"));
lcd.setCursor(12,0);
lcd.write(6);
if (Ciclo<100){
lcd.print(F("2012-14"));
}else{
Riga1();
Versione(12,0);
}
Ciclo++;
if (Ciclo>250)Ciclo=0;
}
void Clear_2(){
lcd.setCursor(0,2);
Riga20();
}
void Clear_2_3(){
lcd.setCursor(0,2);
Riga20();
lcd.setCursor(0,3);
Riga20();
}
void lcd_QQSO(){
lcd.setCursor(0,3);
lcd.print(F(" SU**GIU' salta ok "));
}
void lcd_QQxO(){
lcd.setCursor(0,3);
lcd.print(F(" SU**GIU' --- ok "));
}
void lcd_SGEO(){
lcd.setCursor(0,3);
lcd.print(F(" su giu' esci ok "));
}
void lcd_xGEO(){
lcd.setCursor(0,3);
lcd.print(F(" --- giu' esci ok "));
}
void lcd_SxEO(){
lcd.setCursor(0,3);
lcd.print(F(" su --- esci ok "));
}
void lcd_OkEsci(){
lcd.setCursor(0,3);
lcd.print(F(" --- --- Ok Esci "));
}
void LCD_Default(float Temp_Now){
Intestazione();
lcd.setCursor(5,1);
Riga2();
if (Temp_Now>=100)lcd.print(Temp_Now,1);
else lcd.print(Temp_Now);
Gradi();
Clear_2();
lcd.setCursor(0,3);
lcd.print(F(" --- MAN AUTO SETUP"));
}
void Menu_1(){
lcd.clear();
lcd.setCursor(0,0);
lcd.print(F(" MODALITA' MANUALE "));
}
void Manuale(float Set, float Temp,float TempBoil){
lcd.setCursor(1,1);
if (Temp<100)Riga1();
lcd.print(Temp);
Gradi();
lcd.setCursor(12,1);
if (Set<100)Riga1();
lcd.print(Set);
lcd.write(2);
lcd.setCursor(1,2);
Riga8();
lcd.setCursor(0,3);
lcd.print(F(" SU GIU' Res Pmp "));
}
void Menu_2(){
lcd.clear();
lcd.setCursor(0,0);
lcd.print(F("MODALITA' AUTOMATICA"));
}
void AddMalt(){
lcd.setCursor(0,2);
lcd.print(F(" Aggiungi Malto "));
lcd.setCursor(0,3);
lcd_OkEsci();
Buzzer(1, 1000);
}
void Stage(byte Stage, float Set, float Temp){
lcd.setCursor(0,0);
lcd.print(F(" AUTO -->"));
lcd.print(stageName[Stage]);
lcd.setCursor(1,1);
if (Temp<100)Riga1();
lcd.print(Temp);
Gradi();
lcd.setCursor(8,1);
Riga4();
if (Set<100)Riga1();
lcd.print(Set);
lcd.write(2);
lcd.setCursor(1,2);
Riga8();
Riga1();
lcd.setCursor(18,2);
Riga1();
lcd.setCursor(0,3);
lcd.print(F(" SU GIU' Pausa --- "));
}
void RemoveMalt(){
lcd.setCursor(0,2);
lcd.print(F(" Rimuovi Malto "));
//Clear2();
lcd.setCursor(0,3);
lcd_OkEsci();
Buzzer(1,1500);
}
void Temp_Wait(float Temp){
lcd.setCursor(1,1);
if (Temp<100)Riga1();
lcd.print(Temp);
Gradi();
}
void Boil(float Heat, float Temp, byte Tipo){
if (Tipo==1){
lcd.setCursor(0,0);
lcd.print(F(" AUTO --> Bollitura "));
}
lcd.setCursor(1,1);
if(Temp<100)Riga1();
lcd.print(Temp);
Gradi();
Riga4();
lcd.setCursor(1,2);
lcd.print(F("Res=")); //Display output%
if (Heat<100)Riga1(); //added space as place holder for <100
lcd.print(Heat,0); //Display output%
lcd.print(F("% "));
}
void HopAdd(float Temp, byte HopAdd){
lcd.setCursor(9,0);
lcd.print(F(" Luppolo "));
if(HopAdd<10)Riga1();
lcd.print(HopAdd+1);
}
void Menu_3(){
lcd.clear();
lcd.setCursor(0,0);
lcd.print(F("MENU CONFIGURAZIONE"));
}
void Menu_3_1(){
lcd.setCursor(0,1);
lcd.print(F(" Parametri P.I.D. "));
Clear_2();
lcd.setCursor(0,3);
lcd_xGEO();
}
void Menu_3_1_x(byte i){
lcd.setCursor(0,2);
lcd.print(PIDName[i]);
lcd_QQxO();
}
void PidSet(int pidSet, byte i){
if(i==5){
lcd.setCursor(14,2);
float OffSet=pidSet/10.0;
if (OffSet>=0)Riga1();
lcd.print(OffSet);
Riga1();
}
else{
lcd.setCursor(15,2);
if (pidSet<=250){
if (pidSet<=-10 && pidSet>-100 )Riga1();
if (pidSet<0 && pidSet>-10)Riga2();
if (pidSet<10 && pidSet>=0)Riga3();
if (pidSet>=10 && pidSet<100)Riga2();
if (pidSet>=100)Riga1();
}
else{
if (pidSet<1000)Riga1();
}
lcd.print(pidSet);
if(i==4)lcd.print(F("%"));
}
}
void Menu_3_2(){
lcd.setCursor(0,1);
lcd.print(F(" Parametri Unita' "));
Clear_2();
lcd.setCursor(0,3);
lcd_SGEO();
}
void Menu_3_2_x(byte i){
lcd.setCursor(0,2);
lcd.print(unitName[i]);
lcd_QQxO();
}
void Menu_3_3(){
lcd.setCursor(0,1);
lcd.print(F(" Setta Automazione "));
lcd_SGEO();
}
void Menu_3_3_x(byte Stage){
lcd.setCursor(1,2);
lcd.print(stageName[Stage]);
if (Stage==0||Stage==5||Stage==6)lcd_QQxO();
else lcd_QQSO();
}
void Menu_3_3_8(){
lcd.setCursor(1,2);
lcd.print(F("Numero Luppoli "));
lcd_QQxO();
}
void Menu_3_3_9(){
lcd.setCursor(1,2);
lcd.print(F("Bollitura "));
lcd_QQxO();
}
void Menu_3_3_10(byte SetHop){
lcd.setCursor(0,2);
lcd.print(F(" Luppolo ("));
if (SetHop<10);Riga1();
lcd.print(SetHop);
lcd.print(F(") "));
lcd_QQxO();
}
void Menu_3_4(){
lcd.setCursor(0,1);
lcd.print(F(" Gestione Ricette "));
Clear_2();
lcd_SGEO();
}
void Menu_3_4_1(){
lcd.setCursor(0,2);
lcd.print(F(" Carica Ricetta "));
lcd_xGEO();
}
void Menu_3_4_2(){
lcd.setCursor(0,2);
lcd.print(F(" Salva Ricetta "));
lcd_SGEO();
}
void Menu_3_4_3(){
lcd.setCursor(0,2);
lcd.print(F(" Cancella Ricetta "));
lcd_SGEO();
}
void Menu_3_4_4(){
lcd.setCursor(0,2);
lcd.print(F(" Inizializzazione "));
lcd_SxEO();
}
void NoRecipe(){
Clear_2();
lcd.setCursor(0,3);
lcd.print(F(" NESSUNA RICETTA "));
Buzzer(3,50);
delay(1500);
}
void CaricaRicetta(byte Ricetta){
lcd.setCursor(0,2);
lcd.print(F(" Carico Ricetta "));
if (Ricetta<10)lcd.print(F("0"));
lcd.print(Ricetta);
Riga1();
lcd_OkEsci();
}
void LeggoRicetta(byte Ricetta){
Clear_2();
lcd.setCursor(0,3);
lcd.print(F("Carico Ricetta... "));
delay(1500);
lcd.setCursor(0,3);
lcd.print(F("Ricetta "));
if (Ricetta<10)lcd.print(F("0"));
lcd.print(Ricetta);
lcd.print(F(" Caricata"));
delay(1500);
}
void SalvataggioRicetta(byte Ricetta){
lcd.setCursor(0,2);
lcd.print(F(" Salvo Ricetta "));
if (Ricetta<10)lcd.print(F("0"));
lcd.print(Ricetta);
lcd.print(F("? "));
lcd_OkEsci();
}
void SalvaRicetta(){
Clear_2();
lcd.setCursor(0,3);
lcd.print(F(" Salvataggio... "));
Buzzer(5,35);
delay(2000);
lcd.setCursor(0,3);
lcd.print(F(" Ricetta Salvata "));
delay(1500);
}
void CancelloRicetta(byte Ricetta){
lcd.setCursor(0,2);
lcd.print(F("Cancello Ricetta "));
if (Ricetta<10)lcd.print(F("0"));
lcd.print(Ricetta);
Riga1();
lcd_OkEsci();
}
void Cancellazione(byte Ricetta){
Clear_2();
lcd.setCursor(0,3);
lcd.print(F(" Cancellazione... "));
delay(1500);
lcd.setCursor(0,3);
lcd.print(F(" Ricetta Cancellata "));
delay(1500);
}
void Inizializzazione(){
lcd.setCursor(0,2);
lcd.print(F(" Inizializzazione "));
lcd_OkEsci();
}
void Inizializza(){
Clear_2();
lcd.setCursor(0,3);
lcd.print(F(" Inizializzo EEPROM "));
Buzzer(2,35);
delay(1500);
lcd.setCursor(0,3);
lcd.print(F(" EEPROM pronta "));
delay(1500);
}
void MemoriaPiena(){
Clear_2();
lcd.setCursor(0,3);
lcd.print(F(" ATTENZIONE "));
Buzzer(5,35);
delay(1000);
lcd.setCursor(0,3);
lcd.print(F(" MEMORIA PIENA "));
delay(2500);
}
void Menu_3_5(){
lcd.setCursor(0,1);
lcd.print(F(" Riconoscimenti "));
lcd_SxEO();
}
/*
void Menu_4(){
lcd.clear();
lcd.setCursor(0,0);
lcd.print(F(" TEST DELLA RAM "));
}
void Menu_4_1(){
lcd.setCursor(0,1);
lcd.print(F(" Memoria Libera "));
lcd.setCursor(5,2);
if (freeRam()<1000&&freeRam()>=100)Riga1();
if (freeRam()<100&&freeRam()>=10)Riga2();
if (freeRam()<10)Riga3();
lcd.print(freeRam());
Riga2();
lcd.print(F("byte"));
lcd.setCursor(0,3);
Riga20();
delay(3500);
lcd.clear();
}
*/
void Credits(){
lcd.clear();
Intestazione();
Versione(4,1);
delay(1500);
lcd.clear();
Intestazione();
lcd.setCursor(0,2);
lcd.print(F(" Idea Originale:"));
delay(1000);
lcd.setCursor(0,3);
lcd.print(F(" Stephen Mathison"));
delay(1500);
lcd.setCursor(0,2);
lcd.print(F(" Modifica FW: "));
delay(1000);
lcd.setCursor(0,3);
lcd.print(F(" Mike Wilson "));
delay(1250);
lcd.setCursor(0,3);
lcd.print(F(" Massimo Nevi "));
delay(1250);
lcd.clear();
lcd.setCursor(0,1);
lcd.print(F("RIPROGETTAZIONE"));
lcd.setCursor(0,2);
lcd.print(F(" ITALIANA"));
delay(1500);
lcd.clear();
Intestazione();
// lcd.setCursor(0,2);
// lcd.print(F("Disegno PCB: "));
// delay(750);
lcd.setCursor(0,3);
lcd.print(F("DanielXan "));
delay(800);
// lcd.setCursor(0,2);
// lcd.print(F("Collaudo PCB:"));
// delay(750);
lcd.setCursor(0,3);
lcd.print(F("SavioThechnic"));
delay(800);
// lcd.setCursor(0,2);
// lcd.print(F("Collaudo FW: "));
// delay(750);
lcd.setCursor(0,3);
lcd.print(F("A. Tidei "));
delay(800);
lcd.setCursor(0,3);
lcd.print(F("D. Arzarello "));
delay(800);
lcd.setCursor(0,3);
lcd.print(F("L. Di Michele"));
delay(800);
Clear_2_3();
}
void UnitSet(int unitSet, byte i){
switch(i){
case(0):// Scala Temp
lcd.setCursor(17,2);
if (unitSet==0)lcd.write(8);
else lcd.write(1);
break;
case(1)://Sensore
lcd.setCursor(11,2);
if (unitSet==0)lcd.print(F("Interno "));
else lcd.print(F("Esterno "));
break;
case(2):// Temperatura di Ebollizione °C
lcd.setCursor(14,2);
if (unitSet<100)Riga1();
lcd.print(unitSet);
lcd.write(8);
break;
case(3):// Temperatura di Ebollizione °F
lcd.setCursor(14,2);
if (unitSet<100)Riga1();
lcd.print(unitSet);
lcd.write(1);
break;
case(4):// Durata Ciclo Pompa
lcd.setCursor(15,2);
if (unitSet<10)Riga1();
lcd.print(unitSet);
lcd.print(F("'"));
break;
case(5)://Durata Pausa Pompa
lcd.setCursor(16,2);
lcd.print(unitSet);
lcd.print(F("'"));
break;
case(6):
lcd.setCursor(16,2);
if (unitSet==0)lcd.print(F("OFF"));
if (unitSet==1)lcd.print(F(" ON"));
break;
case(7):
lcd.setCursor(15,2);
if (unitSet<100)Riga1();
lcd.print(unitSet);
Gradi();
}
}
void StageSet(float Temp){
lcd.setCursor(11,2);
if (Temp<10)Riga2();
if (Temp<100)Riga1();
lcd.print(Temp); //** check -mdw
Gradi();
}
void TimeSet(int Time){
lcd.setCursor(11,2);
if (Time<10)Riga5();
if (Time>=10 && Time<100)Riga4();
if (Time>=100)Riga3();
lcd.print(Time);
lcd.print(F("'"));
}
void NumHops(byte SetNumHops){
lcd.setCursor(16,2);
if(SetNumHops<10)Riga1();
lcd.print(SetNumHops);
}
void TimeHops(int Time){
lcd.setCursor(14,2);
if (Time<10)Riga2();
if (Time>=10 && Time<100)Riga1();
lcd.print(Time);
lcd.print(F("'"));
}
void Pause_Stage(float Temp, int Time){
lcd.setCursor(0,0);
lcd.print(F("------ ------"));
lcd.setCursor(0,1);
if (Ciclo<100)Riga20();
else lcd.print(F(" In Pausa " ));
lcd.setCursor(0,2);
lcd.print(F("----- -----"));
lcd.setCursor(6,0);
if (Temp<100)Riga1();
if (Temp<10)Riga2();
lcd.print(Temp);
Gradi();
CountDown(Time,6,2,2);
lcd.setCursor(0,3);
lcd.print(F(" --- --- Esci --- "));
Ciclo++;
if (Ciclo>250)Ciclo=0;
}
void prompt_for_water (){
lcd.setCursor(0,1);
lcd.print(F(" Acqua aggiunta? "));
lcd_OkEsci();
Buzzer(1,750);
}
void Resume(){
lcd.setCursor(0,1);
lcd.print(F(" Riprendi Cotta? "));
lcd_OkEsci();
Buzzer(1,750);
}
void CntDwn(int Time){
CountDown(Time,11,2,2);
}
void PausaPompa(float Temp, int Time){
if (Ciclo>=275){
Buzzer(2,35);
Ciclo=0;
}
lcd.setCursor(2,1);
if (Temp<100)Riga1();
lcd.print(Temp);
Gradi();
CountDown(Time,11,2,2);
lcd.setCursor(0,3);
lcd.print(F(" -- Pausa Pompa -- "));
Ciclo++;
}
void Iodine(float Temp, int Time){
lcd.setCursor(0,0);
lcd.print(F("------ ------"));
lcd.setCursor(0,1);
if (Ciclo<75)lcd.print(F(" TEST IODIO " ));
else lcd.print(F(" Test Iodio " ));
lcd.setCursor(1,2);
lcd.print(F("---- ----"));
lcd.setCursor(6,0);
if (Temp<100)Riga1();
if (Temp<10)Riga2();
lcd.print(Temp);
Gradi();
CountDown(Time,6,2,2);
lcd.setCursor(0,3);
lcd.print(F(" --- --- OK --- "));
Ciclo++;
if (Ciclo>150)Ciclo=0;
}
void End(){
lcd.clear();
Buzzer(3,250);
lcd.setCursor(0,1);
lcd.print(F(" La tua birra "));
lcd.setCursor(0,2);
lcd.print(F(" e' pronta! "));
Buzzer(1,3000);
delay(2500);
}
void PumpPrime(){
lcd.setCursor(0,1);
lcd.print(F(" Attivo Pompa ")); // priming the pump
}
void ledHeatON(){
lcd.setCursor(0,2);
lcd.write(5);
}
void ledHeatOFF(){
lcd.setCursor(0,2);
lcd.write(4);
}
void ledHeatStatus(){
lcd.setCursor(0,2);
Riga1();
}
void ledPumpON(){
lcd.setCursor(19,2);
lcd.write(3);
}
void ledPumpOFF(){
lcd.setCursor(19,2);
Riga1();
}
void Presentazione(){
Presentazione(2,1);
}
void ArdBir(){
ArdBir1(2,1);
}