Move hard and soft cut rev limits from test branch

This commit is contained in:
Josh Stewart 2014-01-10 14:17:10 +08:00
parent 533bec0f35
commit bded6c64b8
3 changed files with 29 additions and 10 deletions

View File

@ -126,10 +126,10 @@ struct config2 {
byte triggerMissingTeeth; //The size of the tooth gap (ie number of missing teeth) byte triggerMissingTeeth; //The size of the tooth gap (ie number of missing teeth)
byte crankRPM; //RPM below which the engine is considered to be cranking byte crankRPM; //RPM below which the engine is considered to be cranking
byte floodClear; //TPS value that triggers flood clear mode (No fuel whilst cranking) byte floodClear; //TPS value that triggers flood clear mode (No fuel whilst cranking)
byte unused3; byte SoftRevLim; //Soft rev limit (RPM/100)
byte unused4; byte SoftLimRetard; //Amount soft limit retards (degrees)
byte unused5; byte SoftLimMax; //Time the soft limit can run
byte unused6; byte HardRevLim; //Hard rev limit (RPM/100)
byte unused7; byte unused7;
byte unused8; byte unused8;
byte unused9; byte unused9;

View File

@ -262,6 +262,7 @@ void loop()
//int ignitionStartAngle = 360 - ignitionAdvance - (configPage2.dwellRun / timePerDegree); // 360 - desired advance angle - number of degrees the dwell will take //int ignitionStartAngle = 360 - ignitionAdvance - (configPage2.dwellRun / timePerDegree); // 360 - desired advance angle - number of degrees the dwell will take
int injector1StartAngle = 355 - ( fastDivide32(currentStatus.PW, timePerDegree) ); //As above, but using fastDivide function int injector1StartAngle = 355 - ( fastDivide32(currentStatus.PW, timePerDegree) ); //As above, but using fastDivide function
int ignition1StartAngle = 360 - currentStatus.advance - (fastDivide32((configPage2.dwellRun*100), timePerDegree) ); //As above, but using fastDivide function int ignition1StartAngle = 360 - currentStatus.advance - (fastDivide32((configPage2.dwellRun*100), timePerDegree) ); //As above, but using fastDivide function
if (currentStatus.RPM > ((int)(configPage2.SoftRevLim * 100)) ) { ignition1StartAngle = ignition1StartAngle + configPage2.SoftLimRetard; } //Softcut RPM limit (If we're above softcut limit, delay timing by configured number of degrees)
//Finally calculate the time (uS) until we reach the firing angles and set the schedules //Finally calculate the time (uS) until we reach the firing angles and set the schedules
//We only need to set the shcedule if we're BEFORE the open angle //We only need to set the shcedule if we're BEFORE the open angle
@ -275,13 +276,16 @@ void loop()
); );
} }
//Likewise for the ignition //Likewise for the ignition
if (ignition1StartAngle > crankAngle) if ( ignition1StartAngle > crankAngle)
{ {
setIgnitionSchedule1(beginCoil1Charge, if (currentStatus.RPM < ((int)(configPage2.HardRevLim) * 100) ) //Check for hard cut rev limit (If we're above the hardcut limit, we simply don't set a spark schedule)
(ignition1StartAngle - crankAngle) * timePerDegree, {
(configPage2.dwellRun * 100), //Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage2. This number therefore needs to be multiplied by 100 to get dwell in uS setIgnitionSchedule1(beginCoil1Charge,
endCoil1Charge (ignition1StartAngle - crankAngle) * timePerDegree,
); (configPage2.dwellRun * 100), //Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage2. This number therefore needs to be multiplied by 100 to get dwell in uS
endCoil1Charge
);
}
} }
} }

View File

@ -199,6 +199,12 @@
crankRPM = scalar, U08, 97, "rpm", 100.0, 0.0, 100, 1000, 0 crankRPM = scalar, U08, 97, "rpm", 100.0, 0.0, 100, 1000, 0
tpsflood = scalar, U08, 98, "raw", 1.0, 0.0, 0.0, 255.0, 0 tpsflood = scalar, U08, 98, "raw", 1.0, 0.0, 0.0, 255.0, 0
;Rev Limits
SoftRevLim = scalar, U08, 99, "rpm", 100.0, 0.0, 100, 25500, 0
SoftLimRetard = scalar, U08, 100, "deg", 0.352, -28.4, -10, 80, 0
SoftLimMax = scalar, U08, 101, "s", 0.1, 0.0, 0.0, 25.5, 1
HardRevLim = scalar, U08, 102, "rpm", 100, 0.0, 100, 25500, 0
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@ -238,6 +244,7 @@
subMenu = accelEnrichments, "&Acceleration Wizard" subMenu = accelEnrichments, "&Acceleration Wizard"
subMenu = veTableTbl, "&VE Table", 0 subMenu = veTableTbl, "&VE Table", 0
subMenu = sparkTbl, "&Spark Table", 1 subMenu = sparkTbl, "&Spark Table", 1
subMenu = RevLimiterS, "Rev Limits", 2
menu = "&Spark" menu = "&Spark"
subMenu = sparkSettings, "&Spark Settings" subMenu = sparkSettings, "&Spark Settings"
@ -373,6 +380,14 @@
field = "is applied. At higher voltages the time is reduced" field = "is applied. At higher voltages the time is reduced"
field = "and when low it is increased" field = "and when low it is increased"
dialog = RevLimiterS, "Rev Limiter", 4
topicHelp = Fhelp7
field = "Rev Limiter"
field = "Soft rev limit", SoftRevLim
field = "Soft limit absolute timing", SoftLimRetard
field = "Soft limit max time", SoftLimMax
field = "Hard Rev limit", HardRevLim
; [CurveEditor] ; [CurveEditor]
;time-based accel enrichment ;time-based accel enrichment