Compare commits
No commits in common. "c24829ed70ca30a533e0bad238e5dbc715edc6b0" and "22a62e3d1e88e258fd9d4a5a4c2cf5838d78e0d2" have entirely different histories.
c24829ed70
...
22a62e3d1e
@ -254,10 +254,6 @@
|
|||||||
<td>Hostname</td>
|
<td>Hostname</td>
|
||||||
<td>%HOSTNAME%</td>
|
<td>%HOSTNAME%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>Device-ID</td>
|
|
||||||
<td>%DEVICENAME_ID%</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Battery Voltage</td>
|
<td>Battery Voltage</td>
|
||||||
<td>%BAT_VOLTAGE%V</td>
|
<td>%BAT_VOLTAGE%V</td>
|
||||||
|
@ -293,7 +293,7 @@ void Debug_printHelp()
|
|||||||
{
|
{
|
||||||
char buff[64];
|
char buff[64];
|
||||||
|
|
||||||
for (unsigned int i = sizeof(helpCmd) / 63; i < sizeof(helpCmd) / 63; i++)
|
for (int i = sizeof(helpCmd) / 63; i < sizeof(helpCmd) / 63; i++)
|
||||||
{
|
{
|
||||||
memcpy_P(buff, (helpCmd + (i * 63)), 63);
|
memcpy_P(buff, (helpCmd + (i * 63)), 63);
|
||||||
buff[63] = 0;
|
buff[63] = 0;
|
||||||
|
@ -75,12 +75,12 @@ void EEPROM_Process()
|
|||||||
|
|
||||||
void StoreConfig_EEPROM()
|
void StoreConfig_EEPROM()
|
||||||
{
|
{
|
||||||
if (eeAvailable == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ConfigData.checksum = 0;
|
ConfigData.checksum = 0;
|
||||||
ConfigData.checksum = Checksum_EEPROM((uint8_t *)&ConfigData, sizeof(ConfigData));
|
ConfigData.checksum = Checksum_EEPROM((uint8_t *)&ConfigData, sizeof(ConfigData));
|
||||||
|
|
||||||
|
if (eeAvailable == false)
|
||||||
|
return;
|
||||||
|
|
||||||
ee.updateBlock(startofConfigData, (uint8_t *)&ConfigData, sizeof(ConfigData));
|
ee.updateBlock(startofConfigData, (uint8_t *)&ConfigData, sizeof(ConfigData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +111,9 @@ void GetConfig_EEPROM()
|
|||||||
|
|
||||||
void StorePersistence_EEPROM()
|
void StorePersistence_EEPROM()
|
||||||
{
|
{
|
||||||
|
PersistenceData.checksum = 0;
|
||||||
|
PersistenceData.checksum = Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData));
|
||||||
|
|
||||||
if (eeAvailable == false)
|
if (eeAvailable == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -119,9 +122,6 @@ void StorePersistence_EEPROM()
|
|||||||
else
|
else
|
||||||
PersistenceData.writeCycleCounter++;
|
PersistenceData.writeCycleCounter++;
|
||||||
|
|
||||||
PersistenceData.checksum = 0;
|
|
||||||
PersistenceData.checksum = Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData));
|
|
||||||
|
|
||||||
ee.updateBlock(globals.eePersistanceAdress, (uint8_t *)&PersistenceData, sizeof(PersistenceData));
|
ee.updateBlock(globals.eePersistanceAdress, (uint8_t *)&PersistenceData, sizeof(PersistenceData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,6 @@ void FormatConfig_EEPROM()
|
|||||||
Serial.println("Formatting Config-Partition");
|
Serial.println("Formatting Config-Partition");
|
||||||
ConfigData = ConfigData_defaults;
|
ConfigData = ConfigData_defaults;
|
||||||
StoreConfig_EEPROM();
|
StoreConfig_EEPROM();
|
||||||
GetConfig_EEPROM();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormatPersistence_EEPROM()
|
void FormatPersistence_EEPROM()
|
||||||
@ -171,9 +170,8 @@ void FormatPersistence_EEPROM()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Serial.println("Formatting Persistance-Partition");
|
Serial.println("Formatting Persistance-Partition");
|
||||||
PersistenceData = {0};
|
memset(&PersistenceData, 0, sizeof(PersistenceData));
|
||||||
StorePersistence_EEPROM();
|
StorePersistence_EEPROM();
|
||||||
GetPersistence_EEPROM();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovePersistencePage_EEPROM(boolean reset)
|
void MovePersistencePage_EEPROM(boolean reset)
|
||||||
@ -279,7 +277,7 @@ bool ValidateEEPROM_Version()
|
|||||||
|
|
||||||
if (EEPROMVersionOnChip < ConfigData_defaults.EEPROM_Version)
|
if (EEPROMVersionOnChip < ConfigData_defaults.EEPROM_Version)
|
||||||
{
|
{
|
||||||
Serial.printf("EEPROM Image Version is %d, but %d expected - trying to migrate\n", EEPROMVersionOnChip, ConfigData_defaults.EEPROM_Version);
|
Serial.printf("EEPROM Image Version is %d, but %d expected - trying to migrate\n");
|
||||||
if (!MigrateEEPROM(EEPROMVersionOnChip))
|
if (!MigrateEEPROM(EEPROMVersionOnChip))
|
||||||
{
|
{
|
||||||
Serial.print("Error\n");
|
Serial.print("Error\n");
|
||||||
@ -324,28 +322,26 @@ bool MigrateEEPROM(uint8_t fromVersion)
|
|||||||
// } persistenceData_t;
|
// } persistenceData_t;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// Migrate Persistance-Data
|
|
||||||
ee.readBlock(0, (uint8_t *)&persistanceMarker_onChip, sizeof(uint16_t));
|
|
||||||
if (persistanceMarker_onChip < startofPersistence)
|
|
||||||
{
|
|
||||||
ee.readBlock(persistanceMarker_onChip + 0, (uint8_t *)&PersistenceData.writeCycleCounter, 4);
|
|
||||||
ee.readBlock(persistanceMarker_onChip + 4, (uint8_t *)&PersistenceData.faction_1_timer, 4);
|
|
||||||
ee.readBlock(persistanceMarker_onChip + 8, (uint8_t *)&PersistenceData.faction_2_timer, 4);
|
|
||||||
ee.readBlock(persistanceMarker_onChip + 12, (uint8_t *)&PersistenceData.faction_3_timer, 4);
|
|
||||||
ee.readBlock(persistanceMarker_onChip + 16, (uint8_t *)&PersistenceData.activeFaction, 4);
|
|
||||||
ee.readBlock(persistanceMarker_onChip + 20, (uint8_t *)&PersistenceData.checksum, 4);
|
|
||||||
MovePersistencePage_EEPROM(true);
|
|
||||||
StorePersistence_EEPROM();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Migrate Config-Data and set defaults for Values which doesn't exists in this earlier Version
|
// Migrate Config-Data and set defaults for Values which doesn't exists in this earlier Version
|
||||||
ConfigData.EEPROM_Version = ConfigData_defaults.EEPROM_Version;
|
ConfigData.EEPROM_Version = ConfigData_defaults.EEPROM_Version;
|
||||||
strncpy(ConfigData.Faction_1_Name, ConfigData_defaults.Faction_1_Name, sizeof(ConfigData.Faction_1_Name));
|
strncpy(ConfigData.Faction_1_Name, ConfigData_defaults.Faction_1_Name, sizeof(ConfigData.Faction_1_Name));
|
||||||
strncpy(ConfigData.Faction_2_Name, ConfigData_defaults.Faction_2_Name, sizeof(ConfigData.Faction_2_Name));
|
strncpy(ConfigData.Faction_2_Name, ConfigData_defaults.Faction_2_Name, sizeof(ConfigData.Faction_2_Name));
|
||||||
strncpy(ConfigData.Faction_3_Name, ConfigData_defaults.Faction_3_Name, sizeof(ConfigData.Faction_3_Name));
|
strncpy(ConfigData.Faction_3_Name, ConfigData_defaults.Faction_3_Name, sizeof(ConfigData.Faction_3_Name));
|
||||||
ee.readBlock(17, (uint8_t *)&ConfigData.batteryType, 4);
|
ee.readBlock(17, (uint8_t *)&ConfigData.batteryType, 4);
|
||||||
ee.readBlock(21, (uint8_t *)&ConfigData.active_faction_on_reboot, 1);
|
ee.readBlock(21, (uint8_t *)ConfigData.active_faction_on_reboot, 1);
|
||||||
StoreConfig_EEPROM();
|
|
||||||
|
// Migrate Persistance-Data
|
||||||
|
ee.readBlock(0, (uint8_t *)&persistanceMarker_onChip, sizeof(uint16_t));
|
||||||
|
if (persistanceMarker_onChip < startofPersistence)
|
||||||
|
{
|
||||||
|
ee.readBlock(persistanceMarker_onChip + 0, (uint8_t *)PersistenceData.writeCycleCounter, 4);
|
||||||
|
ee.readBlock(persistanceMarker_onChip + 4, (uint8_t *)PersistenceData.faction_1_timer, 4);
|
||||||
|
ee.readBlock(persistanceMarker_onChip + 8, (uint8_t *)PersistenceData.faction_2_timer, 4);
|
||||||
|
ee.readBlock(persistanceMarker_onChip + 12, (uint8_t *)PersistenceData.faction_3_timer, 4);
|
||||||
|
ee.readBlock(persistanceMarker_onChip + 16, (uint8_t *)PersistenceData.activeFaction, 4);
|
||||||
|
ee.readBlock(persistanceMarker_onChip + 20, (uint8_t *)PersistenceData.checksum, 4);
|
||||||
|
MovePersistencePage_EEPROM(true);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
@ -84,8 +84,6 @@ String processor(const String &var)
|
|||||||
return String(globals.battery_level);
|
return String(globals.battery_level);
|
||||||
if (var == "DEVICENAME")
|
if (var == "DEVICENAME")
|
||||||
return String(globals.DeviceName);
|
return String(globals.DeviceName);
|
||||||
if (var == "DEVICENAME_ID")
|
|
||||||
return String(globals.DeviceName_ID);
|
|
||||||
if (var == "BATTERY_TYPE")
|
if (var == "BATTERY_TYPE")
|
||||||
return String(ConfigData.batteryType);
|
return String(ConfigData.batteryType);
|
||||||
if (var == "BAT_VOLTAGE")
|
if (var == "BAT_VOLTAGE")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user