Merge branch 'master' into pr/50
This commit is contained in:
commit
6fd80e5c35
|
@ -661,7 +661,7 @@ void sendPage(bool useChar)
|
|||
}
|
||||
case seqFuelPage:
|
||||
{
|
||||
byte response[200]; //Bit hacky, but the size is: (8x8 + 8 + 8) + (8x8 + 8 + 8) = 160
|
||||
byte response[200]; //The size is: (6x6 + 6 + 6) * 4 + 8 (Leftover values)
|
||||
|
||||
|
||||
for (int x = 0; x < 200; x++) { 0; }
|
||||
|
@ -748,9 +748,12 @@ void sendPage(bool useChar)
|
|||
//MS format has origin (0,0) in the bottom left corner, we use the top left for efficiency reasons
|
||||
byte response[map_page_size];
|
||||
|
||||
for (int x = 0; x < 256; x++) { response[x] = currentTable.values[15 - x / 16][x % 16]; } //This is slightly non-intuitive, but essentially just flips the table vertically (IE top line becomes the bottom line etc). Columns are unchanged
|
||||
for (int x = 0; x < 256; x++) { response[x] = currentTable.values[15 - x / 16][x % 16]; if ( (x & 15) == 1) { loop(); } } //This is slightly non-intuitive, but essentially just flips the table vertically (IE top line becomes the bottom line etc). Columns are unchanged. Every 16 loops, manually call loop() to avoid potential misses
|
||||
loop();
|
||||
for (int x = 256; x < 272; x++) { response[x] = byte(currentTable.axisX[(x - 256)] / 100); } //RPM Bins for VE table (Need to be dvidied by 100)
|
||||
loop();
|
||||
for (int y = 272; y < 288; y++) { response[y] = byte(currentTable.axisY[15 - (y - 272)]); } //MAP or TPS bins for VE table
|
||||
loop();
|
||||
Serial.write((byte *)&response, sizeof(response));
|
||||
}
|
||||
}
|
||||
|
@ -773,6 +776,7 @@ void sendPage(bool useChar)
|
|||
for (byte x = 0; x < page_size; x++)
|
||||
{
|
||||
response[x] = *((byte *)pnt_configPage + x); //Each byte is simply the location in memory of the configPage + the offset + the variable number (x)
|
||||
if ( (x & 31) == 1) { loop(); } //Every 32 loops, do a manual call to loop() to ensure that there is no misses
|
||||
}
|
||||
Serial.write((byte *)&response, sizeof(response));
|
||||
// }
|
||||
|
@ -911,6 +915,7 @@ void sendToothLog(bool useChar)
|
|||
}
|
||||
BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY);
|
||||
}
|
||||
toothLogRead = true;
|
||||
}
|
||||
|
||||
void testComm()
|
||||
|
|
|
@ -18,6 +18,7 @@ volatile unsigned long toothOneMinusOneTime = 0; //The 2nd to last time (micros(
|
|||
volatile bool revolutionOne = 0; // For sequential operation, this tracks whether the current revolution is 1 or 2 (not 1)
|
||||
volatile unsigned int toothHistory[TOOTH_LOG_BUFFER];
|
||||
volatile unsigned int toothHistoryIndex = 0;
|
||||
volatile bool toothLogRead = false; //Flag to indicate whether the current tooth log values have been read out yet
|
||||
|
||||
volatile byte secondaryToothCount; //Used for identifying the current secondary (Usually cam) tooth for patterns with multiple secondary teeth
|
||||
volatile unsigned long secondaryLastToothTime = 0; //The time (micros()) that the last tooth was registered (Cam input)
|
||||
|
|
14
decoders.ino
14
decoders.ino
|
@ -21,12 +21,19 @@ toothLastToothTime - The time (In uS) that the last primary tooth was 'seen'
|
|||
|
||||
*/
|
||||
|
||||
static inline void addToothLogEntry(unsigned long time)
|
||||
static inline void addToothLogEntry(unsigned long toothTime)
|
||||
{
|
||||
//High speed tooth logging history
|
||||
toothHistory[toothHistoryIndex] = time;
|
||||
toothHistory[toothHistoryIndex] = toothTime;
|
||||
if(toothHistoryIndex == (TOOTH_LOG_BUFFER-1))
|
||||
{ toothHistoryIndex = 0; BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY); } //The tooth log ready bit is cleared to ensure that we only get a set of concurrent values.
|
||||
{
|
||||
if (toothLogRead)
|
||||
{
|
||||
toothHistoryIndex = 0;
|
||||
BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY);
|
||||
toothLogRead = false; //The tooth log ready bit is cleared to ensure that we only get a set of concurrent values.
|
||||
}
|
||||
}
|
||||
else
|
||||
{ toothHistoryIndex++; }
|
||||
}
|
||||
|
@ -106,6 +113,7 @@ void triggerPri_missingTooth()
|
|||
|
||||
if ( curGap > targetGap || toothCurrentCount > triggerActualTeeth)
|
||||
{
|
||||
if(toothCurrentCount < (triggerActualTeeth) && currentStatus.hasSync) { currentStatus.hasSync = false; return; } //This occurs when we're at tooth #1, but haven't seen all the other teeth. This indicates a signal issue so we flag lost sync so this will attempt to resync on the next revolution.
|
||||
toothCurrentCount = 1;
|
||||
revolutionOne = !revolutionOne; //Flip sequential revolution tracker
|
||||
toothOneMinusOneTime = toothOneTime;
|
||||
|
|
|
@ -496,7 +496,15 @@ page = 9
|
|||
fuelTrim4loadBins = array, U08, 186,[ 6], "TPS", 1.0, 0.0, 0.0, 255.0, 0
|
||||
#endif
|
||||
|
||||
unused9-192 = scalar, U08, 192, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
fuelTrimEnabled = bits, U08, 192, [0:0], "No", "Yes"
|
||||
unused9-192b = bits, U08, 192, [1:1], "No", "Yes"
|
||||
unused9-192c = bits, U08, 192, [2:2], "No", "Yes"
|
||||
unused9-192d = bits, U08, 192, [3:3], "No", "Yes"
|
||||
unused9-192e = bits, U08, 192, [4:4], "No", "Yes"
|
||||
unused9-192f = bits, U08, 192, [5:5], "No", "Yes"
|
||||
unused9-192g = bits, U08, 192, [6:6], "No", "Yes"
|
||||
unused9-192h = bits, U08, 192, [7:7], "No", "Yes"
|
||||
|
||||
unused9-193 = scalar, U08, 193, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused9-194 = scalar, U08, 194, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused9-195 = scalar, U08, 195, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
|
@ -1000,13 +1008,13 @@ menuDialog = main
|
|||
|
||||
;Fuel trim composite dialog
|
||||
dialog = inj_trim1TblTitle, "Channel #1"
|
||||
panel = fuelTrimTable1Tbl, Center
|
||||
panel = fuelTrimTable1Tbl, Center, { fuelTrimEnabled }
|
||||
dialog = inj_trim2TblTitle, "Channel #2"
|
||||
panel = fuelTrimTable1Tbl
|
||||
panel = fuelTrimTable2Tbl, { fuelTrimEnabled }
|
||||
dialog = inj_trim3TblTitle, "Channel #3"
|
||||
panel = fuelTrimTable1Tbl
|
||||
panel = fuelTrimTable3Tbl, { fuelTrimEnabled }
|
||||
dialog = inj_trim4TblTitle, "Channel #4"
|
||||
panel = fuelTrimTable1Tbl
|
||||
panel = fuelTrimTable4Tbl, { fuelTrimEnabled }
|
||||
|
||||
dialog = inj_trimadt, "", xAxis
|
||||
panel = inj_trim1TblTitle
|
||||
|
@ -1016,9 +1024,9 @@ menuDialog = main
|
|||
panel = inj_trim4TblTitle
|
||||
|
||||
dialog = inj_trimad,"Injector Cyl 1-4 Trims", yAxis
|
||||
topicHelp = "file://$getProjectsDirPath()/docs/Megasquirt3_TunerStudio_MS_Lite_Reference-1.4.pdf#injtrim1-4"
|
||||
panel = inj_trimadt
|
||||
panel = inj_trimadb
|
||||
field = "Individual fuel trim enabled", fuelTrimEnabled
|
||||
panel = inj_trimadt, North
|
||||
panel = inj_trimadb, South
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; General help text
|
||||
|
@ -1198,19 +1206,62 @@ menuDialog = main
|
|||
upDownLabel = "HIGHER", "LOWER"
|
||||
|
||||
;--------- Sequential fuel trim maps -----------
|
||||
table = fuelTrimTable1Tbl, fuelTrimTable1Map, "Fuel trim Table", 9
|
||||
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
|
||||
xBins = fuelTrim1rpmBins, rpm
|
||||
#if SPEED_DENSITY
|
||||
yBins = fuelTrim1loadBins, map
|
||||
#else
|
||||
yBins = fuelTrim1loadBins, throttle
|
||||
#endif
|
||||
zBins = fuelTrim1Table
|
||||
table = fuelTrimTable1Tbl, fuelTrimTable1Map, "Fuel trim Table", 9
|
||||
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
|
||||
xBins = fuelTrim1rpmBins, rpm
|
||||
#if SPEED_DENSITY
|
||||
yBins = fuelTrim1loadBins, map
|
||||
#else
|
||||
yBins = fuelTrim1loadBins, throttle
|
||||
#endif
|
||||
zBins = fuelTrim1Table
|
||||
|
||||
gridHeight = 2.0
|
||||
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||
upDownLabel = "(RICHER)", "(LEANER)"
|
||||
gridHeight = 2.0
|
||||
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||
upDownLabel = "(RICHER)", "(LEANER)"
|
||||
|
||||
table = fuelTrimTable2Tbl, fuelTrimTable2Map, "Fuel trim Table", 9
|
||||
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
|
||||
xBins = fuelTrim2rpmBins, rpm
|
||||
#if SPEED_DENSITY
|
||||
yBins = fuelTrim2loadBins, map
|
||||
#else
|
||||
yBins = fuelTrim2loadBins, throttle
|
||||
#endif
|
||||
zBins = fuelTrim2Table
|
||||
|
||||
gridHeight = 2.0
|
||||
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||
upDownLabel = "(RICHER)", "(LEANER)"
|
||||
|
||||
table = fuelTrimTable3Tbl, fuelTrimTable3Map, "Fuel trim Table", 9
|
||||
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
|
||||
xBins = fuelTrim3rpmBins, rpm
|
||||
#if SPEED_DENSITY
|
||||
yBins = fuelTrim3loadBins, map
|
||||
#else
|
||||
yBins = fuelTrim3loadBins, throttle
|
||||
#endif
|
||||
zBins = fuelTrim3Table
|
||||
|
||||
gridHeight = 2.0
|
||||
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||
upDownLabel = "(RICHER)", "(LEANER)"
|
||||
|
||||
table = fuelTrimTable4Tbl, fuelTrimTable4Map, "Fuel trim Table", 9
|
||||
topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
|
||||
xBins = fuelTrim4rpmBins, rpm
|
||||
#if SPEED_DENSITY
|
||||
yBins = fuelTrim4loadBins, map
|
||||
#else
|
||||
yBins = fuelTrim4loadBins, throttle
|
||||
#endif
|
||||
zBins = fuelTrim4Table
|
||||
|
||||
gridHeight = 2.0
|
||||
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||
upDownLabel = "(RICHER)", "(LEANER)"
|
||||
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -74,6 +74,10 @@ struct table3D ignitionTable; //16x16 ignition map
|
|||
struct table3D afrTable; //16x16 afr target map
|
||||
struct table3D boostTable; //8x8 boost map
|
||||
struct table3D vvtTable; //8x8 vvt map
|
||||
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 table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
|
||||
struct table2D WUETable; //10 bin Warm Up Enrichment map (2D)
|
||||
struct table2D dwellVCorrectionTable; //6 bin dwell voltage correction (2D)
|
||||
|
@ -164,6 +168,10 @@ void setup()
|
|||
table3D_setSize(&afrTable, 16);
|
||||
table3D_setSize(&boostTable, 8);
|
||||
table3D_setSize(&vvtTable, 8);
|
||||
table3D_setSize(&trim1Table, 6);
|
||||
table3D_setSize(&trim2Table, 6);
|
||||
table3D_setSize(&trim3Table, 6);
|
||||
table3D_setSize(&trim4Table, 6);
|
||||
|
||||
loadConfig();
|
||||
|
||||
|
@ -747,6 +755,19 @@ void setup()
|
|||
ign5EndFunction = endCoil5Charge;
|
||||
}
|
||||
break;
|
||||
|
||||
case IGN_MODE_SEQUENTIAL:
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil2Charge;
|
||||
ign2EndFunction = endCoil2Charge;
|
||||
ign3StartFunction = beginCoil3Charge;
|
||||
ign3EndFunction = endCoil3Charge;
|
||||
ign4StartFunction = beginCoil4Charge;
|
||||
ign4EndFunction = endCoil4Charge;
|
||||
ign5StartFunction = beginCoil5Charge;
|
||||
ign5EndFunction = endCoil5Charge;
|
||||
break;
|
||||
|
||||
default:
|
||||
//Wasted spark (Shouldn't ever happen anyway)
|
||||
|
@ -882,7 +903,7 @@ void loop()
|
|||
//And check whether the tooth log buffer is ready
|
||||
if(toothHistoryIndex > TOOTH_LOG_SIZE) { BIT_SET(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY); }
|
||||
}
|
||||
|
||||
if(toothHistoryIndex > TOOTH_LOG_SIZE) { BIT_SET(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY); }
|
||||
//The IAT and CLT readings can be done less frequently. This still runs about 4 times per second
|
||||
if ((mainLoopCount & 255) == 1)
|
||||
{
|
||||
|
|
73
storage.h
73
storage.h
|
@ -39,40 +39,61 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
|
|||
-----------------------------------------------------
|
||||
*/
|
||||
|
||||
#define EEPROM_CONFIG1_XSIZE 1
|
||||
#define EEPROM_CONFIG1_YSIZE 2
|
||||
#define EEPROM_CONFIG1_MAP 3
|
||||
#define EEPROM_CONFIG1_XBINS 259
|
||||
#define EEPROM_CONFIG1_YBINS 275
|
||||
#define EEPROM_CONFIG2_START 291
|
||||
#define EEPROM_CONFIG2_END 355 // +64 131
|
||||
#define EEPROM_CONFIG3_XSIZE 355
|
||||
#define EEPROM_CONFIG3_YSIZE 356
|
||||
#define EEPROM_CONFIG3_MAP 357
|
||||
#define EEPROM_CONFIG3_XBINS 613
|
||||
#define EEPROM_CONFIG3_YBINS 629
|
||||
#define EEPROM_CONFIG4_START 645
|
||||
#define EEPROM_CONFIG4_END 709
|
||||
#define EEPROM_CONFIG5_XSIZE 709
|
||||
#define EEPROM_CONFIG5_YSIZE 710
|
||||
#define EEPROM_CONFIG5_MAP 711
|
||||
#define EEPROM_CONFIG5_XBINS 967
|
||||
#define EEPROM_CONFIG5_YBINS 983
|
||||
#define EEPROM_CONFIG6_START 999
|
||||
#define EEPROM_CONFIG6_END 1063
|
||||
#define EEPROM_CONFIG7_START 1063
|
||||
#define EEPROM_CONFIG7_END 1127
|
||||
#define EEPROM_CONFIG1_XSIZE 1
|
||||
#define EEPROM_CONFIG1_YSIZE 2
|
||||
#define EEPROM_CONFIG1_MAP 3
|
||||
#define EEPROM_CONFIG1_XBINS 259
|
||||
#define EEPROM_CONFIG1_YBINS 275
|
||||
#define EEPROM_CONFIG2_START 291
|
||||
#define EEPROM_CONFIG2_END 355 // +64 131
|
||||
#define EEPROM_CONFIG3_XSIZE 355
|
||||
#define EEPROM_CONFIG3_YSIZE 356
|
||||
#define EEPROM_CONFIG3_MAP 357
|
||||
#define EEPROM_CONFIG3_XBINS 613
|
||||
#define EEPROM_CONFIG3_YBINS 629
|
||||
#define EEPROM_CONFIG4_START 645
|
||||
#define EEPROM_CONFIG4_END 709
|
||||
#define EEPROM_CONFIG5_XSIZE 709
|
||||
#define EEPROM_CONFIG5_YSIZE 710
|
||||
#define EEPROM_CONFIG5_MAP 711
|
||||
#define EEPROM_CONFIG5_XBINS 967
|
||||
#define EEPROM_CONFIG5_YBINS 983
|
||||
#define EEPROM_CONFIG6_START 999
|
||||
#define EEPROM_CONFIG6_END 1063
|
||||
#define EEPROM_CONFIG7_START 1063
|
||||
#define EEPROM_CONFIG7_END 1127
|
||||
#define EEPROM_CONFIG8_XSIZE1 1127
|
||||
#define EEPROM_CONFIG8_YSIZE1 1128
|
||||
#define EEPROM_CONFIG8_MAP1 1129
|
||||
#define EEPROM_CONFIG8_MAP1 1129
|
||||
#define EEPROM_CONFIG8_XBINS1 1193
|
||||
#define EEPROM_CONFIG8_YBINS1 1201
|
||||
#define EEPROM_CONFIG8_XSIZE2 1209
|
||||
#define EEPROM_CONFIG8_YSIZE2 1210
|
||||
#define EEPROM_CONFIG8_MAP2 1211
|
||||
#define EEPROM_CONFIG8_MAP2 1211
|
||||
#define EEPROM_CONFIG8_XBINS2 1275
|
||||
#define EEPROM_CONFIG8_YBINS2 1283
|
||||
#define EEPROM_CONFIG8_END 1291
|
||||
#define EEPROM_CONFIG8_END 1291
|
||||
#define EEPROM_CONFIG9_XSIZE1 1291
|
||||
#define EEPROM_CONFIG9_YSIZE1 1292
|
||||
#define EEPROM_CONFIG9_MAP1 1293
|
||||
#define EEPROM_CONFIG9_XBINS1 1329
|
||||
#define EEPROM_CONFIG9_YBINS1 1335
|
||||
#define EEPROM_CONFIG9_XSIZE2 1341
|
||||
#define EEPROM_CONFIG9_YSIZE2 1342
|
||||
#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
|
||||
|
||||
//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_CALIBRATION_O2 2559
|
||||
|
|
126
storage.ino
126
storage.ino
|
@ -196,6 +196,74 @@ void writeConfig()
|
|||
if(EEPROM.read(y) != vvtTable.axisY[offset]) { EEPROM.write(y, vvtTable.axisY[offset]); }
|
||||
y++;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------
|
||||
| Fuel trim tables (See storage.h for data layout) - Page 9
|
||||
| 6x6 tables itself + the 6 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
//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
|
||||
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
|
||||
|
||||
y = EEPROM_CONFIG9_MAP2; //We do the 4 maps together in the same loop
|
||||
int z = EEPROM_CONFIG9_MAP3; //We do the 4 maps together in the same loop
|
||||
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]/100)); //RPM bins are divided by 100 and converted to a byte
|
||||
offset = y - EEPROM_CONFIG9_XBINS2;
|
||||
EEPROM.update(y, byte(trim2Table.axisX[offset]/100)); //RPM bins are divided by 100 and converted to a byte
|
||||
offset = z - EEPROM_CONFIG9_XBINS3;
|
||||
EEPROM.update(z, byte(trim3Table.axisX[offset]/100)); //RPM bins are divided by 100 and converted to a byte
|
||||
offset = i - EEPROM_CONFIG9_XBINS4;
|
||||
EEPROM.update(i, byte(trim4Table.axisX[offset]/100)); //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]);
|
||||
offset = y - EEPROM_CONFIG9_YBINS2;
|
||||
EEPROM.update(y, trim2Table.axisY[offset]);
|
||||
offset = z - EEPROM_CONFIG9_YBINS3;
|
||||
EEPROM.update(z, trim3Table.axisY[offset]);
|
||||
offset = i - EEPROM_CONFIG9_YBINS4;
|
||||
EEPROM.update(i, trim4Table.axisY[offset]);
|
||||
y++;
|
||||
z++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void loadConfig()
|
||||
|
@ -342,6 +410,64 @@ void loadConfig()
|
|||
vvtTable.axisY[offset] = EEPROM.read(y);
|
||||
y++;
|
||||
}
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
// Fuel trim tables load
|
||||
y = EEPROM_CONFIG9_MAP2;
|
||||
int z = EEPROM_CONFIG9_MAP3;
|
||||
int i = EEPROM_CONFIG9_MAP4;
|
||||
for(int x=EEPROM_CONFIG9_MAP1; x<EEPROM_CONFIG9_XBINS1; x++)
|
||||
{
|
||||
offset = x - EEPROM_CONFIG9_MAP1;
|
||||
trim1Table.values[5-offset/6][offset%6] = EEPROM.read(x); //Read the 6x6 map
|
||||
offset = y - EEPROM_CONFIG9_MAP2;
|
||||
trim2Table.values[5-offset/6][offset%6] = EEPROM.read(y); //Read the 6x6 map
|
||||
offset = z - EEPROM_CONFIG9_MAP3;
|
||||
trim3Table.values[5-offset/6][offset%6] = EEPROM.read(z); //Read the 6x6 map
|
||||
offset = i - EEPROM_CONFIG9_MAP4;
|
||||
trim4Table.values[5-offset/6][offset%6] = EEPROM.read(i); //Read 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;
|
||||
trim1Table.axisX[offset] = (EEPROM.read(x) * 100); //RPM bins are divided by 100 when stored. Multiply them back now
|
||||
offset = y - EEPROM_CONFIG9_XBINS2;
|
||||
trim2Table.axisX[offset] = (EEPROM.read(y) * 100); //RPM bins are divided by 100 when stored. Multiply them back now
|
||||
offset = z - EEPROM_CONFIG9_XBINS3;
|
||||
trim3Table.axisX[offset] = (EEPROM.read(z) * 100); //RPM bins are divided by 100 when stored. Multiply them back now
|
||||
offset = i - EEPROM_CONFIG9_XBINS4;
|
||||
trim4Table.axisX[offset] = (EEPROM.read(i) * 100); //RPM bins are divided by 100 when stored. Multiply them back now
|
||||
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;
|
||||
trim1Table.axisY[offset] = EEPROM.read(x);
|
||||
offset = y - EEPROM_CONFIG9_YBINS2;
|
||||
trim2Table.axisY[offset] = EEPROM.read(y);
|
||||
offset = z - EEPROM_CONFIG9_YBINS3;
|
||||
trim3Table.axisY[offset] = EEPROM.read(z);
|
||||
offset = i - EEPROM_CONFIG9_YBINS4;
|
||||
trim4Table.axisY[offset] = EEPROM.read(i);
|
||||
y++;
|
||||
z++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue