summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HouseControl.ino15
1 files changed, 9 insertions, 6 deletions
diff --git a/HouseControl.ino b/HouseControl.ino
index 6e6ec71..a8f7650 100644
--- a/HouseControl.ino
+++ b/HouseControl.ino
@@ -13,8 +13,6 @@
#include <EEPROM.h>
#include "EEPROM_IO.h"
-#define RECONFIGURE 0
-
/*********************************************************************************/
/* Pin definitions */
@@ -405,7 +403,8 @@ void toggleDoorControl(struct st_door *door) {
/* Setup function */
void setup() {
-#if RECONFIGURE
+ byte eepromVersion;
+
config.configVersion = 3;
config.mac[0] = 0x00;
@@ -438,10 +437,14 @@ void setup() {
config.dawn = 7;
config.dusk = 21;
- eepromWrite(0, config);
-#endif
- eepromRead(0, config);
+ eepromRead(0, eepromVersion);
+
+ if (config.configVersion > eepromVersion)
+ eepromWrite(0, config);
+
+ if (config.configVersion > 0)
+ eepromRead(0, config);
if(Ethernet.begin(config.mac) == 0) {
Ethernet.begin(config.mac, config.def_ip, config.def_gateway, config.def_netmask);