-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAquaduino2.ino
8393 lines (7673 loc) · 245 KB
/
Aquaduino2.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
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
//Aquaduino
// v.1.1 - 21.08.15
// v.1.2 - 05.09.15
// v.1.3 - 12.09.15 - PWM Dimmung angepasst an MOSFET Steuerung hinter dem Netzteil
// v.1.3.1 - 25.09.15 - fixed a Bug in LightCalculation (false values when now.minute == nextlight.minute)
// v.1.3.2 - 04.10.2015 - feed Mode - ScreenUpdate AFTER switching Lights
// v.1.4 - 04.10.2015 - initial TVMode implemented
// v.1.4.1 - 13.10.2015 - started to implement LightModes for RGB
// v.1.4.2 - 17.10.2015 - RGB visualisation ready
// v.1.4.3 - 18.10.2015 - RGB finalized
// v.1.5 - 04.11.2015 - added PH Curve
// v.1.5.1 - 05.11.2015 - bugfixing
// v.1.5.2 - 07.11.2015 - bugfixing | implementing TempCurve
// v.1.5.3 - 21.11.2015 - implement MoonMode
// v.1.7.0 - 23.02.2016 - use less memory
// v.2.0.0(b) - 26.02.2016 - less f() macro - made troubles I never found. Bugfixing. First full working build with ESP connect.
// v.2.0.1 - 04.03.2016 - bugfixing
// v.2.0.2 - 10.03.2016 - sendSerial with and without Feedback - choose your weapons
// v.2.0.3 - 19.03.2016 - fixed RGBLight while feeding; better DrawCurve - PH & Temperature Curve
// v.2.0.4 - 20.03.2016 - implemented Refillbeep (beeper, beepnow, getDistance()
// v.2.0.5 - 25.03.2016 - compleded filling level routine, fixed lag in FeedMode, implemented Calibration Mode, reworked PH-Measurements
// v.2.0.7 - 30.04.2016 - changed the point where CO2 turns on/off, minor tweak in Filling, Forget HighLow Values in drawCurve
// v.2.0.8 - 01.07.2016 - added support of 12V Fans to cool the tank
// v.2.0.9 - 01.07.2016 - bugfixing - fan turned on and off when temp == tempUpperlimit
// v.2.1.0 - 06.11.2016 - bring the PH/Temp/Co2 to the Web (in progress)
// v.2.1.1 - 16.11.2016 - PH/TEMP/CO2/Fertilizer and WaterDistance to Webinterface
// v.2.1.2 - 08.12.2016 - changed rate PH can turn on/off to 15 minutes (from 60 seconds)
// v.2.1.3 - 28.12.2016 - ported to Sloeber - EclipseIDE (single File, minor changes)
// v.2.1.4 - 15.01.2016 - minor Tweak in ESP - Arduino Communication / begin to add Webiterface Funtionality
// v.2.1.5 - 16.01.2016 - PowerLight Communicating well - still much work to do
// v.2.1.6 - 23.01.2016 - PowerLight / Co2 working. Reading and saving LightScenes in progress
// v.2.1.7 - 05.02.2016 - Sendng More Data via Serial
// v.2.2.0 - 23.09.2017 - Send and Recive everything (important) via Serial - Done
// v.2.2.1 - 24.09.2017 - bugfix
//#include <ctype.h>
//#include <HardwareSerial.h>
//#include <stdint.h>
//#include <stdlib.h>
//#include <string.h>
//#include <avr/pgmspace.h>
//#include <WString.h>
//#include <pins_arduino.h>
//#include <Print.h>
//needed Libraries
#include <Arduino.h>
#include <DallasTemperature.h> //needed for Temp
#include <OneWire.h> //needed for Temp
#include <RCSwitch.h>
#include <sx1509_library.h> // Include the SX1509 library (port expander)
#include <UTFT.h> //TFT
#include <UTouch.h> //Touch
#include <Wire.h> // Wire.h library is required to use SX1509 lib
#include "RTClib.h" //real time clock
#include "SdFat.h" //SD Card
#include <tinyFAT.h> // used to acess the SD card
#define ONE_WIRE_BUS 10 //needed for Temperature
#include <EEPROM.h> // used to store and retrieve settings from memory
#include <UTFT_SdRaw.h> // used to read .raw images from the SD card
#include <avr/wdt.h> //watchdog
#include <NewPing.h> //ultasonic range
#define PING_PIN 18 // Arduino pin for both trig and echo
#define debug 0
// Declare which fonts we will be using
extern uint8_t BigFont[];
extern uint8_t UbuntuBold[];
extern uint8_t SevenSegmentFull[];
extern uint8_t OCR_A_Extended_M[];
//bring it up - initialise
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
UTFT myGLCD(ITDB50, 38, 39, 40, 41); //initialize TFT
UTouch myTouch(6, 5, 4, 3, 2); //initialize TFT
UTFT_SdRaw myFiles(&myGLCD);
RCSwitch mySwitch = RCSwitch();
NewPing sonar(PING_PIN, PING_PIN, 80); //80 is max measure in cm
/* VARIABLEN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alle globale Variablen - teilweise mit Startweten definiert
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#define progMemBuffer 128
enum
{
tPhWert,
tTemp,
tcalculatedPWM,
tcalculatedRed,
tcalculatedGreen,
tcalculatedBlue,
tTVModeState,
tcleaningInProcess,
tmanualOverride,
tMoonModeState,
tpump1Value,
tpump2Value,
tlight230Value,
tlight1Value,
tlight2Value,
tco2Value,
theaterValue,
tpowLightON,
tpowLightOFF,
tpowCO2ON,
tcoolValue,
tnow,
tpS,
tpF,
tpR,
tpB,
tpP,
tcalculatedPWMnF,
tcalculatedRednF,
tcalculatedGreennF,
tcalculatedBluenF,
tPHValues,
tTempValues,
tCo2Values,
tnpkFert,
tnFert,
tfeFert,
tdst,
tpowCO2OFF,
tLightScenes,
tRgbScenes,
tfertSettings,
treminder,
tmodeSettings,
tlimits,
tCleanSettings,
tStore
};
const char PhWert_Char[] PROGMEM = "pH";
const char Temp_Char[] PROGMEM = "tE";
const char calculatedPWM_Char[] PROGMEM = "cP";
const char calculatedRed_Char[] PROGMEM = "cR";
const char calculatedGreen_Char[] PROGMEM = "cG";
const char calculatedBlue_Char[] PROGMEM = "cB";
const char TVModeState_Char[] PROGMEM = "tV";
const char cleaningInProcess_Char[] PROGMEM = "cI";
const char manualOverride_Char[] PROGMEM = "mO";
const char MoonModeState_Char[] PROGMEM = "mM";
const char pump1Value_Char[] PROGMEM = "p1";
const char pump2Value_Char[] PROGMEM = "p2";
const char light230Value_Char[] PROGMEM = "lV";
const char light1Value_Char[] PROGMEM = "l1";
const char light2Value_Char[] PROGMEM = "l2";
const char co2Value_Char[] PROGMEM = "cO";
const char heaterValue_Char[] PROGMEM = "hV";
const char powLightON_Char[] PROGMEM = "pLON";
const char powLightOFF_Char[] PROGMEM = "pLOF";
const char powCO2ON_Char[] PROGMEM = "pCON";
const char coolValue_Char[] PROGMEM = "cV";
const char now_Char[] PROGMEM = "nO";
const char processSlide_Char[] PROGMEM = "pS";
const char processRF_Char[] PROGMEM = "pF";
const char processRel_Char[] PROGMEM = "pR";
const char processBool_Char[] PROGMEM = "pB";
const char processPump_Char[] PROGMEM = "pP";
const char calculatedPWMnF_Char[] PROGMEM = "nP"; //PWM White without feedback
const char calculatedRednF_Char[] PROGMEM = "nR"; //red withouth feedback
const char calculatedGreennF_Char[] PROGMEM = "nG"; //green withouth feedback
const char calculatedBluenF_Char[] PROGMEM = "nB"; //blue withouth feedback
const char PHValues_Char[] PROGMEM = "phS";
const char TempValues_Char[] PROGMEM = "tS";
const char Co2Values_Char[] PROGMEM = "cS";
const char npkFert_Char[] PROGMEM = "npkF";
const char nFert_Char[] PROGMEM = "nF";
const char feFert_Char[] PROGMEM = "feF";
const char dst_Char[] PROGMEM = "dst";
const char powCO2OFF_Char[] PROGMEM = "pCOF";
const char lightScenes_Char[] PROGMEM = "lSc";
const char rgbScenes_Char[] PROGMEM = "cSc";
const char fertSettings_Char[] PROGMEM = "fSe";
const char reminder_Char[] PROGMEM = "Rem";
const char modeSettings_Char[] PROGMEM = "mSe";
const char limits_Char[] PROGMEM = "Lim";
const char cleanSettings_Char[] PROGMEM = "cLs";
const char store_Char[] PROGMEM = "str";
PGM_P const Char_table[] PROGMEM =
{PhWert_Char, Temp_Char, calculatedPWM_Char, calculatedRed_Char, calculatedGreen_Char, calculatedBlue_Char, TVModeState_Char,
cleaningInProcess_Char, manualOverride_Char, MoonModeState_Char, pump1Value_Char, pump2Value_Char,
light230Value_Char, light1Value_Char, light2Value_Char, co2Value_Char, heaterValue_Char,
powLightON_Char, powLightOFF_Char, powCO2ON_Char, coolValue_Char, now_Char, processSlide_Char, processRF_Char, processRel_Char,
processBool_Char, processPump_Char, calculatedPWMnF_Char, calculatedRednF_Char, calculatedGreennF_Char, calculatedBluenF_Char, PHValues_Char,
TempValues_Char, Co2Values_Char, npkFert_Char, nFert_Char, feFert_Char, dst_Char, powCO2OFF_Char, lightScenes_Char, rgbScenes_Char, fertSettings_Char,
reminder_Char, modeSettings_Char, limits_Char, cleanSettings_Char, store_Char
};
int charCount = sizeof(Char_table) / sizeof(Char_table[0]);
const byte numChars = 255;
char receivedChars[numChars];
static byte ndx = 0;
boolean newData = false;
unsigned long currentMillis; // get current millis
unsigned long prevMillisTouch = 0;
unsigned long prevMillis1sec = 0; //track 1 second
unsigned long prevMillis5sec = 0; // track 5 seconds for refreshing clock and temp
unsigned long prevMillis1min = 0; // track 60 seconds for refreshing
unsigned long prevMillis15min = 0; //track 15 minutes
// unsigned long stopMillis = 0; //stopwatch
//unsigned long standbyMillis=0;
RTC_DS1307 rtc;
const byte SX1509_ADDRESS = 0x3E;
sx1509Class sx1509(SX1509_ADDRESS);
const byte interruptPin = 2;
const byte resetPin = 8;
DateTime now;
DateTime cleanEnd;
DateTime adjustTimer;
DateTime lastFert;
DateTime tankClean;
byte tankCleandDays;
DateTime co2Bottle;
byte co2BottleDays;
DateTime cleanFilter1;
byte cleanFilter1Days;
DateTime cleanFilter2;
byte cleanFilter2Days;
DateTime TVModeStart;
boolean TVModeState = false;
float TVModeBrightness; // (20%)
DateTime MoonEnd;
boolean MoonModeState = false;
byte MoonRed;
byte MoonGreen;
byte MoonBlue;
byte MoonMinutes;
int x, y; //touched coordinates
//int x2, y2;
String inputstring = ""; //a string to hold incoming data from the PC
String PhWertString = ""; //a string to hold the data from the Atlas Scientific product
boolean calibrate = false;
float PhWert = 7.01; //sting to float to calculate with it
float PHUpperLimit = 10;
float PHLowerLimit = 5;
float PHValues[96];
float TempValues[96];
float highestTemp = 26.05;
float lowestTemp = 25.95;
float highestPH = 7.01;
float lowestPH = 6.99;
boolean Co2Values[96]; //tracks if the CO2 enabled or disabled at that time
byte put_PHindex = 0;
byte put_TempIndex = 0;
byte get_index = 1;
/**<datatype> array [DIM_0_SIZE] [DIM_1_SIZE] = {
//as many vals as dim1
{val,val,val},
{val,val,val}//as many rows as dim0
};
**/
boolean input_stringcomplete = false; //have we received all the data from the PC
boolean sensor_stringcomplete = false; //have we received all the data from the Atlas Scientific product
float Temp = 25.01; //sting to float to calculate with it
float TempUpperLimit = 30;
float TempLowerLimit = 25;
//Fertilizer Stuff
float FDose[] =
{
0, 0, 0
};
float FMax[] =
{
0, 0, 0
};
float FLeft[] =
{
0, 0, 0
};
float FRate[] =
{
0, 0, 0
};
byte FSelect = 5;
unsigned long fertmillis = 0;
boolean MoF[] =
{
false, false, false
};
boolean TuF[] =
{
false, false, false
};
boolean WeF[] =
{
false, false, false
};
boolean ThF[] =
{
false, false, false
};
boolean FrF[] =
{
false, false, false
};
boolean SaF[] =
{
false, false, false
};
boolean SuF[] =
{
false, false, false
};
boolean dayN[7] =
{
false, false, false, false, false, false, false
};
boolean dayNPK[7] =
{
false, false, false, false, false, false, false
};
boolean dayFE[7] =
{
false, false, false, false, false, false, false
};
byte doseHour;
byte doseMinute;
//Powerschedule
byte powLightOnHour;
byte powLightOnMinute;
byte powLightOffHour;
byte powLightOffMinute;
byte powCo2OnHour;
byte powCo2OnMinute;
byte powCo2OffHour;
byte powCo2OffMinute;
byte screenOnHour;
byte screenOnMinute;
byte screenOffHour;
byte screenOffMinute;
byte standByMinutes = 10;
byte backlightPWM = 255; // value for backlight - 255 is full
int highestWaterDistance = 0;
float waterDistance = 0;
int lastWaterDistance = 0;
boolean beepActive = false;
int speakerPin = A8;
boolean beep = false;
byte counter = 0;
int freq = 0;
unsigned long milliSecondsToBeep = 0;
byte repeat = 0;
unsigned long beepWait = 0;
/*
byte tankCleanMonth;
byte tankCleanDay;
byte co2BottleMonth;
byte co2BottleDay;
byte cleanFilter1Month;
byte cleanFilter1Day;
byte cleanFilter2Month;
byte cleanFilter2Day;
*/
//days and month char for displaing at the top of screen
const char *dayName[] =
{
"Sonntag",
"Montag",
"Dienstag",
"Mittwoch",
"Donnerstag",
"Freitag",
"Samstag"
};
const char *monthName[] =
{
"",
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
};
const byte light2Pin = 1;
const byte light1Pin = 11; //not active
const byte dPump2Pin = 6;
const byte dPump1Pin = 7;
const byte dPump3Pin = 5;
const byte fanPin = 3;
const byte redPin = 12;
const byte greenPin = 13;
const byte bluePin = 11;
/**
byte heaterPin = 12; //will be RF
byte coolPin = 11; //will be RF
byte co2Pin = 10; //will be RF
byte pump1Pin = 13; //not used anymore RF now
byte pump2Pin = 14; //not used anymore RF now
byte light230Pin = 15; //not used anymore RF now
**/
boolean pump1Value = false;
boolean pump2Value = false;
boolean light230Value = true;
boolean light1Value = true;
boolean light2Value = true;
boolean co2Value = true;
boolean heaterValue = false;
boolean dPump1Value = true;
boolean dPump2Value = true;
boolean dPump3Value = true;
boolean coolValue = true;
//boolean fanValue = true;
boolean pump1Clean = true;
boolean pump2Clean = true;
boolean light230Clean = true;
boolean light2Clean = true;
boolean co2Clean = true;
boolean heaterClean = true;
boolean coolClean = true;
byte cleanMinutes = 120;
boolean changeRF = false;
// Used for PWM and lightstuff
TimeSpan timeSinceLastLight;
TimeSpan timeToNextLight;
TimeSpan timeSinceLastLightRGB;
TimeSpan timeToNextLightRGB;
byte currentPWM = 0; //0 - which is NO light
byte nextPWM = 0;
const byte lightPwmPin = 9; //the pin used for pwm
float calculatedPWM = 0; //the value
float calculatedRed = 0;
float calculatedGreen = 0;
float calculatedBlue = 0;
const byte backlightPIN = 44; // Pin 44 used for backlight
byte dispScreen = 0; //current screen at start
byte lastScreen = 255; //last screen
// screens are listed below
// 0-home, 1-cleaning, , 2-power, 3-extras, 4-lights,
// 5-clock, 6-feeding sched, 7-schedule, 8-heater
// 9-dosing, 10-pwer schedule, 11-schedule item, 13=ScreenScreen
//
//funkzeug
const unsigned long f11on = 1381717; //Pump1 ON
const unsigned long f11off = 1381716; //Pump1 OFF
const unsigned long f12on = 1394005;
const unsigned long f12off = 1394004;
const unsigned long f13on = 1397077; //MainLight ON
const unsigned long f13off = 1397076; //MainLight OFF
const unsigned long f14on = 1397845;
const unsigned long f14off = 1397844;
const unsigned long f21on = 4527445; //Heater ON
const unsigned long f21off = 4527444; //Heater FOFF
const unsigned long f22on = 4539733; //CO2 ON
const unsigned long f22off = 4539732; //CO2 OFF
const unsigned long f23on = 4542805; //Coolpump ON
const unsigned long f23off = 4542804; //Coolpump OFF
const unsigned long f24on = 4543573; //Pump2 ON
const unsigned long f24off = 4543572;
const unsigned long f31on = 5313877;
const unsigned long f31off = 5313876;
const unsigned long f32on = 5326165;
const unsigned long f32off = 5326164;
const unsigned long f33on = 5329237;
const unsigned long f33off = 5329236;
const unsigned long f34on = 5330005;
const unsigned long f34off = 5330004;
const unsigned long f41on = 5510485;
const unsigned long f42on = 5522773; //Pump2 ON
const unsigned long f42off = 5522772; //Pump2 Off
const unsigned long f43on = 5525845;
const unsigned long f43off = 5525844;
const unsigned long f44on = 5526613;
const unsigned long f44off = 5526612;
boolean cleaningInProcess = false;
boolean manualOverride = false;
//byte pwmDateAndValue[]={21,0,0,7,0,0,7,20,100,11,50,100,12,00,0,15,50,0,16,00,100,20,40,100};
typedef struct
{
byte Hour;
byte Minute;
float pwmValue;
} record_type;
record_type lightPWM[12];
byte lightScreenSet = 99;
byte RGBScreenSet = 99;
typedef struct
{
byte Hour;
byte Minute;
byte red;
byte green;
byte blue;
} recordRGB_type;
recordRGB_type lightRGB[12];
struct RGB
{
byte r;
byte g;
byte b;
};
typedef struct RGB Color;
//Farben
const Color col_white =
{
255, 255, 255
};
const Color col_black =
{
255, 255, 255
};
const Color col_blue =
{
0, 0, 255
};
const Color col_red =
{
255, 0, 0
};
const Color col_FertiN =
{
45, 90, 255
};
const Color col_FertiNPK =
{
25, 191, 13
};
const Color col_FertiFE =
{
204, 17, 17
};
//Buttonkoordinaten Home
const short Button1Cord[] =
{
0, 0, 0, 0
};
const short HomeButtonCoord[] =
{
21, 613, 117, 710
};
const short FeedButtonCoord[] =
{
133, 613, 230, 710
};
const short PowerButtonCoord[] =
{
249, 613, 346, 710
};
const short SettingsButtonCoord[] =
{
362, 613, 458, 710
};
const short LightUp[] =
{
60, 320, 108, 368
};
const short LightDown[] =
{
60, 450, 108, 498
};
const short BottomButtonCoord[] =
{
215, 746, 263, 795
}; //used @ all screens
//Powerbuttoncords
const short Filter1Cord[] =
{
20, 150, 94, 224
};
const short Filter2Cord[] =
{
250, 150, 324, 224
};
const short Ligth1Cord[] =
{
20, 234, 94, 308
};
const short Light2Cord[] =
{
250, 234, 324, 308
};
const short Co2Cord[] =
{
20, 318, 94, 392
};
const short HeaterCord[] =
{
250, 318, 324, 392
};
const short CoolingCord[] =
{
20, 402, 94, 476
};
const short AllOFFCord[] =
{
20, 524, 94, 598
};
const short ResetCord[] =
{
20, 608, 94, 682
};
const short CleanModeCord[] =
{
250, 524, 324, 598
};
const short SpeakerCord[] =
{
250, 608, 324, 682
};
//Settingbuttoncords
const short PowerSchedCord[] =
{
68, 150, 142, 224
};
const short LightsCord[] =
{
158, 150, 232, 224
};
const short CleanCord[] =
{
248, 150, 322, 224
};
const short ScheCord[] =
{
338, 150, 412, 224
};
const short ClockCord[] =
{
68, 240, 142, 314
};
const short Co2SetCord[] =
{
158, 240, 232, 314
};
const short HeatCord[] =
{
248, 240, 322, 314
};
const short DoseCord[] =
{
338, 240, 412, 314
};
const short ScreenCord[] =
{
68, 330, 142, 404
};
const short RGBCord[] =
{
158, 330, 232, 404
};
const short TVModeCord[] =
{
248, 330, 322, 404
};
const short MoonModeCord[] =
{
338, 330, 412, 404
};
/** more buttons if needed
*/
//Clockbuttoncords
const short HourUp[] =
{
175, 220, 223, 268
};
const short HourDown[] =
{
175, 273, 223, 321
};
const short MinuteUp[] =
{
347, 220, 395, 268
};
const short MinuteDown[] =
{
347, 273, 395, 321
};
const short DayUp[] =
{
110, 391, 158, 439
};
const short DayDown[] =
{
110, 444, 158, 492
};
const short MonthUp[] =
{
220, 391, 268, 439
};
const short MonthDown[] =
{
220, 444, 268, 492
};
const short YearUp[] =
{
380, 391, 428, 439
};
const short YearDown[] =
{
380, 444, 428, 492
};
const short SetClockCord[] =
{
156, 600, 324, 652
};
//const short ResetCord[] = {20, 608 ,94, 682};
//POWERSCHEDULE BUTTONS
const short SetPowerSchedCord[] =
{
300, 680, 465, 732
}; //also used for Light scenes
const short CancelPowerSchedCord[] =
{
22, 680, 190, 732
}; //also used for light scenes
const short powLightOnHourUp[] =
{
275, 110, 323, 158
};
const short powLightOnHourDown[] =
{
275, 163, 323, 211
};
const short powLightOnMinuteUp[] =
{
412, 110, 460, 158
};
const short powLightOnMinuteDown[] =
{
412, 163, 460, 211
};
const short powLightOffHourUp[] =
{
275, 240, 323, 288
};
const short powLightOffHourDown[] =
{
275, 293, 323, 341
};
const short powLightOffMinuteUp[] =
{
412, 240, 460, 288
};
const short powLightOffMinuteDown[] =
{
412, 293, 460, 341
};
const short powCo2OnHourUp[] =
{
275, 410, 323, 458
};
const short powCo2OnHourDown[] =
{
275, 463, 323, 511
};
const short powCo2OnMinuteUp[] =
{
412, 410, 460, 458
};
const short powCo2OnMinuteDown[] =
{
412, 463, 460, 511
};
const short powCo2OffHourUp[] =
{
275, 540, 323, 588
};
const short powCo2OffHourDown[] =
{
275, 593, 323, 641
};
const short powCo2OffMinuteUp[] =
{
412, 540, 460, 588
};
const short powCo2OffMinuteDown[] =
{
412, 593, 460, 641
};
//Light Buttons (Disp 4)
const short LightMode1Cord[] =
{
15, 135, 465, 195
}; //also used for dosing
const short LightMode2Cord[] =
{
15, 225, 465, 285
}; //also used for dosing
const short LightMode3Cord[] =
{
15, 315, 465, 375
}; //also used for dosing
const short LightMode4Cord[] =
{
15, 405, 465, 465
};
const short LightMode5Cord[] =
{
15, 495, 465, 555
};
const short LightMode6Cord[] =
{
15, 585, 465, 645
};
//Dosing Button (Disp 9)
const short refillAllCord[] =
{
110, 580, 370, 632
};
const short calibrateCord[] =
{
22, 370, 282, 422
};
//DaySched for Dosing (91,92,93)
const short MoCord[] =
{
18, 590, 66, 638
};
const short TuCord[] =
{
84, 590, 132, 638
};
const short WeCord[] =
{
150, 590, 198, 638
};
const short ThCord[] =
{
216, 590, 264, 638
};
const short FrCord[] =
{
282, 590, 330, 638
};
const short SaCord[] =
{
348, 590, 396, 638
};
const short SoCord[] =
{
414, 590, 462, 638
};
//RGBScreen
const short red1Up[] =
{
138, 240, 186, 288
};
const short red1Down[] =
{
138, 293, 186, 341
};
const short red2Up[] =
{
138, 540, 186, 588
};
const short red2Down[] =
{
138, 593, 186, 641
};
SdFat SD;
File Aquaduino;
/*EEPROM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
locations for saved settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 - FDose[0] in ml 0 is N
1 - FDose[1] in ml 1 is NPK
2 - FDose[2] in ml 2 is FE
3 - FMax[0] in ml
4 - FMax[1] in ml
5 - FMax[2] in ml
6 - FLeft[0] in ml
7 - NKPLeft in ml
8 - FLeft[2] in ml
powLightOnHour=EEPROM.read(9);
powLightOnMinute=EEPROM.read(10);
powLightOffHour=EEPROM.read(11);
powLightOffMinute=EEPROM.read(12);
powCo2OnHour=EEPROM.read(13);
powCo2OnMinute=EEPROM.read(14);
powCo2OffHour=EEPROM.read(15);
powCo2OffMinute=EEPROM.read(16);
lightPWM[0].Hour=EEPROM.read(20);
lightPWM[0].Minute=EEPROM.read(21);
lightPWM[0].pwmValue=EEPROM.read(22);
lightPWM[1].Hour=EEPROM.read(23);
lightPWM[1].Minute=EEPROM.read(24);
lightPWM[1].pwmValue=EEPROM.read(25);
lightPWM[2].Hour=EEPROM.read(26);
lightPWM[2].Minute=EEPROM.read(27);
lightPWM[2].pwmValue=EEPROM.read(28);
lightPWM[3].Hour=EEPROM.read(29);
lightPWM[3].Minute=EEPROM.read(30);
lightPWM[3].pwmValue=EEPROM.read(31);
lightPWM[4].Hour=EEPROM.read(32);
lightPWM[4].Minute=EEPROM.read(33);
lightPWM[4].pwmValue=EEPROM.read(34);
lightPWM[5].Hour=EEPROM.read(35);
lightPWM[5].Minute=EEPROM.read(36);
lightPWM[5].pwmValue=EEPROM.read(37);
lightPWM[6].Hour=EEPROM.read(38);
lightPWM[6].Minute=EEPROM.read(39);
lightPWM[6].pwmValue=EEPROM.read(40);
lightPWM[7].Hour=EEPROM.read(41);
lightPWM[7].Minute=EEPROM.read(42);
lightPWM[7].pwmValue=EEPROM.read(43);
lightPWM[8].Hour=EEPROM.read(44);
lightPWM[8].Minute=EEPROM.read(45);
lightPWM[8].pwmValue=EEPROM.read(46);
lightPWM[9].Hour=EEPROM.read(47);
lightPWM[9].Minute=EEPROM.read(48);
lightPWM[9].pwmValue=EEPROM.read(49);
lightPWM[10].Hour=EEPROM.read(50);
lightPWM[10].Minute=EEPROM.read(51);
lightPWM[10].pwmValue=EEPROM.read(52);
lightPWM[11].Hour=EEPROM.read(53);
lightPWM[11].Minute=EEPROM.read(54);
lightPWM[11].pwmValue=EEPROM.read(55);
pump1Clean=EEPROM.read(56);
pump2Clean=EEPROM.read(57);
light230Clean=EEPROM.read(58);
light2Clean=EEPROM.read(59);
co2Clean=EEPROM.read(60);
heaterClean=EEPROM.read(61);
coolClean=EEPROM.read(62);
PHUpperLimit=EEPROM.read(63);
PHLowerLimitEEPROM.read(64);
TempUpperLimit=(EEPROM.read(65));
TempLowerLimit=(EEPROM.read(66));
FRate[0]=EEPROM.read(67);
FRate[1]=EEPROM.read(68);
FRate[2]=EEPROM.read(69);
MoF[0]=EEPROM.read(70);