Further sequential work
This commit is contained in:
parent
db469b17d8
commit
34b571226e
1
comms.h
1
comms.h
|
@ -9,6 +9,7 @@
|
||||||
#define afrSetPage 6//Config Page 3
|
#define afrSetPage 6//Config Page 3
|
||||||
#define iacPage 7//Config Page 4
|
#define iacPage 7//Config Page 4
|
||||||
#define boostvvtPage 8
|
#define boostvvtPage 8
|
||||||
|
#define seqFuelPage 9
|
||||||
|
|
||||||
byte currentPage = 1;//Not the same as the speeduino config page numbers
|
byte currentPage = 1;//Not the same as the speeduino config page numbers
|
||||||
boolean isMap = true;
|
boolean isMap = true;
|
||||||
|
|
|
@ -659,6 +659,15 @@ void sendPage(bool useChar)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case seqFuelPage:
|
||||||
|
{
|
||||||
|
byte response[200]; //Bit hacky, but the size is: (8x8 + 8 + 8) + (8x8 + 8 + 8) = 160
|
||||||
|
|
||||||
|
|
||||||
|
for (int x = 0; x < 200; x++) { 0; }
|
||||||
|
Serial.write((byte *)&response, sizeof(response));
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Serial.println(F("\nPage has not been implemented yet. Change to another page."));
|
Serial.println(F("\nPage has not been implemented yet. Change to another page."));
|
||||||
|
|
|
@ -506,6 +506,7 @@ void triggerSec_4G63()
|
||||||
if(BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) || !currentStatus.hasSync)
|
if(BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) || !currentStatus.hasSync)
|
||||||
{
|
{
|
||||||
triggerFilterTime = 1500; //If this is removed, can have trouble getting sync again after the engine is turned off (but ECU not reset).
|
triggerFilterTime = 1500; //If this is removed, can have trouble getting sync again after the engine is turned off (but ECU not reset).
|
||||||
|
|
||||||
//Check the status of the crank trigger
|
//Check the status of the crank trigger
|
||||||
bool crank = digitalRead(pinTrigger);
|
bool crank = digitalRead(pinTrigger);
|
||||||
if(crank == HIGH)
|
if(crank == HIGH)
|
||||||
|
|
|
@ -92,13 +92,13 @@
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
|
|
||||||
endianness = little
|
endianness = little
|
||||||
nPages = 8
|
nPages = 9
|
||||||
burnCommand = "B"
|
burnCommand = "B"
|
||||||
pageSize = 288, 64, 288, 64, 288, 64, 64, 160
|
pageSize = 288, 64, 288, 64, 288, 64, 64, 160, 200
|
||||||
pageActivationDelay = 10
|
pageActivationDelay = 10
|
||||||
pageActivate = "P\001", "P\002", "P\003", "P\004", "P\005", "P\006", "P\007", "P\010"
|
pageActivate = "P\001", "P\002", "P\003", "P\004", "P\005", "P\006", "P\007", "P\010", "P\011"
|
||||||
pageReadCommand = "V", "V", "V", "V", "V", "V", "V", "V"
|
pageReadCommand = "V", "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", "W%o%v"
|
||||||
; pageChunkWrite = "" ; No chunk write for standard MS
|
; pageChunkWrite = "" ; No chunk write for standard MS
|
||||||
|
|
||||||
blockingFactor = 2048
|
blockingFactor = 2048
|
||||||
|
@ -460,6 +460,52 @@ page = 8
|
||||||
rpmBinsVVT = array, U08, 144,[ 8], "RPM", 100.0, 0.0, 100, 25500, 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
|
tpsBinsVVT = array, U08, 152,[ 8], "TPS", 1.0, 0.0, 0.0, 255.0, 0
|
||||||
|
|
||||||
|
;--------------------------------------------------
|
||||||
|
;Sequential fuel trim tables (Page 9)
|
||||||
|
;--------------------------------------------------
|
||||||
|
page = 9
|
||||||
|
fuelTrim1Table = array, U08, 0,[6x6], "%", 1.0, -128, -128, 128, 0
|
||||||
|
fuelTrim1rpmBins = array, U08, 36,[ 6], "RPM", 100.0, 0.0, 100, 25500, 0
|
||||||
|
#if SPEED_DENSITY
|
||||||
|
fuelTrim1loadBins = array, U08, 42,[ 6], "kPa", 1.0, 0.0, 0.0, 255.0, 0
|
||||||
|
#elif ALPHA_N
|
||||||
|
fuelTrim1loadBins = array, U08, 42,[ 6], "TPS", 1.0, 0.0, 0.0, 255.0, 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fuelTrim2Table = array, U08, 48,[6x6], "%", 1.0, -128, -128, 128, 0
|
||||||
|
fuelTrim2rpmBins = array, U08, 84,[ 6], "RPM", 100.0, 0.0, 100, 25500, 0
|
||||||
|
#if SPEED_DENSITY
|
||||||
|
fuelTrim2loadBins = array, U08, 90,[ 6], "kPa", 1.0, 0.0, 0.0, 255.0, 0
|
||||||
|
#elif ALPHA_N
|
||||||
|
fuelTrim2loadBins = array, U08, 90,[ 6], "TPS", 1.0, 0.0, 0.0, 255.0, 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fuelTrim3Table = array, U08, 96,[6x6], "%", 1.0, -128, -128, 128, 0
|
||||||
|
fuelTrim3rpmBins = array, U08, 132,[ 6], "RPM", 100.0, 0.0, 100, 25500, 0
|
||||||
|
#if SPEED_DENSITY
|
||||||
|
fuelTrim3loadBins = array, U08, 138,[ 6], "kPa", 1.0, 0.0, 0.0, 255.0, 0
|
||||||
|
#elif ALPHA_N
|
||||||
|
fuelTrim3loadBins = array, U08, 138,[ 6], "TPS", 1.0, 0.0, 0.0, 255.0, 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fuelTrim4Table = array, U08, 144,[6x6], "%", 1.0, -128, -128, 128, 0
|
||||||
|
fuelTrim4rpmBins = array, U08, 180,[ 6], "RPM", 100.0, 0.0, 100, 25500, 0
|
||||||
|
#if SPEED_DENSITY
|
||||||
|
fuelTrim4loadBins = array, U08, 186,[ 6], "kPa", 1.0, 0.0, 0.0, 255.0, 0
|
||||||
|
#elif ALPHA_N
|
||||||
|
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
|
||||||
|
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
|
||||||
|
unused9-196 = scalar, U08, 196, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||||
|
unused9-197 = scalar, U08, 197, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||||
|
unused9-198 = scalar, U08, 198, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||||
|
unused9-199 = scalar, U08, 199, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||||
|
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
|
|
||||||
[ConstantsExtensions]
|
[ConstantsExtensions]
|
||||||
|
@ -555,6 +601,8 @@ menuDialog = main
|
||||||
subMenu = veTableDialog, "&VE Table", 0
|
subMenu = veTableDialog, "&VE Table", 0
|
||||||
subMenu = sparkTbl, "&Spark Table", 2
|
subMenu = sparkTbl, "&Spark Table", 2
|
||||||
subMenu = afrTable1Tbl, "A&FR Table", 5
|
subMenu = afrTable1Tbl, "A&FR Table", 5
|
||||||
|
subMenu = std_separator
|
||||||
|
subMenu = inj_trimad, "Sequential fuel trim", 9
|
||||||
|
|
||||||
menu = "&Spark"
|
menu = "&Spark"
|
||||||
subMenu = sparkSettings, "&Spark Settings"
|
subMenu = sparkSettings, "&Spark Settings"
|
||||||
|
@ -949,6 +997,27 @@ menuDialog = main
|
||||||
field = ""
|
field = ""
|
||||||
panel = aseSettings
|
panel = aseSettings
|
||||||
|
|
||||||
|
;Fuel trim composite dialog
|
||||||
|
dialog = inj_trim1TblTitle, "Channel #1"
|
||||||
|
panel = fuelTrimTable1Tbl, Center
|
||||||
|
dialog = inj_trim2TblTitle, "Channel #2"
|
||||||
|
panel = fuelTrimTable1Tbl
|
||||||
|
dialog = inj_trim3TblTitle, "Channel #3"
|
||||||
|
panel = fuelTrimTable1Tbl
|
||||||
|
dialog = inj_trim4TblTitle, "Channel #4"
|
||||||
|
panel = fuelTrimTable1Tbl
|
||||||
|
|
||||||
|
dialog = inj_trimadt, "", xAxis
|
||||||
|
panel = inj_trim1TblTitle
|
||||||
|
panel = inj_trim2TblTitle
|
||||||
|
dialog = inj_trimadb, "", xAxis
|
||||||
|
panel = inj_trim3TblTitle
|
||||||
|
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
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; General help text
|
; General help text
|
||||||
|
@ -1127,6 +1196,21 @@ menuDialog = main
|
||||||
gridHeight = 3.0
|
gridHeight = 3.0
|
||||||
upDownLabel = "HIGHER", "LOWER"
|
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
|
||||||
|
|
||||||
|
gridHeight = 2.0
|
||||||
|
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||||
|
upDownLabel = "(RICHER)", "(LEANER)"
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
|
|
||||||
[GaugeConfigurations]
|
[GaugeConfigurations]
|
||||||
|
|
|
@ -35,8 +35,43 @@ void initialiseSchedulers()
|
||||||
TIFR4 = 0x00; //Timer4 INT Flag Reg: Clear Timer Overflow Flag
|
TIFR4 = 0x00; //Timer4 INT Flag Reg: Clear Timer Overflow Flag
|
||||||
TCCR4A = 0x00; //Timer4 Control Reg A: Wave Gen Mode normal
|
TCCR4A = 0x00; //Timer4 Control Reg A: Wave Gen Mode normal
|
||||||
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
|
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
|
||||||
|
|
||||||
#elif defined (CORE_TEENSY) && defined (__MK20DX256__)
|
#elif defined (CORE_TEENSY) && defined (__MK20DX256__)
|
||||||
|
|
||||||
//Configure ARM timers here
|
//Configure ARM timers here
|
||||||
|
FTM0_MODE |= FTM_MODE_WPDIS; // Write Protection Disable
|
||||||
|
FTM0_MODE |= FTM_MODE_FTMEN; // Unrestricted FTM mode
|
||||||
|
FTM0_SC |= FTM_SC_TOIE; // enable Overflow Interrupt
|
||||||
|
|
||||||
|
// enable the clock for FTM0
|
||||||
|
FTM0_SC |= FTM_SC_CLKS(0b10);
|
||||||
|
// 00 No clock selected. This in effect disables the FTM counter.
|
||||||
|
// 01 System clock
|
||||||
|
// 10 Fixed frequency clock
|
||||||
|
// 11 External clock
|
||||||
|
|
||||||
|
// set Prescaler
|
||||||
|
//FTM0_SC |= FTM_SC_PS(0b111);
|
||||||
|
FTM0_SC |= 0b000;
|
||||||
|
// 000 Divide by 1
|
||||||
|
// 001 Divide by 2
|
||||||
|
// 010 Divide by 4
|
||||||
|
// 011 Divide by 8
|
||||||
|
// 100 Divide by 16
|
||||||
|
// 101 Divide by 32
|
||||||
|
// 110 Divide by 64
|
||||||
|
// 111 Divide by 128
|
||||||
|
|
||||||
|
// set the counter initial value
|
||||||
|
FTM0_CNT = 0;
|
||||||
|
|
||||||
|
// enable the clock for FTM0
|
||||||
|
SIM_SCGC6 |= SIM_SCGC6_FTM0;
|
||||||
|
|
||||||
|
// enable IRQ Interrupt
|
||||||
|
NVIC_ENABLE_IRQ(IRQ_FTM0);
|
||||||
|
|
||||||
|
FTM0_FMS |= FTM0_WPEN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,7 +264,7 @@ void setIgnitionSchedule2(void (*startCallback)(), unsigned long timeout, unsign
|
||||||
IGN2_COMPARE = ignitionSchedule2.startCompare;
|
IGN2_COMPARE = ignitionSchedule2.startCompare;
|
||||||
ignitionSchedule2.Status = PENDING; //Turn this schedule on
|
ignitionSchedule2.Status = PENDING; //Turn this schedule on
|
||||||
interrupts();
|
interrupts();
|
||||||
IGN1_TIMER_ENABLE();
|
IGN2_TIMER_ENABLE();
|
||||||
}
|
}
|
||||||
void setIgnitionSchedule3(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
|
void setIgnitionSchedule3(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
|
||||||
{
|
{
|
||||||
|
|
|
@ -562,10 +562,10 @@ void setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
//For alternatiing injection, the squirt occurs at different times for each channel
|
//For alternatiing injection, the squirt occurs at different times for each channel
|
||||||
if(configPage1.injLayout == INJ_SEMISEQUENTIAL)
|
if(configPage1.injLayout == INJ_SEMISEQUENTIAL || configPage1.injLayout == INJ_PAIRED)
|
||||||
{
|
{
|
||||||
channel1InjDegrees = 0;
|
channel1InjDegrees = 0;
|
||||||
channel2InjDegrees = channel2IgnDegrees;
|
channel2InjDegrees = 180;
|
||||||
}
|
}
|
||||||
else if (configPage1.injLayout == INJ_SEQUENTIAL)
|
else if (configPage1.injLayout == INJ_SEQUENTIAL)
|
||||||
{
|
{
|
||||||
|
@ -680,7 +680,7 @@ void setup()
|
||||||
|
|
||||||
switch(configPage2.sparkMode)
|
switch(configPage2.sparkMode)
|
||||||
{
|
{
|
||||||
case 0:
|
case IGN_MODE_WASTED:
|
||||||
//Wasted Spark (Normal mode)
|
//Wasted Spark (Normal mode)
|
||||||
ign1StartFunction = beginCoil1Charge;
|
ign1StartFunction = beginCoil1Charge;
|
||||||
ign1EndFunction = endCoil1Charge;
|
ign1EndFunction = endCoil1Charge;
|
||||||
|
@ -694,7 +694,7 @@ void setup()
|
||||||
ign5EndFunction = endCoil5Charge;
|
ign5EndFunction = endCoil5Charge;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case IGN_MODE_SINGLE:
|
||||||
//Single channel mode. All ignition pulses are on channel 1
|
//Single channel mode. All ignition pulses are on channel 1
|
||||||
ign1StartFunction = beginCoil1Charge;
|
ign1StartFunction = beginCoil1Charge;
|
||||||
ign1EndFunction = endCoil1Charge;
|
ign1EndFunction = endCoil1Charge;
|
||||||
|
@ -708,7 +708,7 @@ void setup()
|
||||||
ign5EndFunction = endCoil1Charge;
|
ign5EndFunction = endCoil1Charge;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case IGN_MODE_WASTEDCOP:
|
||||||
//Wasted COP mode. Ignition channels 1&3 and 2&4 are paired together
|
//Wasted COP mode. Ignition channels 1&3 and 2&4 are paired together
|
||||||
//This is not a valid mode for >4 cylinders
|
//This is not a valid mode for >4 cylinders
|
||||||
if( configPage1.nCylinders <= 4 )
|
if( configPage1.nCylinders <= 4 )
|
||||||
|
|
Loading…
Reference in New Issue