File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,11 @@ void SettingsStorage::begin() {
21
21
if (strncmp (this ->storage .configVersion , CONFIG_VERSION, CONFIG_VERSION_LENGTH) != 0 ) {
22
22
// If you don't see this message, add a delay() to make sure the serial port
23
23
// is initialized
24
+ delay (100 );
25
+
24
26
DEBUG.println (" SettingsStorage::begin: no settings found in EEPROM. Storing defaults!" );
25
27
// no config found - write default config from header file into EEPROM
26
- memcpy (this ->storage .configVersion , CONFIG_VERSION, CONFIG_VERSION_LENGTH);
27
- EEPROM.put (CONFIG_DATA_OFFSET, this ->storage );
28
+ EEPROM.put (CONFIG_DATA_OFFSET, this ->defaultSettings );
28
29
EEPROM.commit ();
29
30
}
30
31
// Load config from EEPROM
Original file line number Diff line number Diff line change @@ -52,12 +52,16 @@ class SettingsStorage {
52
52
double currentTemperature = 0 ;
53
53
double pidOutput = 0 ;
54
54
55
- SettingsStorage::PidSettings storage = {
55
+ SettingsStorage::PidSettings storage;
56
+
57
+ SettingsStorage::PidSettings defaultSettings = {
56
58
.desiredTemperature = DEFAULT_HEATER_TEMP,
57
59
.tempOffset = 0 ,
58
60
.kp = DEFAULT_HEATER_KP,
59
61
.ki = DEFAULT_HEATER_KI,
60
- .kd = DEFAULT_HEATER_KD
62
+ .kd = DEFAULT_HEATER_KD,
63
+ // TODO: duplicated from above
64
+ .configVersion = " 124" ,
61
65
};
62
66
63
67
void store (double value, double * target);
You can’t perform that action at this time.
0 commit comments