Fixes for trim table comms misalignment

This commit is contained in:
Josh Stewart 2016-11-01 12:37:00 +11:00
parent f0dcb0c756
commit 30a48dc364
4 changed files with 35 additions and 30 deletions

View File

@ -678,34 +678,35 @@ void sendPage(bool useChar)
break;
}
case seqFuelPage:
{
{
if(useChar)
{
currentTable = trim1Table;
currentTitleIndex = 121;
return;
//Do.... Something?
}
else
{
//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
//trim1 table
for (int x = 0; x < 36; x++) { response[x] = trim1Table.values[5 - x / 6][x % 6]; }
for (int x = 36; x < 42; x++) { response[x] = byte(trim1Table.axisX[(x - 36)] / 100); }
for (int y = 42; y < 48; y++) { response[y] = byte(trim1Table.axisY[5 - (y - 42)]); }
//trim2 table
for (int x = 48; x < 84; x++) { response[x] = trim2Table.values[5 - x / 6][x % 6]; }
for (int x = 84; x < 90; x++) { response[x] = byte(trim2Table.axisX[(x - 84)] / 100); }
for (int y = 90; y < 96; y++) { response[y] = byte(trim2Table.axisY[5 - (y - 90)]); }
for (int x = 0; x < 36; x++) { response[x + 48] = trim2Table.values[5 - x / 6][x % 6]; }
for (int x = 36; x < 42; x++) { response[x + 48] = byte(trim2Table.axisX[(x - 36)] / 100); }
for (int y = 42; y < 48; y++) { response[y + 48] = byte(trim2Table.axisY[5 - (y - 42)]); }
//trim3 table
for (int x = 96; x < 132; x++) { response[x] = trim3Table.values[5 - x / 6][x % 6]; }
for (int x = 132; x < 138; x++) { response[x] = byte(trim3Table.axisX[(x - 132)] / 100); }
for (int y = 138; y < 144; y++) { response[y] = byte(trim3Table.axisY[5 - (y - 138)]); }
for (int x = 0; x < 36; x++) { response[x + 96] = trim3Table.values[5 - x / 6][x % 6]; }
for (int x = 36; x < 42; x++) { response[x + 96] = byte(trim3Table.axisX[(x - 36)] / 100); }
for (int y = 42; y < 48; y++) { response[y + 96] = byte(trim3Table.axisY[5 - (y - 42)]); }
//trim4 table
for (int x = 144; x < 180; x++) { response[x] = trim4Table.values[5 - x / 6][x % 6]; }
for (int x = 180; x < 186; x++) { response[x] = byte(trim4Table.axisX[(x - 180)] / 100); }
for (int y = 186; y < 192; y++) { response[y] = byte(trim4Table.axisY[5 - (y - 186)]); }
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)] / 100); }
for (int y = 42; y < 48; y++) { response[y + 144] = byte(trim4Table.axisY[5 - (y - 42)]); }
Serial.write((byte *)&response, sizeof(response));
return;
}

View File

@ -360,7 +360,7 @@ struct config3 {
byte boostKD;
byte lnchPullRes : 2;
bool fuelTrimEnabled : 1;
byte fuelTrimEnabled : 1;
byte unused60 : 5;
byte unused61;
byte unused62;

View File

@ -163,6 +163,11 @@ page = 2
alternate = bits, U08, 26, [0:0], "Simultaneous", "Alternating"
multiplyMAP= bits, U08, 26, [1:1], "No", "Yes"
includeAFR = bits, U08, 26, [2:2], "No", "Yes"
unused2-26d= bits, U08, 26, [3:3], "No", "Yes"
unused2-26e= bits, U08, 26, [4:4], "No", "Yes"
unused2-26f= bits, U08, 26, [5:5], "No", "Yes"
unused2-26g= bits, U08, 26, [6:6], "No", "Yes"
unused2-26h= bits, U08, 26, [7:7], "No", "Yes"
injOpen = scalar, U08, 27, "ms", 0.1, 0.0, 0.1, 25.5, 1
inj1Ang = scalar, U16, 28, "deg", 1.0, 0.0, 0.0, 360, 0
inj2Ang = scalar, U16, 30, "deg", 1.0, 0.0, 0.0, 360, 0
@ -185,7 +190,7 @@ page = 2
flexEnabled= bits, U08, 38, [1:1], "Off", "On"
algorithm = bits, U08, 38, [2:2], "Speed Density", "Alpha-N"
baroCorr = bits, U08, 38, [3:3], "Off", "On"
injLayout = bits, U08, 38, [4:5], "Paired", "Semi-Sequential", "INVALID", "Sequential"
injLayout = bits, U08, 38, [4:5], "Paired", "Semi-Sequential", "Bank", "Sequential"
canEnable = bits, U08, 38, [6:6], "Disable", "Enable"
primePulse = scalar, U08, 39, "ms", 0.1, 0.0, 0.0, 25.5, 1
@ -735,7 +740,6 @@ menuDialog = main
; dialogs can be nested and can be mixed with fields
dialog = engine_constants_southwest, "Speeduino Board"
topicHelp = Mhelp
field = "Stoichiometric ratio", stoich
field = "Injector Layout", injLayout, { nCylinders <= 4 }
field = "Board Layout", pinLayout
@ -752,7 +756,7 @@ menuDialog = main
dialog = engine_constants_east, ""
panel = engine_constants_northeast, North
field = "", South
field = ""
dialog = engine_constants, "", border
panel = engine_constants_west, West
@ -1197,7 +1201,7 @@ menuDialog = main
upDownLabel = "HIGHER", "LOWER"
;--------- Sequential fuel trim maps -----------
table = fuelTrimTable1Tbl, fuelTrimTable1Map, "Fuel trim Table", 9
table = fuelTrimTable1Tbl, fuelTrimTable1Map, "Fuel trim Table 1", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
xBins = fuelTrim1rpmBins, rpm
#if SPEED_DENSITY
@ -1211,7 +1215,7 @@ menuDialog = main
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
upDownLabel = "(RICHER)", "(LEANER)"
table = fuelTrimTable2Tbl, fuelTrimTable2Map, "Fuel trim Table", 9
table = fuelTrimTable2Tbl, fuelTrimTable2Map, "Fuel trim Table 2", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
xBins = fuelTrim2rpmBins, rpm
#if SPEED_DENSITY
@ -1225,7 +1229,7 @@ menuDialog = main
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
upDownLabel = "(RICHER)", "(LEANER)"
table = fuelTrimTable3Tbl, fuelTrimTable3Map, "Fuel trim Table", 9
table = fuelTrimTable3Tbl, fuelTrimTable3Map, "Fuel trim Table 3", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
xBins = fuelTrim3rpmBins, rpm
#if SPEED_DENSITY
@ -1239,7 +1243,7 @@ menuDialog = main
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
upDownLabel = "(RICHER)", "(LEANER)"
table = fuelTrimTable4Tbl, fuelTrimTable4Map, "Fuel trim Table", 9
table = fuelTrimTable4Tbl, fuelTrimTable4Map, "Fuel trim Table 4", 9
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
xBins = fuelTrim4rpmBins, rpm
#if SPEED_DENSITY

View File

@ -73,6 +73,7 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
#define EEPROM_CONFIG8_XBINS2 1275
#define EEPROM_CONFIG8_YBINS2 1283
#define EEPROM_CONFIG8_END 1291
#define EEPROM_CONFIG9_XSIZE1 1291
#define EEPROM_CONFIG9_YSIZE1 1292
#define EEPROM_CONFIG9_MAP1 1293
@ -83,17 +84,16 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
#define EEPROM_CONFIG9_MAP2 1343
#define EEPROM_CONFIG9_XBINS2 1379
#define EEPROM_CONFIG9_YBINS2 1385
//BELOW VALUES NOT YET RIGHT!!
#define EEPROM_CONFIG9_XSIZE3 1341
#define EEPROM_CONFIG9_YSIZE3 1342
#define EEPROM_CONFIG9_MAP3 1343
#define EEPROM_CONFIG9_XBINS3 1379
#define EEPROM_CONFIG9_YBINS3 1385
#define EEPROM_CONFIG9_XSIZE4 1341
#define EEPROM_CONFIG9_YSIZE4 1342
#define EEPROM_CONFIG9_MAP4 1343
#define EEPROM_CONFIG9_XBINS4 1379
#define EEPROM_CONFIG9_YBINS4 1385
#define EEPROM_CONFIG9_XSIZE3 1391
#define EEPROM_CONFIG9_YSIZE3 1392
#define EEPROM_CONFIG9_MAP3 1393
#define EEPROM_CONFIG9_XBINS3 1429
#define EEPROM_CONFIG9_YBINS3 1435
#define EEPROM_CONFIG9_XSIZE4 1441
#define EEPROM_CONFIG9_YSIZE4 1442
#define EEPROM_CONFIG9_MAP4 1443
#define EEPROM_CONFIG9_XBINS4 1479
#define EEPROM_CONFIG9_YBINS4 1485
//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