-
Notifications
You must be signed in to change notification settings - Fork 0
/
fermenticle.ino
64 lines (51 loc) · 1.18 KB
/
fermenticle.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
#include "TempController.h"
#include "GlobalOneWire.h"
#include "OneWireAddress.h"
#include "Temperature.h"
#include "DeviceList.h"
#include "GUI.h"
#include "TFT.h"
#include "EEPROM_Manager.h"
SYSTEM_MODE(SEMI_AUTOMATIC);
bool SYSTEM_STARTED = false;
// Loop for updating Temperature Sensors
void temperatureLoop() {
tempSensorMgr.updateSensors();
}
void peakLoop() {
tempController.updateFilteredTemperatures();
tempController.detectPeaks();
tempController.updateSettings();
}
void stateLoop() {
tempController.updateState();
tempController.logToSerial();
tempController.updateOutputs();
}
void slopeLoop() {
tempController.updateSlope();
}
Timer tempSensorTimer(5000, temperatureLoop);
Timer peakTimer(10000, peakLoop);
Timer stateTimer(1000, stateLoop);
Timer slopeTimer(60000, slopeLoop);
void setup(void) {
init_eeprom();
init_tft();
gui.splash();
Wire.begin();
Serial.begin(9600);
tempController.init();
Particle.connect();
tempSensorTimer.start();
peakTimer.start();
stateTimer.start();
slopeTimer.start();
}
void loop(void) {
if (!SYSTEM_STARTED)
waitFor(Particle.connected, 30000);
SYSTEM_STARTED = true;
gui.update();
delay(100);
}