-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoadParameters.ino
More file actions
48 lines (48 loc) · 919 Bytes
/
LoadParameters.ino
File metadata and controls
48 lines (48 loc) · 919 Bytes
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
// ************************************************
// Load parameters from EEPROM
// ************************************************
void LoadParameters()
{
// Load from EEPROM
phset = EEPROM_readDouble(pHAddress);
tempset = EEPROM_readDouble(tempAddress);
Kp = EEPROM_readDouble(KpAddress);
Ki = EEPROM_readDouble(KiAddress);
Kd = EEPROM_readDouble(KdAddress);
heat = EEPROM_readDouble(heatAddress);
amplitude = EEPROM_readDouble(amplitudeAddress);
frequency = EEPROM_readDouble(frequencyAddress);
// Use defaults if EEPROM values are invalid
if (isnan(phset))
{
phset = 8.1;
}
if (isnan(tempset))
{
tempset = 20;
}
if (isnan(Kp))
{
Kp = 100000;
}
if (isnan(Ki))
{
Ki = 0;
}
if (isnan(Kd))
{
Kd = 0;
}
if (isnan(heat))
{
heat = 0;
}
if (isnan(amplitude))
{
amplitude = 0;
}
if (isnan(frequency))
{
frequency = 0;
}
}