Fix boost and vvt eeprom offsets

This commit is contained in:
Josh Stewart 2015-09-28 21:57:27 +10:00
parent b51dded9c2
commit 85d1d55bc6
4 changed files with 14 additions and 15 deletions

View File

@ -56,7 +56,7 @@ void vvtControl()
vvt_pwm_target_value = percentage(vvtDuty, vvt_pwm_max_count); vvt_pwm_target_value = percentage(vvtDuty, vvt_pwm_max_count);
} }
} }
//The interrupt to control the Boost PWM //The interrupt to control the Boost PWM
ISR(TIMER1_COMPA_vect) ISR(TIMER1_COMPA_vect)
{ {

View File

@ -65,7 +65,7 @@
pageSize = 288, 64, 288, 64, 288, 64, 64, 160 pageSize = 288, 64, 288, 64, 288, 64, 64, 160
pageActivationDelay = 10 pageActivationDelay = 10
; pageActivate = "" ; pageActivate = ""
pageActivate = "P\001", "P\002", "P\003", "P\004", "P\005", "P\006", "P\007" pageActivate = "P\001", "P\002", "P\003", "P\004", "P\005", "P\006", "P\007", "P\010"
pageReadCommand = "V", "V", "V", "V", "V", "V", "V", "V" pageReadCommand = "V", "V", "V", "V", "V", "V", "V", "V"
pageValueWrite = "W%2o%v", "W%o%v", "W%2o%v", "W%o%v", "W%2o%v", "W%o%v", "W%o%v", "W%o%v" pageValueWrite = "W%2o%v", "W%o%v", "W%2o%v", "W%o%v", "W%2o%v", "W%o%v", "W%o%v", "W%o%v"
;\x00%2 ;\x00%2

View File

@ -114,13 +114,11 @@ void setup()
table3D_setSize(&fuelTable, 16); table3D_setSize(&fuelTable, 16);
table3D_setSize(&ignitionTable, 16); table3D_setSize(&ignitionTable, 16);
table3D_setSize(&afrTable, 16); table3D_setSize(&afrTable, 16);
table3D_setSize(&boostTable, 8);
table3D_setSize(&vvtTable, 8);
loadConfig(); loadConfig();
//Boost and vvt tables are only created if they are turned on
if(configPage3.boostEnabled) { table3D_setSize(&boostTable, 8); }
if(configPage3.vvtEnabled) { table3D_setSize(&vvtTable, 8); }
//Repoint the 2D table structs to the config pages that were just loaded //Repoint the 2D table structs to the config pages that were just loaded
taeTable.valueSize = SIZE_BYTE; //Set this table to use byte values taeTable.valueSize = SIZE_BYTE; //Set this table to use byte values
taeTable.xSize = 4; taeTable.xSize = 4;
@ -506,9 +504,7 @@ void loop()
currentStatus.TPSlast_time = currentStatus.TPS_time; currentStatus.TPSlast_time = currentStatus.TPS_time;
currentStatus.tpsADC = fastMap1023toX(analogRead(pinTPS), 0, 1023, 0, 255); //Get the current raw TPS ADC value and map it into a byte currentStatus.tpsADC = fastMap1023toX(analogRead(pinTPS), 0, 1023, 0, 255); //Get the current raw TPS ADC value and map it into a byte
currentStatus.TPS = map(currentStatus.tpsADC, configPage1.tpsMin, configPage1.tpsMax, 0, 100); //Take the raw TPS ADC value and convert it into a TPS% based on the calibrated values currentStatus.TPS = map(currentStatus.tpsADC, configPage1.tpsMin, configPage1.tpsMax, 0, 100); //Take the raw TPS ADC value and convert it into a TPS% based on the calibrated values
currentStatus.TPS_time = currentLoopTime; currentStatus.TPS_time = currentLoopTime;
boostControl(); //Most boost tends to run at about 30Hz, so placing it here ensures a new target time is fetched at least that frequently
} }
//The IAT and CLT readings can be done less frequently. This still runs about 4 times per second //The IAT and CLT readings can be done less frequently. This still runs about 4 times per second
@ -526,6 +522,9 @@ void loop()
currentStatus.IAT = iatCalibrationTable[currentStatus.iatADC] - CALIBRATION_TEMPERATURE_OFFSET; currentStatus.IAT = iatCalibrationTable[currentStatus.iatADC] - CALIBRATION_TEMPERATURE_OFFSET;
currentStatus.O2 = o2CalibrationTable[currentStatus.O2ADC]; currentStatus.O2 = o2CalibrationTable[currentStatus.O2ADC];
currentStatus.O2_2 = o2CalibrationTable[currentStatus.O2_2ADC]; currentStatus.O2_2 = o2CalibrationTable[currentStatus.O2_2ADC];
vvtControl();
boostControl(); //Most boost tends to run at about 30Hz, so placing it here ensures a new target time is fetched frequently enough
} }
//Always check for sync //Always check for sync
@ -549,7 +548,6 @@ void loop()
} }
idleControl(); //Perform any idle realted actions idleControl(); //Perform any idle realted actions
vvtControl();
//END SETTING STATUSES //END SETTING STATUSES
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------

View File

@ -188,13 +188,13 @@ void writeConfig()
} }
//TPS/MAP bins //TPS/MAP bins
y=EEPROM_CONFIG8_YBINS2; y=EEPROM_CONFIG8_YBINS2;
for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_END; x++) for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_XSIZE2; x++)
{ {
offset = x - EEPROM_CONFIG8_YBINS1; offset = x - EEPROM_CONFIG8_YBINS1;
if(EEPROM.read(x) != boostTable.axisY[offset]) { EEPROM.write(x, boostTable.axisY[offset]); } if(EEPROM.read(x) != boostTable.axisY[offset]) { EEPROM.write(x, boostTable.axisY[offset]); }
offset = x - EEPROM_CONFIG8_YBINS1; offset = y - EEPROM_CONFIG8_YBINS2;
if(EEPROM.read(y) != vvtTable.axisY[offset]) { EEPROM.write(y, vvtTable.axisY[offset]); } if(EEPROM.read(y) != vvtTable.axisY[offset]) { EEPROM.write(y, vvtTable.axisY[offset]); }
x++; y++;
} }
} }
@ -311,7 +311,6 @@ void loadConfig()
//********************************************************************************************************************************************************************************* //*********************************************************************************************************************************************************************************
// Boost and vvt tables load // Boost and vvt tables load
int y = EEPROM_CONFIG8_MAP2; int y = EEPROM_CONFIG8_MAP2;
for(int x=EEPROM_CONFIG8_MAP1; x<EEPROM_CONFIG8_XBINS1; x++) for(int x=EEPROM_CONFIG8_MAP1; x<EEPROM_CONFIG8_XBINS1; x++)
{ {
@ -321,6 +320,7 @@ void loadConfig()
vvtTable.values[7-offset/8][offset%8] = EEPROM.read(y); //Read the 8x8 map vvtTable.values[7-offset/8][offset%8] = EEPROM.read(y); //Read the 8x8 map
y++; y++;
} }
//RPM bins //RPM bins
y = EEPROM_CONFIG8_XBINS2; y = EEPROM_CONFIG8_XBINS2;
for(int x=EEPROM_CONFIG8_XBINS1; x<EEPROM_CONFIG8_YBINS1; x++) for(int x=EEPROM_CONFIG8_XBINS1; x<EEPROM_CONFIG8_YBINS1; x++)
@ -331,9 +331,10 @@ void loadConfig()
vvtTable.axisX[offset] = (EEPROM.read(y) * 100); //RPM bins are divided by 100 when stored. Multiply them back now vvtTable.axisX[offset] = (EEPROM.read(y) * 100); //RPM bins are divided by 100 when stored. Multiply them back now
y++; y++;
} }
//TPS/MAP bins //TPS/MAP bins
y = EEPROM_CONFIG8_YBINS2; y = EEPROM_CONFIG8_YBINS2;
for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_END; x++) for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_XSIZE2; x++)
{ {
offset = x - EEPROM_CONFIG8_YBINS1; offset = x - EEPROM_CONFIG8_YBINS1;
boostTable.axisY[offset] = EEPROM.read(x); boostTable.axisY[offset] = EEPROM.read(x);