New per page based EEPROM writes
This commit is contained in:
parent
1fa85bbbdb
commit
ae780dc940
|
@ -805,6 +805,8 @@ void loop()
|
||||||
readIAT();
|
readIAT();
|
||||||
readO2();
|
readO2();
|
||||||
readBat();
|
readBat();
|
||||||
|
if(eepromWritesPending == true) { writeAllConfig(); } //Check for any outstanding EEPROM writes.
|
||||||
|
|
||||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3
|
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3
|
||||||
//if Can interface is enabled then check for serial3 requests.
|
//if Can interface is enabled then check for serial3 requests.
|
||||||
if (configPage10.enable_canbus == 1) // megas only support can via secondary serial
|
if (configPage10.enable_canbus == 1) // megas only support can via secondary serial
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
#ifndef STORAGE_H
|
#ifndef STORAGE_H
|
||||||
#define STORAGE_H
|
#define STORAGE_H
|
||||||
|
|
||||||
|
void writeAllConfig();
|
||||||
void writeConfig();
|
void writeConfig();
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
void loadCalibration();
|
void loadCalibration();
|
||||||
void writeCalibration();
|
void writeCalibration();
|
||||||
|
|
||||||
|
#define EEPROM_MAX_WRITE_BLOCK 50 //The maximum number of write operations that will be performed in one go. If we try to write to the EEPROM too fast (Each write takes ~3ms) then the rest of the system can hang)
|
||||||
|
bool eepromWritesPending = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes):
|
Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes):
|
||||||
|---------------------------------------------------|
|
|---------------------------------------------------|
|
||||||
|
|
|
@ -7,13 +7,30 @@ A full copy of the license may be found in the projects root directory
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
|
#include "comms.h"
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
|
||||||
|
void writeAllConfig()
|
||||||
|
{
|
||||||
|
writeConfig(1);
|
||||||
|
writeConfig(2);
|
||||||
|
writeConfig(3);
|
||||||
|
writeConfig(4);
|
||||||
|
writeConfig(5);
|
||||||
|
writeConfig(6);
|
||||||
|
writeConfig(7);
|
||||||
|
writeConfig(8);
|
||||||
|
writeConfig(9);
|
||||||
|
writeConfig(10);
|
||||||
|
writeConfig(11);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Takes the current configuration (config pages and maps)
|
Takes the current configuration (config pages and maps)
|
||||||
and writes them to EEPROM as per the layout defined in storage.h
|
and writes them to EEPROM as per the layout defined in storage.h
|
||||||
*/
|
*/
|
||||||
void writeConfig()
|
void writeConfig(byte tableNum)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
We only ever write to the EEPROM where the new value is different from the currently stored byte
|
We only ever write to the EEPROM where the new value is different from the currently stored byte
|
||||||
|
@ -21,268 +38,310 @@ void writeConfig()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int offset;
|
int offset;
|
||||||
|
int writeCounter = 0;
|
||||||
//Create a pointer to the config page
|
//Create a pointer to the config page
|
||||||
byte* pnt_configPage;
|
byte* pnt_configPage;
|
||||||
|
switch(tableNum)
|
||||||
|
{
|
||||||
|
case veMapPage:
|
||||||
|
/*---------------------------------------------------
|
||||||
|
| Fuel table (See storage.h for data layout) - Page 1
|
||||||
|
| 16x16 table itself + the 16 values along each of the axis
|
||||||
|
-----------------------------------------------------*/
|
||||||
|
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
|
||||||
|
for(int x=EEPROM_CONFIG1_MAP; x<EEPROM_CONFIG1_XBINS; x++)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------
|
//RPM bins
|
||||||
| Fuel table (See storage.h for data layout) - Page 1
|
for(int x=EEPROM_CONFIG1_XBINS; x<EEPROM_CONFIG1_YBINS; x++)
|
||||||
| 16x16 table itself + the 16 values along each of the axis
|
{
|
||||||
-----------------------------------------------------*/
|
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(EEPROM.read(EEPROM_CONFIG1_XSIZE) != fuelTable.xSize) { EEPROM.write(EEPROM_CONFIG1_XSIZE, fuelTable.xSize); } //Write the VE Tables RPM dimension size
|
offset = x - EEPROM_CONFIG1_XBINS;
|
||||||
if(EEPROM.read(EEPROM_CONFIG1_YSIZE) != fuelTable.ySize) { EEPROM.write(EEPROM_CONFIG1_YSIZE, fuelTable.ySize); } //Write the VE Tables MAP/TPS dimension size
|
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
|
||||||
for(int x=EEPROM_CONFIG1_MAP; x<EEPROM_CONFIG1_XBINS; x++)
|
}
|
||||||
{
|
//TPS/MAP bins
|
||||||
offset = x - EEPROM_CONFIG1_MAP;
|
for(int x=EEPROM_CONFIG1_YBINS; x<EEPROM_CONFIG2_START; x++)
|
||||||
if( EEPROM.read(x) != (fuelTable.values[15-(offset/16)][offset%16]) ) { EEPROM.write(x, fuelTable.values[15-(offset/16)][offset%16]); } //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_YBINS;
|
||||||
|
EEPROM.update(x, fuelTable.axisY[offset] / TABLE_LOAD_MULTIPLIER); //Table load is divided by 2 (Allows for MAP up to 511)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//That concludes the writing of the VE table
|
||||||
|
|
||||||
//RPM bins
|
case veSetPage:
|
||||||
for(int x=EEPROM_CONFIG1_XBINS; x<EEPROM_CONFIG1_YBINS; x++)
|
/*---------------------------------------------------
|
||||||
{
|
| Config page 2 (See storage.h for data layout)
|
||||||
offset = x - EEPROM_CONFIG1_XBINS;
|
| 64 byte long config table
|
||||||
if( EEPROM.read(x) != (byte(fuelTable.axisX[offset]/TABLE_RPM_MULTIPLIER)) ) { EEPROM.write(x, byte(fuelTable.axisX[offset]/TABLE_RPM_MULTIPLIER)); } //RPM bins are divided by 100 and converted to a byte
|
-----------------------------------------------------*/
|
||||||
}
|
pnt_configPage = (byte *)&configPage1; //Create a pointer to Page 2 in memory
|
||||||
//TPS/MAP bins
|
for(int x=EEPROM_CONFIG2_START; x<EEPROM_CONFIG2_END; x++)
|
||||||
for(int x=EEPROM_CONFIG1_YBINS; x<EEPROM_CONFIG2_START; x++)
|
{
|
||||||
{
|
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;
|
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG2_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG2_START))); writeCounter++; }
|
||||||
EEPROM.update(x, fuelTable.axisY[offset] / TABLE_LOAD_MULTIPLIER); //Table load is divided by 2 (Allows for MAP up to 511)
|
}
|
||||||
}
|
break;
|
||||||
//That concludes the writing of the VE table
|
|
||||||
//*********************************************************************************************************************************************************************************
|
|
||||||
|
|
||||||
/*---------------------------------------------------
|
case ignMapPage:
|
||||||
| Config page 2 (See storage.h for data layout)
|
/*---------------------------------------------------
|
||||||
| 64 byte long config table
|
| Ignition table (See storage.h for data layout) - Page 1
|
||||||
-----------------------------------------------------*/
|
| 16x16 table itself + the 16 values along each of the axis
|
||||||
pnt_configPage = (byte *)&configPage1; //Create a pointer to Page 2 in memory
|
-----------------------------------------------------*/
|
||||||
for(int x=EEPROM_CONFIG2_START; x<EEPROM_CONFIG2_END; x++)
|
//Begin writing the Ignition table, basically the same thing as above
|
||||||
{
|
if(EEPROM.read(EEPROM_CONFIG3_XSIZE) != ignitionTable.xSize) { EEPROM.write(EEPROM_CONFIG3_XSIZE,ignitionTable.xSize); } //Write the ignition Table RPM dimension size
|
||||||
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG2_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG2_START))); }
|
if(EEPROM.read(EEPROM_CONFIG3_YSIZE) != ignitionTable.ySize) { EEPROM.write(EEPROM_CONFIG3_YSIZE,ignitionTable.ySize); } //Write the ignition Table MAP/TPS dimension size
|
||||||
}
|
|
||||||
//*********************************************************************************************************************************************************************************
|
|
||||||
|
|
||||||
|
for(int x=EEPROM_CONFIG3_MAP; x<EEPROM_CONFIG3_XBINS; x++)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
//RPM bins
|
||||||
|
for(int x=EEPROM_CONFIG3_XBINS; x<EEPROM_CONFIG3_YBINS; x++)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
//TPS/MAP bins
|
||||||
|
for(int x=EEPROM_CONFIG3_YBINS; x<EEPROM_CONFIG4_START; x++)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
//That concludes the writing of the IGN table
|
||||||
|
break;
|
||||||
|
|
||||||
/*---------------------------------------------------
|
case ignSetPage:
|
||||||
| Ignition table (See storage.h for data layout) - Page 1
|
/*---------------------------------------------------
|
||||||
| 16x16 table itself + the 16 values along each of the axis
|
| Config page 2 (See storage.h for data layout)
|
||||||
-----------------------------------------------------*/
|
| 64 byte long config table
|
||||||
//Begin writing the Ignition table, basically the same thing as above
|
-----------------------------------------------------*/
|
||||||
if(EEPROM.read(EEPROM_CONFIG3_XSIZE) != ignitionTable.xSize) { EEPROM.write(EEPROM_CONFIG3_XSIZE,ignitionTable.xSize); } //Write the ignition Table RPM dimension size
|
pnt_configPage = (byte *)&configPage2; //Create a pointer to Page 2 in memory
|
||||||
if(EEPROM.read(EEPROM_CONFIG3_YSIZE) != ignitionTable.ySize) { EEPROM.write(EEPROM_CONFIG3_YSIZE,ignitionTable.ySize); } //Write the ignition Table MAP/TPS dimension size
|
for(int x=EEPROM_CONFIG4_START; x<EEPROM_CONFIG4_END; x++)
|
||||||
|
{
|
||||||
|
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(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG4_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG4_START))); writeCounter++; }
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
for(int x=EEPROM_CONFIG3_MAP; x<EEPROM_CONFIG3_XBINS; x++)
|
case afrMapPage:
|
||||||
{
|
/*---------------------------------------------------
|
||||||
offset = x - EEPROM_CONFIG3_MAP;
|
| AFR table (See storage.h for data layout) - Page 5
|
||||||
if(EEPROM.read(x) != (ignitionTable.values[15-(offset/16)][offset%16]) ) { EEPROM.write(x, ignitionTable.values[15-(offset/16)][offset%16]); } //Write the 16x16 map with translation
|
| 16x16 table itself + the 16 values along each of the axis
|
||||||
}
|
-----------------------------------------------------*/
|
||||||
//RPM bins
|
//Begin writing the Ignition table, basically the same thing as above
|
||||||
for(int x=EEPROM_CONFIG3_XBINS; x<EEPROM_CONFIG3_YBINS; x++)
|
if(EEPROM.read(EEPROM_CONFIG5_XSIZE) != afrTable.xSize) { EEPROM.write(EEPROM_CONFIG5_XSIZE,afrTable.xSize); } //Write the ignition Table RPM dimension size
|
||||||
{
|
if(EEPROM.read(EEPROM_CONFIG5_YSIZE) != afrTable.ySize) { EEPROM.write(EEPROM_CONFIG5_YSIZE,afrTable.ySize); } //Write the ignition Table MAP/TPS dimension size
|
||||||
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)); } //RPM bins are divided by 100 and converted to a byte
|
|
||||||
}
|
|
||||||
//TPS/MAP bins
|
|
||||||
for(int x=EEPROM_CONFIG3_YBINS; x<EEPROM_CONFIG4_START; x++)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
//That concludes the writing of the IGN table
|
|
||||||
//*********************************************************************************************************************************************************************************
|
|
||||||
|
|
||||||
/*---------------------------------------------------
|
for(int x=EEPROM_CONFIG5_MAP; x<EEPROM_CONFIG5_XBINS; x++)
|
||||||
| Config page 2 (See storage.h for data layout)
|
{
|
||||||
| 64 byte long config table
|
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;
|
||||||
pnt_configPage = (byte *)&configPage2; //Create a pointer to Page 2 in memory
|
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
|
||||||
for(int x=EEPROM_CONFIG4_START; x<EEPROM_CONFIG4_END; x++)
|
}
|
||||||
{
|
//RPM bins
|
||||||
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG4_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG4_START))); }
|
for(int x=EEPROM_CONFIG5_XBINS; x<EEPROM_CONFIG5_YBINS; x++)
|
||||||
}
|
{
|
||||||
//*********************************************************************************************************************************************************************************
|
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
|
||||||
|
}
|
||||||
|
//TPS/MAP bins
|
||||||
|
for(int x=EEPROM_CONFIG5_YBINS; x<EEPROM_CONFIG6_START; x++)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
//That concludes the writing of the AFR table
|
||||||
|
break;
|
||||||
|
|
||||||
|
case afrSetPage:
|
||||||
|
/*---------------------------------------------------
|
||||||
|
| Config page 3 (See storage.h for data layout)
|
||||||
|
| 64 byte long config table
|
||||||
|
-----------------------------------------------------*/
|
||||||
|
pnt_configPage = (byte *)&configPage3; //Create a pointer to Page 3 in memory
|
||||||
|
for(int x=EEPROM_CONFIG6_START; x<EEPROM_CONFIG6_END; x++)
|
||||||
|
{
|
||||||
|
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(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG6_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG6_START))); writeCounter++; }
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/*---------------------------------------------------
|
case iacPage:
|
||||||
| AFR table (See storage.h for data layout) - Page 5
|
/*---------------------------------------------------
|
||||||
| 16x16 table itself + the 16 values along each of the axis
|
| Config page 4 (See storage.h for data layout)
|
||||||
-----------------------------------------------------*/
|
| 64 byte long config table
|
||||||
//Begin writing the Ignition table, basically the same thing as above
|
-----------------------------------------------------*/
|
||||||
if(EEPROM.read(EEPROM_CONFIG5_XSIZE) != afrTable.xSize) { EEPROM.write(EEPROM_CONFIG5_XSIZE,afrTable.xSize); } //Write the ignition Table RPM dimension size
|
pnt_configPage = (byte *)&configPage4; //Create a pointer to Page 4 in memory
|
||||||
if(EEPROM.read(EEPROM_CONFIG5_YSIZE) != afrTable.ySize) { EEPROM.write(EEPROM_CONFIG5_YSIZE,afrTable.ySize); } //Write the ignition Table MAP/TPS dimension size
|
//The next 128 bytes can simply be pulled straight from the configTable
|
||||||
|
for(int x=EEPROM_CONFIG7_START; x<EEPROM_CONFIG7_END; x++)
|
||||||
|
{
|
||||||
|
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(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG7_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG7_START))); writeCounter++; }
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
for(int x=EEPROM_CONFIG5_MAP; x<EEPROM_CONFIG5_XBINS; x++)
|
case boostvvtPage:
|
||||||
{
|
{
|
||||||
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]); } //Write the 16x16 map
|
| Boost and vvt tables (See storage.h for data layout) - Page 8
|
||||||
}
|
| 8x8 table itself + the 8 values along each of the axis
|
||||||
//RPM bins
|
-----------------------------------------------------*/
|
||||||
for(int x=EEPROM_CONFIG5_XBINS; x<EEPROM_CONFIG5_YBINS; x++)
|
//Begin writing the 2 tables, basically the same thing as above but we're doing these 2 together (2 tables per page instead of 1)
|
||||||
{
|
if(EEPROM.read(EEPROM_CONFIG8_XSIZE1) != boostTable.xSize) { EEPROM.write(EEPROM_CONFIG8_XSIZE1,boostTable.xSize); } //Write the boost Table RPM dimension size
|
||||||
offset = x - EEPROM_CONFIG5_XBINS;
|
if(EEPROM.read(EEPROM_CONFIG8_YSIZE1) != boostTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE1,boostTable.ySize); } //Write the boost Table MAP/TPS dimension size
|
||||||
if(EEPROM.read(x) != byte(afrTable.axisX[offset]/TABLE_RPM_MULTIPLIER)) { EEPROM.write(x, byte(afrTable.axisX[offset]/TABLE_RPM_MULTIPLIER)); } //RPM bins are divided by 100 and converted to a byte
|
if(EEPROM.read(EEPROM_CONFIG8_XSIZE2) != vvtTable.xSize) { EEPROM.write(EEPROM_CONFIG8_XSIZE2,vvtTable.xSize); } //Write the vvt Table RPM dimension size
|
||||||
}
|
if(EEPROM.read(EEPROM_CONFIG8_YSIZE2) != vvtTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE2,vvtTable.ySize); } //Write the vvt Table MAP/TPS dimension size
|
||||||
//TPS/MAP bins
|
|
||||||
for(int x=EEPROM_CONFIG5_YBINS; x<EEPROM_CONFIG6_START; x++)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
//That concludes the writing of the AFR table
|
|
||||||
//*********************************************************************************************************************************************************************************
|
|
||||||
|
|
||||||
/*---------------------------------------------------
|
int y = EEPROM_CONFIG8_MAP2; //We do the 2 maps together in the same loop
|
||||||
| Config page 3 (See storage.h for data layout)
|
for(int x=EEPROM_CONFIG8_MAP1; x<EEPROM_CONFIG8_XBINS1; x++)
|
||||||
| 64 byte long config table
|
{
|
||||||
-----------------------------------------------------*/
|
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.
|
||||||
pnt_configPage = (byte *)&configPage3; //Create a pointer to Page 3 in memory
|
offset = x - EEPROM_CONFIG8_MAP1;
|
||||||
for(int x=EEPROM_CONFIG6_START; x<EEPROM_CONFIG6_END; x++)
|
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(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG6_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG6_START))); }
|
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
|
||||||
}
|
y++;
|
||||||
//*********************************************************************************************************************************************************************************
|
}
|
||||||
|
//RPM bins
|
||||||
|
y = EEPROM_CONFIG8_XBINS2;
|
||||||
|
for(int x=EEPROM_CONFIG8_XBINS1; x<EEPROM_CONFIG8_YBINS1; x++)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
//TPS/MAP bins
|
||||||
|
y=EEPROM_CONFIG8_YBINS2;
|
||||||
|
for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_XSIZE2; x++)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/*---------------------------------------------------
|
case seqFuelPage:
|
||||||
| Config page 4 (See storage.h for data layout)
|
{
|
||||||
| 64 byte long config table
|
/*---------------------------------------------------
|
||||||
-----------------------------------------------------*/
|
| Fuel trim tables (See storage.h for data layout) - Page 9
|
||||||
pnt_configPage = (byte *)&configPage4; //Create a pointer to Page 4 in memory
|
| 6x6 tables itself + the 6 values along each of the axis
|
||||||
//The next 128 bytes can simply be pulled straight from the configTable
|
-----------------------------------------------------*/
|
||||||
for(int x=EEPROM_CONFIG7_START; x<EEPROM_CONFIG7_END; x++)
|
//Begin writing the 2 tables, basically the same thing as above but we're doing these 2 together (2 tables per page instead of 1)
|
||||||
{
|
EEPROM.update(EEPROM_CONFIG9_XSIZE1,trim1Table.xSize); //Write the boost Table RPM dimension size
|
||||||
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG7_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG7_START))); }
|
EEPROM.update(EEPROM_CONFIG9_YSIZE1,trim1Table.ySize); //Write the boost Table MAP/TPS dimension size
|
||||||
}
|
EEPROM.update(EEPROM_CONFIG9_XSIZE2,trim2Table.xSize); //Write the boost Table RPM dimension size
|
||||||
|
EEPROM.update(EEPROM_CONFIG9_YSIZE2,trim2Table.ySize); //Write the boost Table MAP/TPS dimension size
|
||||||
|
EEPROM.update(EEPROM_CONFIG9_XSIZE3,trim3Table.xSize); //Write the boost Table RPM dimension size
|
||||||
|
EEPROM.update(EEPROM_CONFIG9_YSIZE3,trim3Table.ySize); //Write the boost Table MAP/TPS dimension size
|
||||||
|
EEPROM.update(EEPROM_CONFIG9_XSIZE4,trim4Table.xSize); //Write the boost Table RPM dimension size
|
||||||
|
EEPROM.update(EEPROM_CONFIG9_YSIZE4,trim4Table.ySize); //Write the boost Table MAP/TPS dimension size
|
||||||
|
|
||||||
/*---------------------------------------------------
|
int y = EEPROM_CONFIG9_MAP2; //We do the 4 maps together in the same loop
|
||||||
| Boost and vvt tables (See storage.h for data layout) - Page 8
|
int z = EEPROM_CONFIG9_MAP3; //We do the 4 maps together in the same loop
|
||||||
| 8x8 table itself + the 8 values along each of the axis
|
int i = EEPROM_CONFIG9_MAP4; //We do the 4 maps together in the same loop
|
||||||
-----------------------------------------------------*/
|
for(int x=EEPROM_CONFIG9_MAP1; x<EEPROM_CONFIG9_XBINS1; x++)
|
||||||
//Begin writing the 2 tables, basically the same thing as above but we're doing these 2 together (2 tables per page instead of 1)
|
{
|
||||||
if(EEPROM.read(EEPROM_CONFIG8_XSIZE1) != boostTable.xSize) { EEPROM.write(EEPROM_CONFIG8_XSIZE1,boostTable.xSize); } //Write the boost Table RPM 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.
|
||||||
if(EEPROM.read(EEPROM_CONFIG8_YSIZE1) != boostTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE1,boostTable.ySize); } //Write the boost Table MAP/TPS dimension size
|
offset = x - EEPROM_CONFIG9_MAP1;
|
||||||
if(EEPROM.read(EEPROM_CONFIG8_XSIZE2) != vvtTable.xSize) { EEPROM.write(EEPROM_CONFIG8_XSIZE2,vvtTable.xSize); } //Write the vvt Table RPM dimension size
|
EEPROM.update(x, (trim1Table.values[5-(offset/6)][offset%6]) ); //Write the 6x6 map
|
||||||
if(EEPROM.read(EEPROM_CONFIG8_YSIZE2) != vvtTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE2,vvtTable.ySize); } //Write the vvt Table MAP/TPS dimension size
|
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
|
||||||
|
y++;
|
||||||
|
z++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
//RPM bins
|
||||||
|
y = EEPROM_CONFIG9_XBINS2;
|
||||||
|
z = EEPROM_CONFIG9_XBINS3;
|
||||||
|
i = EEPROM_CONFIG9_XBINS4;
|
||||||
|
for(int x=EEPROM_CONFIG9_XBINS1; x<EEPROM_CONFIG9_YBINS1; x++)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
y++;
|
||||||
|
z++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
//TPS/MAP bins
|
||||||
|
y=EEPROM_CONFIG9_YBINS2;
|
||||||
|
z=EEPROM_CONFIG9_YBINS3;
|
||||||
|
i=EEPROM_CONFIG9_YBINS4;
|
||||||
|
for(int x=EEPROM_CONFIG9_YBINS1; x<EEPROM_CONFIG9_XSIZE2; x++)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
y++;
|
||||||
|
z++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
int y = EEPROM_CONFIG8_MAP2; //We do the 2 maps together in the same loop
|
case canbusPage:
|
||||||
for(int x=EEPROM_CONFIG8_MAP1; x<EEPROM_CONFIG8_XBINS1; x++)
|
/*---------------------------------------------------
|
||||||
{
|
| Config page 10 (See storage.h for data layout)
|
||||||
offset = x - EEPROM_CONFIG8_MAP1;
|
| 128 byte long config table
|
||||||
if(EEPROM.read(x) != (boostTable.values[7-(offset/8)][offset%8]) ) { EEPROM.write(x, boostTable.values[7-(offset/8)][offset%8]); } //Write the 8x8 map
|
-----------------------------------------------------*/
|
||||||
offset = y - EEPROM_CONFIG8_MAP2;
|
pnt_configPage = (byte *)&configPage10; //Create a pointer to Page 10 in memory
|
||||||
if(EEPROM.read(y) != (vvtTable.values[7-(offset/8)][offset%8]) ) { EEPROM.write(y, vvtTable.values[7-(offset/8)][offset%8]); } //Write the 8x8 map
|
for(int x=EEPROM_CONFIG10_START; x<EEPROM_CONFIG10_END; x++)
|
||||||
y++;
|
{
|
||||||
}
|
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.
|
||||||
//RPM bins
|
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG10_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG10_START))); }
|
||||||
y = EEPROM_CONFIG8_XBINS2;
|
}
|
||||||
for(int x=EEPROM_CONFIG8_XBINS1; x<EEPROM_CONFIG8_YBINS1; x++)
|
break;
|
||||||
{
|
|
||||||
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)); } //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)); } //RPM bins are divided by 100 and converted to a byte
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
//TPS/MAP bins
|
|
||||||
y=EEPROM_CONFIG8_YBINS2;
|
|
||||||
for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_XSIZE2; x++)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------
|
case warmupPage:
|
||||||
| Fuel trim tables (See storage.h for data layout) - Page 9
|
/*---------------------------------------------------
|
||||||
| 6x6 tables itself + the 6 values along each of the axis
|
| Config page 11 (See storage.h for data layout)
|
||||||
-----------------------------------------------------*/
|
| 192 byte long config table
|
||||||
//Begin writing the 2 tables, basically the same thing as above but we're doing these 2 together (2 tables per page instead of 1)
|
-----------------------------------------------------*/
|
||||||
EEPROM.update(EEPROM_CONFIG9_XSIZE1,trim1Table.xSize); //Write the boost Table RPM dimension size
|
pnt_configPage = (byte *)&configPage11; //Create a pointer to Page 11 in memory
|
||||||
EEPROM.update(EEPROM_CONFIG9_YSIZE1,trim1Table.ySize); //Write the boost Table MAP/TPS dimension size
|
//As there are no 3d tables in this page, all 192 bytes can simply be read in
|
||||||
EEPROM.update(EEPROM_CONFIG9_XSIZE2,trim2Table.xSize); //Write the boost Table RPM dimension size
|
for(int x=EEPROM_CONFIG11_START; x<EEPROM_CONFIG11_END; x++)
|
||||||
EEPROM.update(EEPROM_CONFIG9_YSIZE2,trim2Table.ySize); //Write the boost Table MAP/TPS dimension size
|
{
|
||||||
EEPROM.update(EEPROM_CONFIG9_XSIZE3,trim3Table.xSize); //Write the boost Table RPM 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.
|
||||||
EEPROM.update(EEPROM_CONFIG9_YSIZE3,trim3Table.ySize); //Write the boost Table MAP/TPS dimension size
|
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG11_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG11_START))); }
|
||||||
EEPROM.update(EEPROM_CONFIG9_XSIZE4,trim4Table.xSize); //Write the boost Table RPM dimension size
|
}
|
||||||
EEPROM.update(EEPROM_CONFIG9_YSIZE4,trim4Table.ySize); //Write the boost Table MAP/TPS dimension size
|
break;
|
||||||
|
|
||||||
y = EEPROM_CONFIG9_MAP2; //We do the 4 maps together in the same loop
|
default:
|
||||||
int z = EEPROM_CONFIG9_MAP3; //We do the 4 maps together in the same loop
|
break;
|
||||||
int i = EEPROM_CONFIG9_MAP4; //We do the 4 maps together in the same loop
|
|
||||||
for(int x=EEPROM_CONFIG9_MAP1; x<EEPROM_CONFIG9_XBINS1; x++)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
y++;
|
|
||||||
z++;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
//RPM bins
|
|
||||||
y = EEPROM_CONFIG9_XBINS2;
|
|
||||||
z = EEPROM_CONFIG9_XBINS3;
|
|
||||||
i = EEPROM_CONFIG9_XBINS4;
|
|
||||||
for(int x=EEPROM_CONFIG9_XBINS1; x<EEPROM_CONFIG9_YBINS1; x++)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
y++;
|
|
||||||
z++;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
//TPS/MAP bins
|
|
||||||
y=EEPROM_CONFIG9_YBINS2;
|
|
||||||
z=EEPROM_CONFIG9_YBINS3;
|
|
||||||
i=EEPROM_CONFIG9_YBINS4;
|
|
||||||
for(int x=EEPROM_CONFIG9_YBINS1; x<EEPROM_CONFIG9_XSIZE2; x++)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
y++;
|
|
||||||
z++;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
//*********************************************************************************************************************************************************************************
|
|
||||||
|
|
||||||
/*---------------------------------------------------
|
|
||||||
| Config page 10 (See storage.h for data layout)
|
|
||||||
| 128 byte long config table
|
|
||||||
-----------------------------------------------------*/
|
|
||||||
pnt_configPage = (byte *)&configPage10; //Create a pointer to Page 10 in memory
|
|
||||||
for(int x=EEPROM_CONFIG10_START; x<EEPROM_CONFIG10_END; x++)
|
|
||||||
{
|
|
||||||
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG10_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG10_START))); }
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************************************************************************************
|
|
||||||
|
|
||||||
/*---------------------------------------------------
|
|
||||||
| Config page 11 (See storage.h for data layout)
|
|
||||||
| 192 byte long config table
|
|
||||||
-----------------------------------------------------*/
|
|
||||||
pnt_configPage = (byte *)&configPage11; //Create a pointer to Page 11 in memory
|
|
||||||
//As there are no 3d tables in this page, all 192 bytes can simply be read in
|
|
||||||
for(int x=EEPROM_CONFIG11_START; x<EEPROM_CONFIG11_END; x++)
|
|
||||||
{
|
|
||||||
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG11_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG11_START))); }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ void doUpdates()
|
||||||
ignitionTable.values[x][y] = ignitionTable.values[x][y] + 40;
|
ignitionTable.values[x][y] = ignitionTable.values[x][y] + 40;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeConfig();
|
writeAllConfig();
|
||||||
EEPROM.write(EEPROM_DATA_VERSION, 3);
|
EEPROM.write(EEPROM_DATA_VERSION, 3);
|
||||||
}
|
}
|
||||||
//June 2017 required the forced addition of some CAN values to avoid weird errors
|
//June 2017 required the forced addition of some CAN values to avoid weird errors
|
||||||
|
@ -33,7 +33,7 @@ void doUpdates()
|
||||||
//There was a bad value in the May base tune for the spark duration setting, fix it here if it's a problem
|
//There was a bad value in the May base tune for the spark duration setting, fix it here if it's a problem
|
||||||
if(configPage2.sparkDur == 255) { configPage2.sparkDur = 10; }
|
if(configPage2.sparkDur == 255) { configPage2.sparkDur = 10; }
|
||||||
|
|
||||||
writeConfig();
|
writeAllConfig();
|
||||||
EEPROM.write(EEPROM_DATA_VERSION, 4);
|
EEPROM.write(EEPROM_DATA_VERSION, 4);
|
||||||
}
|
}
|
||||||
//July 2017 adds a cranking enrichment curve in place of the single value. This converts that single value to the curve
|
//July 2017 adds a cranking enrichment curve in place of the single value. This converts that single value to the curve
|
||||||
|
@ -50,7 +50,7 @@ void doUpdates()
|
||||||
configPage11.crankingEnrichValues[2] = 100 + configPage1.crankingPct;
|
configPage11.crankingEnrichValues[2] = 100 + configPage1.crankingPct;
|
||||||
configPage11.crankingEnrichValues[3] = 100 + configPage1.crankingPct;
|
configPage11.crankingEnrichValues[3] = 100 + configPage1.crankingPct;
|
||||||
|
|
||||||
writeConfig();
|
writeAllConfig();
|
||||||
EEPROM.write(EEPROM_DATA_VERSION, 5);
|
EEPROM.write(EEPROM_DATA_VERSION, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue