I am trying to implement the EEPROMEx libray and run into a problem.
(
http://playground.arduino.cc/Code/EEPROMLoadAndSaveSettings)
In my setup() if want to see if there is a software change:
#include <Streaming.h>
#include <SoftwareSerial.h>
#define SOFTWARE_VERSION "0.1"
const int maxAllowedWrites = 200;
const int memBase = 0;
const int memCeiling = EEPROMSizeATmega328;
boolean OK = true;
int configAdress = 0;
void setup() {
configAdress = EEPROM.getAddress(sizeof(StoreStruct)); // Size of config object
OK = loadConfig(); // Try to load config
if(OK) {
Serial << "Config load" << endl;
} // If version are same resume
else {
saveConfig();
Serial << "Config save" << endl;
} // else save defaults and use them
}
And the two routines from that example adjusted to my enviroment:
bool loadConfig() {
EEPROM.readBlock(configAdress, confValue);
// for debug only
Serial << SOFTWARE_VERSION << endl;
Serial << confValue.softwareVersion << endl;
//
return (confValue.softwareVersion == SOFTWARE_VERSION);
}
void saveConfig() {
EEPROM.writeBlock(configAdress, confValue);
}
Althoug both version are the same, saveConfig() is called always.