mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-04-19 09:29:39 +00:00
Added option for electric distribution system (230/400)
This commit is contained in:
@@ -8,7 +8,7 @@ bool configuration::hasConfig()
|
||||
{
|
||||
bool hasConfig = false;
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
hasConfig = EEPROM.read(EEPROM_CONFIG_ADDRESS) == EEPROM_CHECK_SUM;
|
||||
hasConfig = EEPROM.read(EEPROM_CONFIG_ADDRESS) >= 71;
|
||||
EEPROM.end();
|
||||
return hasConfig;
|
||||
}
|
||||
@@ -46,6 +46,7 @@ bool configuration::save()
|
||||
}
|
||||
|
||||
address += saveInt(address, fuseSize);
|
||||
address += saveInt(address, distSys);
|
||||
|
||||
bool success = EEPROM.commit();
|
||||
EEPROM.end();
|
||||
@@ -73,6 +74,7 @@ bool configuration::load()
|
||||
authUser = 0;
|
||||
authPass = 0;
|
||||
fuseSize = 0;
|
||||
distSys = 0;
|
||||
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
int cs = EEPROM.read(address);
|
||||
@@ -118,6 +120,9 @@ bool configuration::load()
|
||||
if(cs >= 73) {
|
||||
address += readInt(address, &fuseSize);
|
||||
}
|
||||
if(cs >= 74) {
|
||||
address += readByte(address, &distSys);
|
||||
}
|
||||
EEPROM.end();
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
char* authPass;
|
||||
|
||||
int fuseSize;
|
||||
byte distSys;
|
||||
|
||||
bool hasConfig();
|
||||
bool isSecure();
|
||||
@@ -41,7 +42,7 @@ protected:
|
||||
|
||||
private:
|
||||
const int EEPROM_SIZE = 512;
|
||||
const byte EEPROM_CHECK_SUM = 73; // Used to check if config is stored. Change if structure changes
|
||||
const byte EEPROM_CHECK_SUM = 74; // Used to check if config is stored. Change if structure changes
|
||||
const int EEPROM_CONFIG_ADDRESS = 0;
|
||||
|
||||
int saveString(int pAddress, char* pString);
|
||||
|
||||
Reference in New Issue
Block a user