Memory adjustments for staging fuel table

This commit is contained in:
Josh Stewart 2017-11-21 15:17:55 +11:00
parent 74c65900a8
commit 2989e32f15
7 changed files with 169 additions and 47 deletions

View File

@ -97,7 +97,7 @@
endianness = little
nPages = 10
pageSize = 288, 128, 288, 128, 288, 128, 160, 192, 128, 192
pageSize = 288, 128, 288, 128, 288, 128, 240, 192, 128, 192
;burnCommand = "B"
;pageActivate = "P\001", "P\002", "P\003", "P\004", "P\005", "P\006", "P\007", "P\010", "P\011", "P\012", "P\013"
@ -492,6 +492,14 @@ page = 7
vvtTable = array, U08, 80,[8x8], "%", 1.0, 0.0, 0, 100, 0
rpmBinsVVT = array, U08, 144,[ 8], "RPM", 100.0, 0.0, 100, 25500, 0
tpsBinsVVT = array, U08, 152,[ 8], "TPS", 1.0, 0.0, 0.0, 255.0, 0
;Fuel staging Table
stagingTable = array, U08, 160, [8x8], "%", 1.0, 0.0, 0.0, 100.0, 0
rpmBinsStaging= array, U08, 224, [ 8], "RPM", 100.0, 0.0, 100.0, 25500.0, 0
#if SPEED_DENSITY
mapBinsStaging= array, U08, 232, [ 8], "kPa", 2.0, 0.0, 0.0, 511.0, 0
#elif ALPHA_N
tpsBinsStaging= array, U08, 232, [ 8], "TPS", 2.0, 0.0, 0.0, 100.0, 0
#endif
;--------------------------------------------------
;Sequential fuel trim tables (Page 8)
@ -690,8 +698,8 @@ page = 10
crankingEnrichValues= array, U08, 4, [4], "%", 1.0, 0.0, 0, 255, 0 ; Values for the cranking enrichment curve
rotaryType = bits , U08, 8, [0:1], "FC", "FD", "RX8", "INVALID"
unused11-8c = bits , U08, 8, [2:2], "Off","On"
unused11-8d = bits , U08, 8, [3:3], "Off","On"
stagingEnabled = bits , U08, 8, [2:2], "Off","On"
stagingMode = bits , U08, 8, [3:3], "Table","INVALID"
unused11-8e = bits , U08, 8, [4:4], "Off","On"
unused11-8f = bits , U08, 8, [5:5], "Off","On"
unused11-8g = bits , U08, 8, [6:6], "Off","On"
@ -705,7 +713,10 @@ page = 10
#endif
boostSens = scalar, U16, 25, "", 1, 0, 0, 5000, 0
boostIntv = scalar, U08, 27, "ms", 1, 0, 0, 250, 0
unused11_28_192 = array, U08, 28,[163], "RPM", 100.0, 0.0, 100, 25500, 0
stagedInjSizePri = scalar, U16, 28, "cc/min", 1, 0, 0, 1500, 0
stagedInjSizeSec = scalar, U16, 30, "cc/min", 1, 0, 0, 1500, 0
unused11_32_192 = array, U08, 32, [159], "RPM", 100.0, 0.0, 100, 25500, 0
;-------------------------------------------------------------------------------
@ -783,6 +794,7 @@ page = 10
defaultValue = true_address, 256
defaultValue = realtime_base_address, 336
defaultValue = VVTasOnOff, 0
defaultValue = stagingEnabled, 0
; defaultValue = obd_address, 0
;Default pins
@ -840,6 +852,7 @@ menuDialog = main
subMenu = afrTable1Tbl, "AFR Table", 5
subMenu = std_separator
subMenu = inj_trimad, "Sequential fuel trim", 9
subMenu = stagingTableDialog, "Staged Injection", 10
menu = "&Spark"
subMenu = sparkSettings, "Spark Settings"
@ -1463,10 +1476,25 @@ menuDialog = main
panel = inj_trimadt, Center
panel = inj_trimadb, South
;;Injector staging
dialog = stagingTableDialog_north, ""
field = "Staging enabled", stagingEnabled
field = "Staging mode", stagingMode
field = "Size of primary injectors", stagedInjSizePri, { stagingEnabled }
field = "Size of secondary injectors", stagedInjSizeSec, { stagingEnabled }
dialog = stagingTableDialog_south, ""
panel = stagingTbl, { stagingMode == 0 }
dialog = stagingTableDialog, "Staged injection"
topicHelp = "https://speeduino.com/wiki/index.php/Staged_Injection"
panel = stagingTableDialog_north, North
panel = stagingTableDialog_south, South
dialog = outputtest_warningmessage, ""
field = "WARNING! USE AT YOUR OWN RISK. INCORRECT USE WILL DAMAGE YOUR HARDWARE!"
field = "Do not attempt to use this page whilst your engine is running!"
field = "Forcing the Injector or Spark outputs could cause flooding of your engine or permanent damage to ignition coils!"
field = "WARNING! USE AT YOUR OWN RISK. INCORRECT USE WILL DAMAGE YOUR HARDWARE!"
field = "Do not attempt to use this page whilst your engine is running!"
field = "Forcing the Injector or Spark outputs could cause flooding of your engine or permanent damage to ignition coils!"
dialog = enableoutputtestbuttons, "Enable Test Controls", xAxis
@ -1986,6 +2014,17 @@ cmdtestspk450dc = "E\x03\x0C"
gridHeight = 3.0
upDownLabel = "HIGHER", "LOWER"
table = stagingTbl, stagingMap, "Fuel Staging Table", 10
xBins = rpmBinsStaging, rpm
#if SPEED_DENSITY
yBins = mapBinsStaging, map
#else ALPHA_N
yBins = tpsBinsStaging, throttle
#endif
zBins = stagingTable
gridHeight = 3.0
upDownLabel = "HIGHER", "LOWER"
;--------- Sequential fuel trim maps -----------
table = fuelTrimTable1Tbl, fuelTrimTable1Map, "Fuel trim Table 1", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"

View File

@ -223,8 +223,8 @@ void command()
//7 bytes required:
//2 - Page identifier
//2 - offset
//2 - Length (Should always be 1 until chunk write is setup)
//1 - New value
//2 - Length
//1 - 1st New value
if(Serial.available() >= 7)
{
byte offset1, offset2, length1, length2;
@ -564,7 +564,7 @@ void receiveValue(int valueOffset, byte newValue)
}
break;
case boostvvtPage: //Boost and VVT maps (8x8)
case boostvvtPage: //Boost, VVT and staging maps (all 8x8)
if (valueOffset < 64) //New value is part of the boost map
{
boostTable.values[7 - (valueOffset / 8)][valueOffset % 8] = newValue;
@ -577,6 +577,7 @@ void receiveValue(int valueOffset, byte newValue)
{
boostTable.axisY[(7 - (valueOffset - 72))] = int(newValue); //TABLE_LOAD_MULTIPLIER is NOT used for boost as it is TPS based (0-100)
}
//End of boost table
else if (valueOffset < 144) //New value is part of the vvt map
{
tempOffset = valueOffset - 80;
@ -587,11 +588,27 @@ void receiveValue(int valueOffset, byte newValue)
tempOffset = valueOffset - 144;
vvtTable.axisX[tempOffset] = int(newValue) * TABLE_RPM_MULTIPLIER; //The RPM values sent by TunerStudio are divided by 100, need to multiply it back by 100 to make it correct (TABLE_RPM_MULTIPLIER)
}
else if (valueOffset < 161) //New value is on the Y (Load) axis of the vvt table
else if (valueOffset < 160) //New value is on the Y (Load) axis of the vvt table
{
tempOffset = valueOffset - 152;
vvtTable.axisY[(7 - tempOffset)] = int(newValue); //TABLE_LOAD_MULTIPLIER is NOT used for vvt as it is TPS based (0-100)
}
//End of vvt table
else if (valueOffset < 224) //New value is part of the staging map
{
tempOffset = valueOffset - 160;
stagingTable.values[7 - (tempOffset / 8)][tempOffset % 8] = newValue;
}
else if (valueOffset < 232) //New value is on the X (RPM) axis of the staging table
{
tempOffset = valueOffset - 224;
stagingTable.axisX[tempOffset] = int(newValue) * TABLE_RPM_MULTIPLIER; //The RPM values sent by TunerStudio are divided by 100, need to multiply it back by 100 to make it correct (TABLE_RPM_MULTIPLIER)
}
else if (valueOffset < 240) //New value is on the Y (Load) axis of the staging table
{
tempOffset = valueOffset - 232;
stagingTable.axisY[(7 - tempOffset)] = int(newValue) * TABLE_LOAD_MULTIPLIER;
}
break;
case seqFuelPage:
@ -850,17 +867,23 @@ void sendPage(bool useChar)
else
{
//Need to perform a translation of the values[MAP/TPS][RPM] into the MS expected format
byte response[160]; //Bit hacky, but the size is: (8x8 + 8 + 8) + (8x8 + 8 + 8) = 160
byte response[80]; //Bit hacky, but send 1 map at a time (Each map is 8x8, so 64 + 8 + 8)
//Boost table
for (int x = 0; x < 64; x++) { response[x] = boostTable.values[7 - (x / 8)][x % 8]; }
for (int x = 64; x < 72; x++) { response[x] = byte(boostTable.axisX[(x - 64)] / TABLE_RPM_MULTIPLIER); }
for (int y = 72; y < 80; y++) { response[y] = byte(boostTable.axisY[7 - (y - 72)]); }
Serial.write((byte *)&response, 80);
//VVT table
for (int x = 0; x < 64; x++) { response[x + 80] = vvtTable.values[7 - (x / 8)][x % 8]; }
for (int x = 64; x < 72; x++) { response[x + 80] = byte(vvtTable.axisX[(x - 64)] / TABLE_RPM_MULTIPLIER); }
for (int y = 72; y < 80; y++) { response[y + 80] = byte(vvtTable.axisY[7 - (y - 72)]); }
Serial.write((byte *)&response, sizeof(response));
for (int x = 0; x < 64; x++) { response[x] = vvtTable.values[7 - (x / 8)][x % 8]; }
for (int x = 64; x < 72; x++) { response[x] = byte(vvtTable.axisX[(x - 64)] / TABLE_RPM_MULTIPLIER); }
for (int y = 72; y < 80; y++) { response[y] = byte(vvtTable.axisY[7 - (y - 72)]); }
Serial.write((byte *)&response, 80);
//Staging table
for (int x = 0; x < 64; x++) { response[x] = stagingTable.values[7 - (x / 8)][x % 8]; }
for (int x = 64; x < 72; x++) { response[x] = byte(stagingTable.axisX[(x - 64)] / TABLE_RPM_MULTIPLIER); }
for (int y = 72; y < 80; y++) { response[y] = byte(stagingTable.axisY[7 - (y - 72)] / TABLE_LOAD_MULTIPLIER); }
Serial.write((byte *)&response, 80);
sendComplete = true;
}
break;
@ -1124,7 +1147,7 @@ byte getPageValue(byte page, uint16_t valueAddress)
else if(valueAddress < 72) { returnValue = byte(boostTable.axisX[(valueAddress - 64)] / TABLE_RPM_MULTIPLIER); }
else if(valueAddress < 80) { returnValue = byte(boostTable.axisY[7 - (valueAddress - 72)]); }
}
else
else if(valueAddress < 160)
{
tempAddress = valueAddress - 80;
//VVT table
@ -1132,6 +1155,14 @@ byte getPageValue(byte page, uint16_t valueAddress)
else if(tempAddress < 72) { returnValue = byte(vvtTable.axisX[(tempAddress - 64)] / TABLE_RPM_MULTIPLIER); }
else if(tempAddress < 80) { returnValue = byte(vvtTable.axisY[7 - (tempAddress - 72)]); }
}
else
{
tempAddress = valueAddress - 160;
//Staging table
if(tempAddress < 64) { returnValue = stagingTable.values[7 - (tempAddress / 8)][tempAddress % 8]; }
else if(tempAddress < 72) { returnValue = byte(stagingTable.axisX[(tempAddress - 64)] / TABLE_RPM_MULTIPLIER); }
else if(tempAddress < 80) { returnValue = byte(stagingTable.axisY[7 - (tempAddress - 72)] / TABLE_LOAD_MULTIPLIER); }
}
}
break;

View File

@ -152,13 +152,14 @@ const char TSfirmwareVersion[] = "Speeduino 2016.09";
const byte data_structure_version = 2; //This identifies the data structure when reading / writing.
//const byte page_size = 64;
const int16_t npage_size[11] = {0,288,128,288,128,288,128,160,192,128,192};
const int16_t npage_size[11] = {0,288,128,288,128,288,128,240,192,128,192};
//const byte page11_size = 128;
#define MAP_PAGE_SIZE 288
struct table3D fuelTable; //16x16 fuel map
struct table3D ignitionTable; //16x16 ignition map
struct table3D afrTable; //16x16 afr target map
struct table3D stagingTable; //8x8 fuel staging table
struct table3D boostTable; //8x8 boost map
struct table3D vvtTable; //8x8 vvt map
struct table3D trim1Table; //6x6 Fuel trim 1 map
@ -621,7 +622,9 @@ struct config11 {
byte crankingEnrichValues[4];
byte rotaryType : 2;
byte unused11_8c : 6;
byte stagingEnabled : 1;
byte stagingMode : 1;
byte unused11_8e : 4;
byte rotarySplitValues[8];
byte rotarySplitBins[8];
@ -701,6 +704,7 @@ extern struct statuses currentStatus; // from speeduino.ino
extern struct table3D fuelTable; //16x16 fuel map
extern struct table3D ignitionTable; //16x16 ignition map
extern struct table3D afrTable; //16x16 afr target map
extern struct table3D stagingTable; //8x8 afr target map
extern struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
extern struct table2D WUETable; //10 bin Warm Up Enrichment map (2D)
extern struct table2D crankingEnrichTable; //4 bin cranking Enrichment map (2D)

View File

@ -131,6 +131,7 @@ void setup()
table3D_setSize(&fuelTable, 16);
table3D_setSize(&ignitionTable, 16);
table3D_setSize(&afrTable, 16);
table3D_setSize(&stagingTable, 8);
table3D_setSize(&boostTable, 8);
table3D_setSize(&vvtTable, 8);
table3D_setSize(&trim1Table, 6);

View File

@ -94,32 +94,38 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
#define EEPROM_CONFIG8_MAP2 1339
#define EEPROM_CONFIG8_XBINS2 1403
#define EEPROM_CONFIG8_YBINS2 1411
#define EEPROM_CONFIG8_END 1419
#define EEPROM_CONFIG9_XSIZE1 1419
#define EEPROM_CONFIG9_YSIZE1 1420
#define EEPROM_CONFIG9_MAP1 1421
#define EEPROM_CONFIG9_XBINS1 1457
#define EEPROM_CONFIG9_YBINS1 1463
#define EEPROM_CONFIG9_XSIZE2 1469
#define EEPROM_CONFIG9_YSIZE2 1470
#define EEPROM_CONFIG9_MAP2 1471
#define EEPROM_CONFIG9_XBINS2 1507
#define EEPROM_CONFIG9_YBINS2 1513
#define EEPROM_CONFIG9_XSIZE3 1519
#define EEPROM_CONFIG9_YSIZE3 1520
#define EEPROM_CONFIG9_MAP3 1521
#define EEPROM_CONFIG9_XBINS3 1557
#define EEPROM_CONFIG9_YBINS3 1563
#define EEPROM_CONFIG9_XSIZE4 1569
#define EEPROM_CONFIG9_YSIZE4 1570
#define EEPROM_CONFIG9_MAP4 1571
#define EEPROM_CONFIG9_XBINS4 1607
#define EEPROM_CONFIG9_YBINS4 1613
#define EEPROM_CONFIG10_START 1628
#define EEPROM_CONFIG10_END 1756
#define EEPROM_CONFIG11_START 1756
#define EEPROM_CONFIG11_END 1948
#define EEPROM_CONFIG8_XSIZE3 1419
#define EEPROM_CONFIG8_YSIZE3 1420
#define EEPROM_CONFIG8_MAP3 1421
#define EEPROM_CONFIG8_XBINS3 1485
#define EEPROM_CONFIG8_YBINS3 1493
#define EEPROM_CONFIG8_END 1501
#define EEPROM_CONFIG9_XSIZE1 1501
#define EEPROM_CONFIG9_YSIZE1 1502
#define EEPROM_CONFIG9_MAP1 1503
#define EEPROM_CONFIG9_XBINS1 1539
#define EEPROM_CONFIG9_YBINS1 1545
#define EEPROM_CONFIG9_XSIZE2 1551
#define EEPROM_CONFIG9_YSIZE2 1552
#define EEPROM_CONFIG9_MAP2 1553
#define EEPROM_CONFIG9_XBINS2 1589
#define EEPROM_CONFIG9_YBINS2 1595
#define EEPROM_CONFIG9_XSIZE3 1601
#define EEPROM_CONFIG9_YSIZE3 1602
#define EEPROM_CONFIG9_MAP3 1603
#define EEPROM_CONFIG9_XBINS3 1639
#define EEPROM_CONFIG9_YBINS3 1645
#define EEPROM_CONFIG9_XSIZE4 1651
#define EEPROM_CONFIG9_YSIZE4 1652
#define EEPROM_CONFIG9_MAP4 1653
#define EEPROM_CONFIG9_XBINS4 1689
#define EEPROM_CONFIG9_YBINS4 1695
#define EEPROM_CONFIG10_START 1710
#define EEPROM_CONFIG10_END 1838
#define EEPROM_CONFIG11_START 1838
#define EEPROM_CONFIG11_END 2030
//Calibration data is stored at the end of the EEPROM (This is in case any further calibration tables are needed as they are large blocks)
#define EEPROM_LAST_BARO 2558

View File

@ -211,8 +211,11 @@ void writeConfig(byte tableNum)
if(EEPROM.read(EEPROM_CONFIG8_YSIZE1) != boostTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE1,boostTable.ySize); writeCounter++; } //Write the boost Table MAP/TPS dimension size
if(EEPROM.read(EEPROM_CONFIG8_XSIZE2) != vvtTable.xSize) { EEPROM.write(EEPROM_CONFIG8_XSIZE2,vvtTable.xSize); writeCounter++; } //Write the vvt Table RPM dimension size
if(EEPROM.read(EEPROM_CONFIG8_YSIZE2) != vvtTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE2,vvtTable.ySize); writeCounter++; } //Write the vvt Table MAP/TPS dimension size
if(EEPROM.read(EEPROM_CONFIG8_XSIZE3) != stagingTable.xSize) { EEPROM.write(EEPROM_CONFIG8_XSIZE3,stagingTable.xSize); writeCounter++; } //Write the staging Table RPM dimension size
if(EEPROM.read(EEPROM_CONFIG8_YSIZE3) != stagingTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE3,stagingTable.ySize); writeCounter++; } //Write the staging Table MAP/TPS dimension size
y = EEPROM_CONFIG8_MAP2; //We do the 2 maps together in the same loop
y = EEPROM_CONFIG8_MAP2; //We do the 3 maps together in the same loop
z = EEPROM_CONFIG8_MAP3;
for(int x=EEPROM_CONFIG8_MAP1; x<EEPROM_CONFIG8_XBINS1; x++)
{
if( (writeCounter > EEPROM_MAX_WRITE_BLOCK) ) { break; } //This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
@ -220,10 +223,14 @@ void writeConfig(byte tableNum)
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
offset = z - EEPROM_CONFIG8_MAP3;
if(EEPROM.read(z) != (stagingTable.values[7-(offset/8)][offset%8]) ) { EEPROM.write(z, stagingTable.values[7-(offset/8)][offset%8]); writeCounter++; } //Write the 8x8 map
y++;
z++;
}
//RPM bins
y = EEPROM_CONFIG8_XBINS2;
z = EEPROM_CONFIG8_XBINS3;
for(int x=EEPROM_CONFIG8_XBINS1; x<EEPROM_CONFIG8_YBINS1; x++)
{
if( (writeCounter > EEPROM_MAX_WRITE_BLOCK) ) { break; } //This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
@ -231,10 +238,14 @@ void writeConfig(byte tableNum)
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
offset = z - EEPROM_CONFIG8_XBINS3;
if(EEPROM.read(z) != byte(stagingTable.axisX[offset]/TABLE_RPM_MULTIPLIER)) { EEPROM.write(z, byte(stagingTable.axisX[offset]/TABLE_RPM_MULTIPLIER)); writeCounter++; } //RPM bins are divided by 100 and converted to a byte
y++;
z++;
}
//TPS/MAP bins
y=EEPROM_CONFIG8_YBINS2;
z=EEPROM_CONFIG8_YBINS3;
for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_XSIZE2; x++)
{
if( (writeCounter > EEPROM_MAX_WRITE_BLOCK) ) { break; } //This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
@ -242,7 +253,10 @@ void writeConfig(byte tableNum)
if(EEPROM.read(x) != boostTable.axisY[offset]) { EEPROM.write(x, boostTable.axisY[offset]); writeCounter++; } //TABLE_LOAD_MULTIPLIER is NOT used for boost as it is TPS based (0-100)
offset = y - EEPROM_CONFIG8_YBINS2;
if(EEPROM.read(y) != vvtTable.axisY[offset]) { EEPROM.write(y, vvtTable.axisY[offset]); writeCounter++; } //TABLE_LOAD_MULTIPLIER is NOT used for VVT as it is TPS based (0-100)
offset = z - EEPROM_CONFIG8_YBINS3;
if(EEPROM.read(z) != byte(stagingTable.axisY[offset]/TABLE_LOAD_MULTIPLIER)) { EEPROM.write(z, byte(stagingTable.axisY[offset]/TABLE_LOAD_MULTIPLIER)); writeCounter++; } //RPM bins are divided by 100 and converted to a byte
y++;
z++;
}
if(writeCounter > EEPROM_MAX_WRITE_BLOCK) { eepromWritesPending = true; }
@ -467,41 +481,53 @@ void loadConfig()
//*********************************************************************************************************************************************************************************
// Boost and vvt tables load
int y = EEPROM_CONFIG8_MAP2;
int z = EEPROM_CONFIG8_MAP3;
for(int x=EEPROM_CONFIG8_MAP1; x<EEPROM_CONFIG8_XBINS1; x++)
{
offset = x - EEPROM_CONFIG8_MAP1;
boostTable.values[7-(offset/8)][offset%8] = EEPROM.read(x); //Read the 8x8 map
offset = y - EEPROM_CONFIG8_MAP2;
vvtTable.values[7-(offset/8)][offset%8] = EEPROM.read(y); //Read the 8x8 map
offset = z - EEPROM_CONFIG8_MAP3;
stagingTable.values[7-(offset/8)][offset%8] = EEPROM.read(z); //Read the 8x8 map
y++;
z++;
}
//RPM bins
y = EEPROM_CONFIG8_XBINS2;
z = EEPROM_CONFIG8_XBINS3;
for(int x=EEPROM_CONFIG8_XBINS1; x<EEPROM_CONFIG8_YBINS1; x++)
{
offset = x - EEPROM_CONFIG8_XBINS1;
boostTable.axisX[offset] = (EEPROM.read(x) * TABLE_RPM_MULTIPLIER); //RPM bins are divided by 100 when stored. Multiply them back now
offset = y - EEPROM_CONFIG8_XBINS2;
vvtTable.axisX[offset] = (EEPROM.read(y) * TABLE_RPM_MULTIPLIER); //RPM bins are divided by 100 when stored. Multiply them back now
offset = z - EEPROM_CONFIG8_XBINS3;
stagingTable.axisX[offset] = (EEPROM.read(z) * TABLE_RPM_MULTIPLIER); //RPM bins are divided by 100 when stored. Multiply them back now
y++;
z++;
}
//TPS/MAP bins
y = EEPROM_CONFIG8_YBINS2;
z = EEPROM_CONFIG8_YBINS3;
for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_XSIZE2; x++)
{
offset = x - EEPROM_CONFIG8_YBINS1;
boostTable.axisY[offset] = EEPROM.read(x); //TABLE_LOAD_MULTIPLIER is NOT used for boost as it is TPS based (0-100)
offset = y - EEPROM_CONFIG8_YBINS2;
vvtTable.axisY[offset] = EEPROM.read(y); //TABLE_LOAD_MULTIPLIER is NOT used for VVT as it is TPS based (0-100)
offset = z - EEPROM_CONFIG8_YBINS2;
stagingTable.axisY[offset] = EEPROM.read(z) * TABLE_LOAD_MULTIPLIER;
y++;
z++;
}
//*********************************************************************************************************************************************************************************
// Fuel trim tables load
y = EEPROM_CONFIG9_MAP2;
int z = EEPROM_CONFIG9_MAP3;
z = EEPROM_CONFIG9_MAP3;
int i = EEPROM_CONFIG9_MAP4;
for(int x=EEPROM_CONFIG9_MAP1; x<EEPROM_CONFIG9_XBINS1; x++)
{

View File

@ -8,7 +8,7 @@
void doUpdates()
{
#define CURRENT_DATA_VERSION 6
#define CURRENT_DATA_VERSION 7
//May 2017 firmware introduced a -40 offset on the ignition table. Update that table to +40
if(EEPROM.read(EEPROM_DATA_VERSION) == 2)
@ -76,6 +76,21 @@ void doUpdates()
EEPROM.write(EEPROM_DATA_VERSION, 6);
loadConfig(); //Reload the config after changing everything in EEPROM
}
//November 2017 added the staging table that comes after boost and vvt in the EEPROM. This required multiple pieces of data being moved around
if(EEPROM.read(EEPROM_DATA_VERSION) == 6)
{
//Data after page 8 has to move back 82 bytes
for(int x=0; x < 529; x++)
{
int endMem = EEPROM_CONFIG11_END - x;
int startMem = endMem - 82; //
byte currentVal = EEPROM.read(startMem);
EEPROM.update(endMem, currentVal);
}
EEPROM.write(EEPROM_DATA_VERSION, 7);
loadConfig(); //Reload the config after changing everything in EEPROM
}
//Final check is always for 255 and 0 (Brand new arduino)
if( (EEPROM.read(EEPROM_DATA_VERSION) == 0) || (EEPROM.read(EEPROM_DATA_VERSION) == 255) )