if(EEPROM.read(EEPROM_CONFIG1_XSIZE)!=fuelTable.xSize){EEPROM.write(EEPROM_CONFIG1_XSIZE,fuelTable.xSize);}//Write the VE Tables RPM dimension size
if(EEPROM.read(EEPROM_CONFIG1_YSIZE)!=fuelTable.ySize){EEPROM.write(EEPROM_CONFIG1_YSIZE,fuelTable.ySize);}//Write the VE Tables MAP/TPS dimension size
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG1_MAP;
if(EEPROM.read(x)!=(fuelTable.values[15-(offset/16)][offset%16])){EEPROM.write(x,fuelTable.values[15-(offset/16)][offset%16]);writeCounter++;}//Write the 16x16 map
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG1_XBINS;
if(EEPROM.read(x)!=(byte(fuelTable.axisX[offset]/TABLE_RPM_MULTIPLIER))){EEPROM.write(x,byte(fuelTable.axisX[offset]/TABLE_RPM_MULTIPLIER));writeCounter++;}//RPM bins are divided by 100 and converted to a byte
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG1_YBINS;
EEPROM.update(x,fuelTable.axisY[offset]/TABLE_LOAD_MULTIPLIER);//Table load is divided by 2 (Allows for MAP up to 511)
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG3_MAP;
if(EEPROM.read(x)!=(ignitionTable.values[15-(offset/16)][offset%16])){EEPROM.write(x,ignitionTable.values[15-(offset/16)][offset%16]);writeCounter++;}//Write the 16x16 map with translation
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG3_XBINS;
if(EEPROM.read(x)!=byte(ignitionTable.axisX[offset]/TABLE_RPM_MULTIPLIER)){EEPROM.write(x,byte(ignitionTable.axisX[offset]/TABLE_RPM_MULTIPLIER));writeCounter++;}//RPM bins are divided by 100 and converted to a byte
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG3_YBINS;
EEPROM.update(x,ignitionTable.axisY[offset]/TABLE_LOAD_MULTIPLIER);//Table load is divided by 2 (Allows for MAP up to 511)
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG5_MAP;
if(EEPROM.read(x)!=(afrTable.values[15-(offset/16)][offset%16])){EEPROM.write(x,afrTable.values[15-(offset/16)][offset%16]);writeCounter++;}//Write the 16x16 map
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG5_XBINS;
if(EEPROM.read(x)!=byte(afrTable.axisX[offset]/TABLE_RPM_MULTIPLIER)){EEPROM.write(x,byte(afrTable.axisX[offset]/TABLE_RPM_MULTIPLIER));writeCounter++;}//RPM bins are divided by 100 and converted to a byte
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG5_YBINS;
EEPROM.update(x,afrTable.axisY[offset]/TABLE_LOAD_MULTIPLIER);//Table load is divided by 2 (Allows for MAP up to 511)
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG8_MAP1;
if(EEPROM.read(x)!=(boostTable.values[7-(offset/8)][offset%8])){EEPROM.write(x,boostTable.values[7-(offset/8)][offset%8]);writeCounter++;}//Write the 8x8 map
offset=y-EEPROM_CONFIG8_MAP2;
if(EEPROM.read(y)!=(vvtTable.values[7-(offset/8)][offset%8])){EEPROM.write(y,vvtTable.values[7-(offset/8)][offset%8]);writeCounter++;}//Write the 8x8 map
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG8_XBINS1;
if(EEPROM.read(x)!=byte(boostTable.axisX[offset]/TABLE_RPM_MULTIPLIER)){EEPROM.write(x,byte(boostTable.axisX[offset]/TABLE_RPM_MULTIPLIER));writeCounter++;}//RPM bins are divided by 100 and converted to a byte
offset=y-EEPROM_CONFIG8_XBINS2;
if(EEPROM.read(y)!=byte(vvtTable.axisX[offset]/TABLE_RPM_MULTIPLIER)){EEPROM.write(y,byte(vvtTable.axisX[offset]/TABLE_RPM_MULTIPLIER));writeCounter++;}//RPM bins are divided by 100 and converted to a byte
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG8_YBINS1;
EEPROM.update(x,boostTable.axisY[offset]);//TABLE_LOAD_MULTIPLIER is NOT used for boost as it is TPS based (0-100)
offset=y-EEPROM_CONFIG8_YBINS2;
EEPROM.update(y,vvtTable.axisY[offset]);//TABLE_LOAD_MULTIPLIER is NOT used for VVT as it is TPS based (0-100)
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG9_MAP1;
EEPROM.update(x,(trim1Table.values[5-(offset/6)][offset%6]));//Write the 6x6 map
offset=y-EEPROM_CONFIG9_MAP2;
EEPROM.update(y,trim2Table.values[5-(offset/6)][offset%6]);//Write the 6x6 map
offset=z-EEPROM_CONFIG9_MAP3;
EEPROM.update(z,trim3Table.values[5-(offset/6)][offset%6]);//Write the 6x6 map
offset=i-EEPROM_CONFIG9_MAP4;
EEPROM.update(i,trim4Table.values[5-(offset/6)][offset%6]);//Write the 6x6 map
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG9_XBINS1;
EEPROM.update(x,byte(trim1Table.axisX[offset]/TABLE_RPM_MULTIPLIER));//RPM bins are divided by 100 and converted to a byte
offset=y-EEPROM_CONFIG9_XBINS2;
EEPROM.update(y,byte(trim2Table.axisX[offset]/TABLE_RPM_MULTIPLIER));//RPM bins are divided by 100 and converted to a byte
offset=z-EEPROM_CONFIG9_XBINS3;
EEPROM.update(z,byte(trim3Table.axisX[offset]/TABLE_RPM_MULTIPLIER));//RPM bins are divided by 100 and converted to a byte
offset=i-EEPROM_CONFIG9_XBINS4;
EEPROM.update(i,byte(trim4Table.axisX[offset]/TABLE_RPM_MULTIPLIER));//RPM bins are divided by 100 and converted to a byte
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
offset=x-EEPROM_CONFIG9_YBINS1;
EEPROM.update(x,trim1Table.axisY[offset]/TABLE_LOAD_MULTIPLIER);//Table load is divided by 2 (Allows for MAP up to 511)
offset=y-EEPROM_CONFIG9_YBINS2;
EEPROM.update(y,trim2Table.axisY[offset]/TABLE_LOAD_MULTIPLIER);//Table load is divided by 2 (Allows for MAP up to 511)
offset=z-EEPROM_CONFIG9_YBINS3;
EEPROM.update(z,trim3Table.axisY[offset]/TABLE_LOAD_MULTIPLIER);//Table load is divided by 2 (Allows for MAP up to 511)
offset=i-EEPROM_CONFIG9_YBINS4;
EEPROM.update(i,trim4Table.axisY[offset]/TABLE_LOAD_MULTIPLIER);//Table load is divided by 2 (Allows for MAP up to 511)
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
if((writeCounter>EEPROM_MAX_WRITE_BLOCK)){eepromWritesPending=true;break;}//This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.