Initial boost and vvt page work

This commit is contained in:
Josh Stewart 2015-09-25 06:24:40 +10:00
parent 7fe880fb3d
commit e1f2f42107
6 changed files with 111 additions and 14 deletions

View File

@ -8,6 +8,7 @@
#define afrMapPage 5
#define afrSetPage 6
#define iacPage 7
#define boostvvtPage 8
byte currentPage;

View File

@ -88,6 +88,13 @@ void command()
break;
case 'Z': //Totally non-standard testing function. Will be removed once calibration testing is completed. This function takes 1.5kb of program space! :S
digitalWrite(pinInjector1, HIGH);
digitalWrite(pinInjector2, HIGH);
delay(20);
digitalWrite(pinInjector1, LOW);
digitalWrite(pinInjector2, LOW);
return;
Serial.println("Coolant");
for(int x=0; x<CALIBRATION_TABLE_SIZE; x++)
{
@ -234,7 +241,7 @@ void receiveValue(int offset, byte newValue)
if (offset < 272)
{
//X Axis
ignitionTable.axisX[(offset-256)] = (int)(newValue) * int(100); //The RPM values sent by megasquirt are divided by 100, need to multiple it back by 100 to make it correct
ignitionTable.axisX[(offset-256)] = (int)(newValue) * int(100); //The RPM values sent by TunerStudio are divided by 100, need to multiple it back by 100 to make it correct
}
else
{
@ -266,7 +273,7 @@ void receiveValue(int offset, byte newValue)
if (offset < 272)
{
//X Axis
afrTable.axisX[(offset-256)] = int(newValue) * int(100); //The RPM values sent by megasquirt are divided by 100, need to multiply it back by 100 to make it correct
afrTable.axisX[(offset-256)] = int(newValue) * int(100); //The RPM values sent by TunerStudio are divided by 100, need to multiply it back by 100 to make it correct
}
else
{
@ -295,6 +302,41 @@ void receiveValue(int offset, byte newValue)
*(pnt_configPage + (byte)offset) = newValue;
}
break;
case boostvvtPage: //Boost and VVT maps (8x8)
if (offset < 64) //New value is part of the boost map
{
boostTable.values[7-offset/8][offset%8] = newValue;
return;
}
else if (offset < 72) //New value is on the X (RPM) axis of the boost table
{
boostTable.axisX[(offset-64)] = int(newValue) * int(100); //The RPM values sent by TunerStudio are divided by 100, need to multiply it back by 100 to make it correct
return;
}
else if (offset < 80) //New value is on the Y (TPS) axis of the boost table
{
boostTable.axisY[(7-(offset-72))] = int(newValue);
return;
}
else if (offset < 144) //New value is part of the vvt map
{
offset = offset - 80;
vvtTable.values[7-offset/8][offset%8] = newValue;
return;
}
else if (offset < 152) //New value is on the X (RPM) axis of the vvt table
{
offset = offset - 144;
vvtTable.axisX[offset] = int(newValue) * int(100); //The RPM values sent by TunerStudio are divided by 100, need to multiply it back by 100 to make it correct
return;
}
else //New value is on the Y (Load) axis of the vvt table
{
offset = offset - 152;
vvtTable.axisY[(7-offset)] = int(newValue);
return;
}
default:
break;
@ -403,6 +445,23 @@ void sendPage()
Serial.write((byte *)&response, sizeof(response));
break;
}
case boostvvtPage:
{
//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
//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)] / 100); }
for(int y=72;y<80;y++) { response[y] = byte(boostTable.axisY[7-(y-72)]); }
//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)] / 100); }
for(int y=72;y<80;y++) { response[y+80] = byte(vvtTable.axisY[7-(y-72)]); }
Serial.write((byte *)&response, sizeof(response));
break;
}
default:
break;

View File

@ -60,16 +60,14 @@
;----------------------------------------------------------------------------
endianness = little
nPages = 7
nPages = 8
burnCommand = "B"
; pageSize = 125
; pageSize = 128, 128, 128, 128
pageSize = 288, 64, 288, 64, 288, 64, 64
pageSize = 288, 64, 288, 64, 288, 64, 64, 160
pageActivationDelay = 10
; pageActivate = ""
pageActivate = "P\001", "P\002", "P\003", "P\004", "P\005", "P\006", "P\007"
pageReadCommand = "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"
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"
;\x00%2
; pageChunkWrite = "" ; No chunk write for standard MS
@ -364,7 +362,17 @@ page = 7
fanSP = scalar, U08, 57, "°F", 1.0, -40, -40, 215.0, 0
fanHyster = scalar, U08, 58, "°F", 1.0, -40, -40, 215.0, 0
#endif
;--------------------------------------------------
;Boost and vvt maps (Page 8)
;--------------------------------------------------
page = 8
boostTable = array, U08, 0,[8x8], "%", 1.0, 0.0, 0, 100, 0
rpmBinsBoost = array, U08, 64,[ 8], "RPM", 100.0, 0.0, 100, 25500, 0
tpsBinsBoost = array, U08, 72,[ 8], "TPS", 1.0, 0.0, 0.0, 255.0, 0
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
;-------------------------------------------------------------------------------
@ -428,6 +436,7 @@ page = 7
subMenu = std_realtime, "&Realtime Display"
subMenu = accelEnrichments, "&Acceleration Wizard"
subMenu = egoControl, "AFR/O2", 3
subMenu = boostControl, "Boost control", 8
subMenu = RevLimiterS, "Rev Limits", 2
subMenu = veTable1Tbl, "&VE Table", 0
subMenu = sparkTbl, "&Spark Table", 2
@ -676,6 +685,9 @@ page = 7
settingOption = "GM 3-BAR / MPXH6300", mapMin=1, mapMax=315
settingOption = "MPXH5700", mapMin=0, mapMax=700
settingOption = "MPXH6400", mapMin=3, mapMax=416
dialog = boostControl, "Boost Control"
panel = boostTbl
; -------------------------------------------------------------
@ -857,6 +869,13 @@ help = helpEnrichments, "Enrichments Help"
gridHeight = 1.0
upDownLabel = "RICHER", "LEANER"
gridOrient = 250, 0, 340
table = boostTbl, boostMap, "Boost control Table", 8
xBins = rpmBinsBoost, rpm
yBins = tpsBinsBoost, throttle
zBins = boostTable
gridHeight = 3.0
upDownLabel = "HIGHER", "LOWER"
;-------------------------------------------------------------------------------

View File

@ -28,7 +28,7 @@ void initialiseSchedulers()
TIFR5 = 0x00; //Timer5 INT Flag Reg: Clear Timer Overflow Flag
TCCR5A = 0x00; //Timer5 Control Reg A: Wave Gen Mode normal
//TCCR5B = (1 << CS12); //Timer5 Control Reg B: Timer Prescaler set to 256. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
TCCR5B = 0x03; //Reverting this for now due to issue with low RPM overflow
TCCR5B = 0x03; //aka Divisor = 64 = 490.1Hz
ignitionSchedule1.Status = OFF;
ignitionSchedule2.Status = OFF;
ignitionSchedule3.Status = OFF;
@ -38,7 +38,7 @@ void initialiseSchedulers()
TCNT4 = 0; //Reset Timer Count
TIFR4 = 0x00; //Timer4 INT Flag Reg: Clear Timer Overflow Flag
TCCR4A = 0x00; //Timer4 Control Reg A: Wave Gen Mode normal
TCCR4B = (1 << CS12); //Timer4 Control Reg B: Timer Prescaler set to 256. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
TCCR4B = (1 << CS12); //Timer4 Control Reg B: aka Divisor = 256 = 122.5HzTimer Prescaler set to 256. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
ignitionSchedule4.Status = OFF;
fuelSchedule4.Status = OFF;
}

View File

@ -66,9 +66,11 @@ void (*triggerSecondary)(); //Pointer for the secondary trigger function (Gets p
int (*getRPM)(); //Pointer to the getRPM function (Gets pointed to the relevant decoder)
int (*getCrankAngle)(int); //Pointer to the getCrank Angle function (Gets pointed to the relevant decoder)
struct table3D fuelTable; //8x8 fuel map
struct table3D ignitionTable; //8x8 ignition map
struct table3D afrTable; //8x8 afr target map
struct table3D fuelTable; //16x16 fuel map
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 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)
@ -111,6 +113,8 @@ void setup()
table3D_setSize(&fuelTable, 16);
table3D_setSize(&ignitionTable, 16);
table3D_setSize(&afrTable, 16);
table3D_setSize(&boostTable, 8);
table3D_setSize(&vvtTable, 8);
loadConfig();

View File

@ -29,6 +29,10 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
| 983 |16 | AFR Table MAP/TPS bins |
| 999 |64 | Remaining Page 3 settings |
| 1063 |64 | Page 4 settings |
| 1127 |2 | X and Y sizes for boost table |
| 1129 |64 | Boost Map (8x8) |
| 1193 |8 | Boost Table RPM bins |
| 1201 |8 | Bost Table TPS bins |
| 2559 |512 | Calibration data (O2) |
| 3071 |512 | Calibration data (IAT) |
| 3583 |512 | Calibration data (CLT) |
@ -58,6 +62,16 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
#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_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_XBINS2 1275
#define EEPROM_CONFIG8_YBINS2 1283
//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