-
Notifications
You must be signed in to change notification settings - Fork 0
/
Setup.ino
84 lines (68 loc) · 2.04 KB
/
Setup.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
void setup(void)
{
int idx;
pinMode(RTCLK_CS, OUTPUT); // chip select pin
pinMode(COD_CLK, INPUT);
pinMode(COD_DT, INPUT);
pinMode(COD_SW, INPUT);
pinMode(RTCLK_INT, INPUT);
pinMode( BYPASS_1_F, OUTPUT);
pinMode( BYPASS_1_O, OUTPUT);
pinMode( BYPASS_2_F, OUTPUT);
pinMode( BYPASS_2_O, OUTPUT);
pinMode( VENT_CAVE, OUTPUT);
pinMode( VENT_CHEM, OUTPUT);
pinMode( V12_1_ON, OUTPUT);
pinMode( SELECT_VMC, OUTPUT);
pinMode( V12_2_ON, OUTPUT);
pinMode( SELECT_12V, OUTPUT);
digitalWrite(BYPASS_1_F ,true);
digitalWrite(BYPASS_1_O ,true);
digitalWrite(BYPASS_2_F ,true);
digitalWrite(BYPASS_2_O ,true);
digitalWrite(VENT_CAVE ,true);
digitalWrite(VENT_CHEM ,true);
digitalWrite(V12_1_ON ,true);
digitalWrite(SELECT_VMC ,true);
digitalWrite(V12_2_ON ,true);
digitalWrite(SELECT_12V ,true);
tft.begin();
delay(2000);
DS3234_init(RTCLK_CS, DS3234_INTCN);
MenuChanged = true;
RotDetect = false;
delay(1000);
/*Mise en place des interruptions pour les mouvements du codeur*/
attachInterrupt(digitalPinToInterrupt(COD_DT), RotationDetectDT, CHANGE );
attachInterrupt(digitalPinToInterrupt(COD_CLK), RotationDetectCLK, CHANGE );
attachInterrupt(digitalPinToInterrupt(COD_SW), Selection, RISING );
attachInterrupt(digitalPinToInterrupt(RTCLK_INT), RTClockInterrupt, FALLING );
/*Start des services*/
Serial.begin(9600);
SdCardPresent = SD.begin(SDCARD_CS);
tft.setRotation(1);
MenuChanged = true;
Reglage = MI_SAISON;
if (SdCardPresent)
{
ReadSeuilsFromFile();
}
else
{
DisableSD();
}
//DisableRTC(); // a implémenter si pas de RTC trouvé
ReadTime();
GotoStartMenu();
DisplayMenuScreen();
delay(1000); // à remplacer par fin de phase d'init
GotoDisplayTemp();
RotDetect = false;
SetAlarmMinutes();
Reglage = ETE;
for (idx = 1; idx < NB_TEMP ; idx ++)
{
Temperatures[idx] = ReadTemperature(PinNumber[idx]);
}
Temperatures[0] = Temperatures[1]; // Les Deux premieres températures sont la même, car on a 2 seuils pour l'exterieur
}