Add fuel trim tables 5-8

This commit is contained in:
Josh Stewart 2021-02-15 16:01:28 +11:00
parent f76b9073b6
commit 57ebf498a1
9 changed files with 242 additions and 15 deletions

View File

@ -186,7 +186,7 @@
endianness = little
nPages = 14
pageSize = 128, 288, 288, 128, 288, 128, 240, 192, 192, 192, 288, 192, 128, 288
pageSize = 128, 288, 288, 128, 288, 128, 240, 384, 192, 192, 288, 192, 128, 288
; New commands
pageIdentifier = "\$tsCanId\x01", "\$tsCanId\x02", "\$tsCanId\x03", "\$tsCanId\x04", "\$tsCanId\x05", "\$tsCanId\x06", "\$tsCanId\x07", "\$tsCanId\x08", "\$tsCanId\x09", "\$tsCanId\x0A", "\$tsCanId\x0B", "\$tsCanId\x0C", "\$tsCanId\x0D", "\$tsCanId\x0E"
@ -715,6 +715,22 @@ page = 8
fuelTrim4rpmBins = array, U08, 180,[ 6], "RPM", 100.0, 0.0, 0, 25500, 0
fuelTrim4loadBins = array, U08, 186,[ 6], { bitStringValue(algorithmUnits , algorithm) }, 2.0, 0.0, 0.0, {fuelLoadMax}, 0
fuelTrim5Table = array, U08, 192,[6x6], "%", 1.0, -128, -50, 50, 0
fuelTrim5rpmBins = array, U08, 228,[ 6], "RPM", 100.0, 0.0, 0, 25500, 0
fuelTrim5loadBins = array, U08, 234,[ 6], { bitStringValue(algorithmUnits , algorithm) }, 2.0, 0.0, 0.0, {fuelLoadMax}, 0
fuelTrim6Table = array, U08, 240,[6x6], "%", 1.0, -128, -50, 50, 0
fuelTrim6rpmBins = array, U08, 276,[ 6], "RPM", 100.0, 0.0, 0, 25500, 0
fuelTrim6loadBins = array, U08, 282,[ 6], { bitStringValue(algorithmUnits , algorithm) }, 2.0, 0.0, 0.0, {fuelLoadMax}, 0
fuelTrim7Table = array, U08, 288,[6x6], "%", 1.0, -128, -50, 50, 0
fuelTrim7rpmBins = array, U08, 324,[ 6], "RPM", 100.0, 0.0, 0, 25500, 0
fuelTrim7loadBins = array, U08, 330,[ 6], { bitStringValue(algorithmUnits , algorithm) }, 2.0, 0.0, 0.0, {fuelLoadMax}, 0
fuelTrim8Table = array, U08, 336,[6x6], "%", 1.0, -128, -50, 50, 0
fuelTrim8rpmBins = array, U08, 372,[ 6], "RPM", 100.0, 0.0, 0, 25500, 0
fuelTrim8loadBins = array, U08, 378,[ 6], { bitStringValue(algorithmUnits , algorithm) }, 2.0, 0.0, 0.0, {fuelLoadMax}, 0
;--------------------------------------------------
;CANBUS control and Auxillary io(Page 9)
;--------------------------------------------------
@ -1570,7 +1586,10 @@ menuDialog = main
subMenu = std_separator
subMenu = fuelTable2Dialog, "Second fuel Table", 11
subMenu = sparkTable2Dialog, "Second spark Table", 14
subMenu = inj_trimad, "Sequential fuel trim", 9
subMenu = std_separator
subMenu = inj_trimad, "Sequential fuel trim (1-4)", 9
subMenu = inj_trimad_B, "Sequential fuel trim (5-8)", 9, { nFuelChannels >= 5 }
subMenu = std_separator
subMenu = stagingTableDialog, "Staged Injection", 10, { nCylinders <= 4 } ; Can't do staging on more than 4 cylinder engines
subMenu = std_separator
subMenu = fuelTemp_curve, "Fuel Temp Correction", { flexEnabled }
@ -2860,6 +2879,14 @@ menuDialog = main
panel = fuelTrimTable3Tbl, { fuelTrimEnabled }
dialog = inj_trim4TblTitle, "Channel #4"
panel = fuelTrimTable4Tbl, { fuelTrimEnabled }
dialog = inj_trim5TblTitle, "Channel #5"
panel = fuelTrimTable5Tbl, { fuelTrimEnabled }
dialog = inj_trim6TblTitle, "Channel #6"
panel = fuelTrimTable6Tbl, { fuelTrimEnabled }
dialog = inj_trim7TblTitle, "Channel #7"
panel = fuelTrimTable7Tbl, { fuelTrimEnabled }
dialog = inj_trim8TblTitle, "Channel #8"
panel = fuelTrimTable8Tbl, { fuelTrimEnabled }
dialog = inj_trimadt, "", xAxis
panel = inj_trim1TblTitle
@ -2867,15 +2894,26 @@ menuDialog = main
dialog = inj_trimadb, "", xAxis
panel = inj_trim3TblTitle
panel = inj_trim4TblTitle
dialog = inj_trimadt_B, "", xAxis
panel = inj_trim5TblTitle
panel = inj_trim6TblTitle
dialog = inj_trimadb_B, "", xAxis
panel = inj_trim7TblTitle
panel = inj_trim8TblTitle
dialog = inj_trim_enable, ""
field = "Individual fuel trim enabled", fuelTrimEnabled, { injLayout == 3 && nCylinders <= 4 }
field = "Individual fuel trim enabled", fuelTrimEnabled, { injLayout == 3 && nCylinders <= nFuelChannels }
dialog = inj_trimad,"Injector Cyl 1-4 Trims", yAxis
panel = inj_trim_enable, North
panel = inj_trimadt, Center
panel = inj_trimadb, South
dialog = inj_trimad_B,"Injector Cyl 5-8 Trims", yAxis
panel = inj_trim_enable, North
panel = inj_trimadt_B, Center
panel = inj_trimadb_B, South
;;Injector staging
dialog = stagingTableDialog_north, ""
field = "Staging enabled", stagingEnabled
@ -4344,7 +4382,6 @@ cmdVSSratio6 = "E\x99\x06"
xBins = fuelTrim1rpmBins, rpm
yBins = fuelTrim1loadBins, fuelLoad
zBins = fuelTrim1Table
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
@ -4354,7 +4391,6 @@ cmdVSSratio6 = "E\x99\x06"
xBins = fuelTrim2rpmBins, rpm
yBins = fuelTrim2loadBins, fuelLoad
zBins = fuelTrim2Table
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
@ -4364,20 +4400,54 @@ cmdVSSratio6 = "E\x99\x06"
xBins = fuelTrim3rpmBins, rpm
yBins = fuelTrim3loadBins, fuelLoad
zBins = fuelTrim3Table
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
table = fuelTrimTable4Tbl, fuelTrimTable4Map, "Fuel trim Table 4", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
xBins = fuelTrim4rpmBins, rpm
yBins = fuelTrim4loadBins, fuelLoad
zBins = fuelTrim4Table
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
table = fuelTrimTable5Tbl, fuelTrimTable5Map, "Fuel trim Table 5", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
xBins = fuelTrim5rpmBins, rpm
yBins = fuelTrim5loadBins, fuelLoad
zBins = fuelTrim5Table
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
table = fuelTrimTable6Tbl, fuelTrimTable6Map, "Fuel trim Table 6", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
xBins = fuelTrim6rpmBins, rpm
yBins = fuelTrim6loadBins, fuelLoad
zBins = fuelTrim6Table
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
table = fuelTrimTable7Tbl, fuelTrimTable7Map, "Fuel trim Table 7", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
xBins = fuelTrim7rpmBins, rpm
yBins = fuelTrim7loadBins, fuelLoad
zBins = fuelTrim7Table
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
table = fuelTrimTable8Tbl, fuelTrimTable8Map, "Fuel trim Table 8", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
xBins = fuelTrim8rpmBins, rpm
yBins = fuelTrim8loadBins, fuelLoad
zBins = fuelTrim8Table
gridHeight = 2.0
gridOrient = 250, 0, 340
upDownLabel = "(RICHER)", "(LEANER)"
table = dwell_map, dwell_tblMap, "Dwell map", 4
xBins = rpmBinsDwell, rpm

View File

@ -1238,11 +1238,31 @@ void receiveValue(uint16_t valueOffset, byte newValue)
else if (valueOffset < 180) { tempOffset = valueOffset - 144; trim4Table.values[5 - (tempOffset / 6)][tempOffset % 6] = newValue; } //New value is part of the trim4 map
else if (valueOffset < 186) { tempOffset = valueOffset - 180; trim4Table.axisX[tempOffset] = int(newValue) * TABLE_RPM_MULTIPLIER; } //New value is on the X (RPM) axis of the table. 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 < 192) { tempOffset = valueOffset - 186; trim4Table.axisY[(5 - tempOffset)] = int(newValue) * TABLE_LOAD_MULTIPLIER; } //New value is on the Y (Load) axis of the table
//Trim table 5
else if (valueOffset < 228) { tempOffset = valueOffset - 192; trim5Table.values[5 - (tempOffset / 6)][tempOffset % 6] = newValue; } //New value is part of the trim5 map
else if (valueOffset < 234) { tempOffset = valueOffset - 228; trim5Table.axisX[tempOffset] = int(newValue) * TABLE_RPM_MULTIPLIER; } //New value is on the X (RPM) axis of the table. 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) { tempOffset = valueOffset - 234; trim5Table.axisY[(5 - tempOffset)] = int(newValue) * TABLE_LOAD_MULTIPLIER; } //New value is on the Y (Load) axis of the table
//Trim table 6
else if (valueOffset < 276) { tempOffset = valueOffset - 240; trim6Table.values[5 - (tempOffset / 6)][tempOffset % 6] = newValue; } //New value is part of the trim6 map
else if (valueOffset < 282) { tempOffset = valueOffset - 276; trim6Table.axisX[tempOffset] = int(newValue) * TABLE_RPM_MULTIPLIER; } //New value is on the X (RPM) axis of the table. 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 < 288) { tempOffset = valueOffset - 282; trim6Table.axisY[(5 - tempOffset)] = int(newValue) * TABLE_LOAD_MULTIPLIER; } //New value is on the Y (Load) axis of the table
//Trim table 7
else if (valueOffset < 324) { tempOffset = valueOffset - 288; trim7Table.values[5 - (tempOffset / 6)][tempOffset % 6] = newValue; } //New value is part of the trim7 map
else if (valueOffset < 330) { tempOffset = valueOffset - 324; trim7Table.axisX[tempOffset] = int(newValue) * TABLE_RPM_MULTIPLIER; } //New value is on the X (RPM) axis of the table. 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 < 336) { tempOffset = valueOffset - 330; trim7Table.axisY[(5 - tempOffset)] = int(newValue) * TABLE_LOAD_MULTIPLIER; } //New value is on the Y (Load) axis of the table
//Trim table 8
else if (valueOffset < 372) { tempOffset = valueOffset - 336; trim8Table.values[5 - (tempOffset / 6)][tempOffset % 6] = newValue; } //New value is part of the trim8 map
else if (valueOffset < 378) { tempOffset = valueOffset - 372; trim8Table.axisX[tempOffset] = int(newValue) * TABLE_RPM_MULTIPLIER; } //New value is on the X (RPM) axis of the table. 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 < 384) { tempOffset = valueOffset - 378; trim8Table.axisY[(5 - tempOffset)] = int(newValue) * TABLE_LOAD_MULTIPLIER; } //New value is on the Y (Load) axis of the table
trim1Table.cacheIsValid = false; //Invalid the tables cache to ensure a lookup of new values
trim2Table.cacheIsValid = false; //Invalid the tables cache to ensure a lookup of new values
trim3Table.cacheIsValid = false; //Invalid the tables cache to ensure a lookup of new values
trim4Table.cacheIsValid = false; //Invalid the tables cache to ensure a lookup of new values
trim5Table.cacheIsValid = false; //Invalid the tables cache to ensure a lookup of new values
trim6Table.cacheIsValid = false; //Invalid the tables cache to ensure a lookup of new values
trim7Table.cacheIsValid = false; //Invalid the tables cache to ensure a lookup of new values
trim8Table.cacheIsValid = false; //Invalid the tables cache to ensure a lookup of new values
break;
case canbusPage:
@ -1426,7 +1446,7 @@ void sendPage()
case seqFuelPage:
{
//Need to perform a translation of the values[MAP/TPS][RPM] into the MS expected format
byte response[192]; //Bit hacky, but the size is: (6x6 + 6 + 6) * 4 = 192
byte response[384]; //Bit hacky, but the size is: (6x6 + 6 + 6) * 8 = 384
//trim1 table
for (int x = 0; x < 36; x++) { response[x] = trim1Table.values[5 - (x / 6)][x % 6]; }
@ -1444,6 +1464,23 @@ void sendPage()
for (int x = 0; x < 36; x++) { response[x + 144] = trim4Table.values[5 - (x / 6)][x % 6]; }
for (int x = 36; x < 42; x++) { response[x + 144] = byte(trim4Table.axisX[(x - 36)] / TABLE_RPM_MULTIPLIER); }
for (int y = 42; y < 48; y++) { response[y + 144] = byte(trim4Table.axisY[5 - (y - 42)] / TABLE_LOAD_MULTIPLIER); }
//trim5 table
for (int x = 0; x < 36; x++) { response[x + 192] = trim5Table.values[5 - (x / 6)][x % 6]; }
for (int x = 36; x < 42; x++) { response[x + 192] = byte(trim5Table.axisX[(x - 36)] / TABLE_RPM_MULTIPLIER); }
for (int y = 42; y < 48; y++) { response[y + 192] = byte(trim5Table.axisY[5 - (y - 42)] / TABLE_LOAD_MULTIPLIER); }
//trim6 table
for (int x = 0; x < 36; x++) { response[x + 240] = trim6Table.values[5 - (x / 6)][x % 6]; }
for (int x = 36; x < 42; x++) { response[x + 240] = byte(trim6Table.axisX[(x - 36)] / TABLE_RPM_MULTIPLIER); }
for (int y = 42; y < 48; y++) { response[y + 240] = byte(trim6Table.axisY[5 - (y - 42)] / TABLE_LOAD_MULTIPLIER); }
//trim7 table
for (int x = 0; x < 36; x++) { response[x + 288] = trim7Table.values[5 - (x / 6)][x % 6]; }
for (int x = 36; x < 42; x++) { response[x + 288] = byte(trim7Table.axisX[(x - 36)] / TABLE_RPM_MULTIPLIER); }
for (int y = 42; y < 48; y++) { response[y + 288] = byte(trim7Table.axisY[5 - (y - 42)] / TABLE_LOAD_MULTIPLIER); }
//trim8 table
for (int x = 0; x < 36; x++) { response[x + 336] = trim8Table.values[5 - (x / 6)][x % 6]; }
for (int x = 36; x < 42; x++) { response[x + 336] = byte(trim8Table.axisX[(x - 36)] / TABLE_RPM_MULTIPLIER); }
for (int y = 42; y < 48; y++) { response[y + 336] = byte(trim8Table.axisY[5 - (y - 42)] / TABLE_LOAD_MULTIPLIER); }
Serial.write((byte *)&response, sizeof(response));
sendComplete = true;
break;
@ -1998,6 +2035,38 @@ byte getPageValue(byte page, uint16_t valueAddress)
else if(tempAddress < 42) { returnValue = byte(trim4Table.axisX[(tempAddress - 36)] / TABLE_RPM_MULTIPLIER); }
else if(tempAddress < 48) { returnValue = byte(trim4Table.axisY[5 - (tempAddress - 42)] / TABLE_LOAD_MULTIPLIER); }
}
else if(valueAddress < 240)
{
tempAddress = valueAddress - 192;
//trim5 table
if(tempAddress < 36) { returnValue = trim5Table.values[5 - (tempAddress / 6)][tempAddress % 6]; }
else if(tempAddress < 42) { returnValue = byte(trim5Table.axisX[(tempAddress - 36)] / TABLE_RPM_MULTIPLIER); }
else if(tempAddress < 48) { returnValue = byte(trim5Table.axisY[5 - (tempAddress - 42)] / TABLE_LOAD_MULTIPLIER); }
}
else if(valueAddress < 288)
{
tempAddress = valueAddress - 240;
//trim6 table
if(tempAddress < 36) { returnValue = trim6Table.values[5 - (tempAddress / 6)][tempAddress % 6]; }
else if(tempAddress < 42) { returnValue = byte(trim6Table.axisX[(tempAddress - 36)] / TABLE_RPM_MULTIPLIER); }
else if(tempAddress < 48) { returnValue = byte(trim6Table.axisY[5 - (tempAddress - 42)] / TABLE_LOAD_MULTIPLIER); }
}
else if(valueAddress < 336)
{
tempAddress = valueAddress - 288;
//trim7 table
if(tempAddress < 36) { returnValue = trim7Table.values[5 - (tempAddress / 6)][tempAddress % 6]; }
else if(tempAddress < 42) { returnValue = byte(trim7Table.axisX[(tempAddress - 36)] / TABLE_RPM_MULTIPLIER); }
else if(tempAddress < 48) { returnValue = byte(trim7Table.axisY[5 - (tempAddress - 42)] / TABLE_LOAD_MULTIPLIER); }
}
else if(valueAddress < 385)
{
tempAddress = valueAddress - 336;
//trim8 table
if(tempAddress < 36) { returnValue = trim8Table.values[5 - (tempAddress / 6)][tempAddress % 6]; }
else if(tempAddress < 42) { returnValue = byte(trim8Table.axisX[(tempAddress - 36)] / TABLE_RPM_MULTIPLIER); }
else if(tempAddress < 48) { returnValue = byte(trim8Table.axisY[5 - (tempAddress - 42)] / TABLE_LOAD_MULTIPLIER); }
}
}
break;

View File

@ -373,6 +373,10 @@ extern struct table3D trim1Table; //6x6 Fuel trim 1 map
extern struct table3D trim2Table; //6x6 Fuel trim 2 map
extern struct table3D trim3Table; //6x6 Fuel trim 3 map
extern struct table3D trim4Table; //6x6 Fuel trim 4 map
extern struct table3D trim5Table; //6x6 Fuel trim 5 map
extern struct table3D trim6Table; //6x6 Fuel trim 6 map
extern struct table3D trim7Table; //6x6 Fuel trim 7 map
extern struct table3D trim8Table; //6x6 Fuel trim 8 map
extern struct table3D dwellTable; //4x4 Dwell map
extern struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
extern struct table2D maeTable;

View File

@ -3,7 +3,7 @@
const char TSfirmwareVersion[] PROGMEM = "Speeduino";
const byte data_structure_version = 2; //This identifies the data structure when reading / writing.
const uint16_t npage_size[NUM_PAGES] = {0,128,288,288,128,288,128,240,192,192,192,288,192,128,288}; /**< This array stores the size (in bytes) of each configuration page */
const uint16_t npage_size[NUM_PAGES] = {0,128,288,288,128,288,128,240,384,192,192,288,192,128,288}; /**< This array stores the size (in bytes) of each configuration page */
struct table3D fuelTable; //16x16 fuel map
struct table3D fuelTable2; //16x16 fuel map
@ -18,6 +18,10 @@ struct table3D trim1Table; //6x6 Fuel trim 1 map
struct table3D trim2Table; //6x6 Fuel trim 2 map
struct table3D trim3Table; //6x6 Fuel trim 3 map
struct table3D trim4Table; //6x6 Fuel trim 4 map
struct table3D trim5Table; //6x6 Fuel trim 5 map
struct table3D trim6Table; //6x6 Fuel trim 6 map
struct table3D trim7Table; //6x6 Fuel trim 7 map
struct table3D trim8Table; //6x6 Fuel trim 8 map
struct table3D dwellTable; //4x4 Dwell map
struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
struct table2D maeTable;

View File

@ -42,6 +42,10 @@ void initialiseAll()
table3D_setSize(&trim2Table, 6);
table3D_setSize(&trim3Table, 6);
table3D_setSize(&trim4Table, 6);
table3D_setSize(&trim5Table, 6);
table3D_setSize(&trim6Table, 6);
table3D_setSize(&trim7Table, 6);
table3D_setSize(&trim8Table, 6);
table3D_setSize(&dwellTable, 4);
#if defined(CORE_STM32)

View File

@ -616,6 +616,23 @@ void loop()
injector4StartAngle = calculateInjectorStartAngle(PWdivTimerPerDegree, channel4InjDegrees);
injector5StartAngle = calculateInjectorStartAngle(PWdivTimerPerDegree, channel5InjDegrees);
injector6StartAngle = calculateInjectorStartAngle(PWdivTimerPerDegree, channel6InjDegrees);
if(configPage6.fuelTrimEnabled > 0)
{
unsigned long pw1percent = 100 + (byte)get3DTableValue(&trim1Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw2percent = 100 + (byte)get3DTableValue(&trim2Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw3percent = 100 + (byte)get3DTableValue(&trim3Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw4percent = 100 + (byte)get3DTableValue(&trim4Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw5percent = 100 + (byte)get3DTableValue(&trim5Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw6percent = 100 + (byte)get3DTableValue(&trim6Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
if (pw1percent != 100) { currentStatus.PW1 = (pw1percent * currentStatus.PW1) / 100; }
if (pw2percent != 100) { currentStatus.PW2 = (pw2percent * currentStatus.PW2) / 100; }
if (pw3percent != 100) { currentStatus.PW3 = (pw3percent * currentStatus.PW3) / 100; }
if (pw4percent != 100) { currentStatus.PW4 = (pw4percent * currentStatus.PW4) / 100; }
if (pw5percent != 100) { currentStatus.PW5 = (pw5percent * currentStatus.PW5) / 100; }
if (pw6percent != 100) { currentStatus.PW6 = (pw6percent * currentStatus.PW6) / 100; }
}
}
#endif
break;
@ -638,6 +655,27 @@ void loop()
injector6StartAngle = calculateInjectorStartAngle(PWdivTimerPerDegree, channel6InjDegrees);
injector7StartAngle = calculateInjectorStartAngle(PWdivTimerPerDegree, channel7InjDegrees);
injector8StartAngle = calculateInjectorStartAngle(PWdivTimerPerDegree, channel8InjDegrees);
if(configPage6.fuelTrimEnabled > 0)
{
unsigned long pw1percent = 100 + (byte)get3DTableValue(&trim1Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw2percent = 100 + (byte)get3DTableValue(&trim2Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw3percent = 100 + (byte)get3DTableValue(&trim3Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw4percent = 100 + (byte)get3DTableValue(&trim4Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw5percent = 100 + (byte)get3DTableValue(&trim5Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw6percent = 100 + (byte)get3DTableValue(&trim6Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw7percent = 100 + (byte)get3DTableValue(&trim7Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
unsigned long pw8percent = 100 + (byte)get3DTableValue(&trim8Table, currentStatus.MAP, currentStatus.RPM) - OFFSET_FUELTRIM;
if (pw1percent != 100) { currentStatus.PW1 = (pw1percent * currentStatus.PW1) / 100; }
if (pw2percent != 100) { currentStatus.PW2 = (pw2percent * currentStatus.PW2) / 100; }
if (pw3percent != 100) { currentStatus.PW3 = (pw3percent * currentStatus.PW3) / 100; }
if (pw4percent != 100) { currentStatus.PW4 = (pw4percent * currentStatus.PW4) / 100; }
if (pw5percent != 100) { currentStatus.PW5 = (pw5percent * currentStatus.PW5) / 100; }
if (pw6percent != 100) { currentStatus.PW6 = (pw6percent * currentStatus.PW6) / 100; }
if (pw7percent != 100) { currentStatus.PW7 = (pw7percent * currentStatus.PW7) / 100; }
if (pw8percent != 100) { currentStatus.PW8 = (pw8percent * currentStatus.PW8) / 100; }
}
}
#endif
break;

View File

@ -178,6 +178,27 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
#define EEPROM_CONFIG14_XBINS 2966
#define EEPROM_CONFIG14_YBINS 2982
#define EEPROM_CONFIG14_END 2998
//This is OUT OF ORDER as Table 8 was expanded to add fuel trim 5-8. The EEPROM for them is simply added here so as not to impact existing tunes
#define EEPROM_CONFIG8_XSIZE5 2999
#define EEPROM_CONFIG8_YSIZE5 3000
#define EEPROM_CONFIG8_MAP5 3001
#define EEPROM_CONFIG8_XBINS5 3037
#define EEPROM_CONFIG8_YBINS5 3043
#define EEPROM_CONFIG8_XSIZE6 3049
#define EEPROM_CONFIG8_YSIZE6 3050
#define EEPROM_CONFIG8_MAP6 3051
#define EEPROM_CONFIG8_XBINS6 3087
#define EEPROM_CONFIG8_YBINS6 3093
#define EEPROM_CONFIG8_XSIZE7 3099
#define EEPROM_CONFIG8_YSIZE7 3100
#define EEPROM_CONFIG8_MAP7 3101
#define EEPROM_CONFIG8_XBINS7 3137
#define EEPROM_CONFIG8_YBINS7 3143
#define EEPROM_CONFIG8_XSIZE8 3149
#define EEPROM_CONFIG8_YSIZE8 3150
#define EEPROM_CONFIG8_MAP8 3151
#define EEPROM_CONFIG8_XBINS8 3187
#define EEPROM_CONFIG8_YBINS8 3193
//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)

View File

@ -196,6 +196,15 @@ void writeConfig(byte tableNum)
writeCounter = writeTable(&trim3Table, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER, index, writeCounter);
index = EEPROM_CONFIG8_XSIZE4;
writeCounter = writeTable(&trim4Table, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER, index, writeCounter);
index = EEPROM_CONFIG8_XSIZE5;
writeCounter = writeTable(&trim5Table, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER, index, writeCounter);
index = EEPROM_CONFIG8_XSIZE6;
writeCounter = writeTable(&trim6Table, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER, index, writeCounter);
index = EEPROM_CONFIG8_XSIZE7;
writeCounter = writeTable(&trim7Table, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER, index, writeCounter);
index = EEPROM_CONFIG8_XSIZE8;
writeCounter = writeTable(&trim8Table, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER, index, writeCounter);
eepromWritesPending = writeCounter > EEPROM_MAX_WRITE_BLOCK;
break;
@ -362,6 +371,10 @@ void loadConfig()
loadTable(&trim2Table, EEPROM_CONFIG8_MAP2, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER);
loadTable(&trim3Table, EEPROM_CONFIG8_MAP3, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER);
loadTable(&trim4Table, EEPROM_CONFIG8_MAP4, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER);
loadTable(&trim5Table, EEPROM_CONFIG8_MAP5, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER);
loadTable(&trim6Table, EEPROM_CONFIG8_MAP6, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER);
loadTable(&trim7Table, EEPROM_CONFIG8_MAP7, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER);
loadTable(&trim8Table, EEPROM_CONFIG8_MAP8, TABLE_RPM_MULTIPLIER, TABLE_LOAD_MULTIPLIER);
//*********************************************************************************************************************************************************************************
//canbus control page load

View File

@ -32,13 +32,17 @@ This file is used for everything related to maps/tables including their definiti
#define TABLE_TRIM2_SIZE 6;
#define TABLE_TRIM3_SIZE 6;
#define TABLE_TRIM4_SIZE 6;
#define TABLE_TRIM5_SIZE 6;
#define TABLE_TRIM6_SIZE 6;
#define TABLE_TRIM7_SIZE 6;
#define TABLE_TRIM8_SIZE 6;
#define TABLE_DWELL_SIZE 4;
/*
*********** WARNING! ***********
YOU MUST UPDATE THE TABLE COUNTS IN THE LINE BELOW WHENEVER A NEW TABLE IS ADDED!
*/
#define TABLE_HEAP_SIZE (5 * TABLE3D_SIZE_16) + (4 * TABLE3D_SIZE_8) + (4 * TABLE3D_SIZE_6) + (1 * TABLE3D_SIZE_4)+1
#define TABLE_HEAP_SIZE ((5 * TABLE3D_SIZE_16) + (4 * TABLE3D_SIZE_8) + (8 * TABLE3D_SIZE_6) + (1 * TABLE3D_SIZE_4) + 1)
static uint8_t _3DTable_heap[TABLE_HEAP_SIZE];
static uint16_t _heap_pointer = 0;