Completed EEPROM save routine
This commit is contained in:
parent
a38df08ab9
commit
d259f86030
27
storage.ino
27
storage.ino
|
@ -45,15 +45,34 @@ void writeConfig()
|
|||
}
|
||||
//That concludes the writing of the VE table
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
//IGNITION CONFIG PAGE (2)
|
||||
pnt_configPage = (byte *)&configPage2; //Create a pointer to Page 2 in memory
|
||||
//Begin writing the Ignition table, basically the same thing as above
|
||||
if(EEPROM.read(EEPROM_CONFIG2_XSIZE) != ignitionTable.xSize) { EEPROM.write(EEPROM_CONFIG2_XSIZE,ignitionTable.xSize); } //Write the ignition Table RPM dimension size
|
||||
if(EEPROM.read(EEPROM_CONFIG2_YSIZE) != ignitionTable.ySize) { EEPROM.write(EEPROM_CONFIG2_YSIZE,ignitionTable.ySize); } //Write the ignition Table MAP/TPS dimension size
|
||||
|
||||
//The next 125 bytes can simply be pulled straight from the ignitionTable
|
||||
pnt_configPage = (byte *)&configPage2; //Create a pointer to Page 2 in memory
|
||||
for(int x=EEPROM_CONFIG2_YBINS; x<EEPROM_SIZE; x++)
|
||||
for(int x=EEPROM_CONFIG2_MAP; x<EEPROM_CONFIG2_XBINS; x++)
|
||||
{
|
||||
if(EEPROM.read(x) != *(pnt_configPage + x)) { EEPROM.write(x, *(pnt_configPage + x)); }
|
||||
offset = x - EEPROM_CONFIG2_MAP;
|
||||
if(EEPROM.read(x) != ignitionTable.values[7-offset/8][offset%8]) { EEPROM.write(x, ignitionTable.values[7-offset/8][offset%8]); } //Write the 8x8 map
|
||||
}
|
||||
//RPM bins
|
||||
for(int x=EEPROM_CONFIG2_XBINS; x<EEPROM_CONFIG2_YBINS; x++)
|
||||
{
|
||||
offset = x - EEPROM_CONFIG2_XBINS;
|
||||
if(EEPROM.read(x) != (byte)(ignitionTable.axisX[offset]/100)) { EEPROM.write(x, (byte)(ignitionTable.axisX[offset]/100)); } //RPM bins are divided by 100 and converted to a byte
|
||||
}
|
||||
//TPS/MAP bins
|
||||
for(int x=EEPROM_CONFIG2_YBINS; x<EEPROM_CONFIG2_SETTINGS; x++)
|
||||
{
|
||||
offset = x - EEPROM_CONFIG2_YBINS;
|
||||
if(EEPROM.read(x) != ignitionTable.axisY[offset]) { EEPROM.write(x, ignitionTable.axisY[offset]); }
|
||||
}
|
||||
//The next 125 bytes can simply be pulled straight from the configTable
|
||||
for(int x=EEPROM_CONFIG2_SETTINGS; x<EEPROM_SIZE; x++)
|
||||
{
|
||||
if(EEPROM.read(x) != *(pnt_configPage - EEPROM_CONFIG2_SETTINGS + x)) { EEPROM.write(x, *(pnt_configPage - EEPROM_CONFIG2_SETTINGS + x)); }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue