Add RPM switch point for instantaneous map sample method. (#572)

* Add RPM switch point for instantaneous MAP reading

* Add descriptions and other stuff to make PR

* Add suggested changes

* Use RPMdiv 100 for reading switch point

Co-authored-by: Josh Stewart <josh@noisymime.org>
This commit is contained in:
Pasi Kemppainen 2021-07-19 02:07:44 +03:00 committed by GitHub
parent f776c4b170
commit 0e3514980e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 13 deletions

View File

@ -405,8 +405,9 @@ page = 1
iacRPMlimitHysteresis = scalar, U08, 122, "RPM" 10, 0 10 2500, 0
rtc_trim = scalar, S08, 123, "ppm", 1, 0, -127, +127, 0
idleAdvVss = scalar, U08, 124, "km/h", 1 0.0, 0.0, 255, 0
unused2-95 = array, U08, 125, [3], "%", 1.0, 0.0, 0.0, 255, 0
idleAdvVss = scalar, U08, 124, "km/h", 1 0.0, 0.0, 255, 0
mapSwitchPoint = scalar, U08, 125, "RPM", 100, 0.0, 0.0, 16320, 0
unused2-95 = array, U08, 126, [2], "%", 1.0, 0.0, 0.0, 255, 0
;Page 2 is the fuel map and axis bins only
page = 2
@ -1386,6 +1387,7 @@ page = 14
defaultValue = useEMAP, 0
defaultValue = EMAPMin, 10
defaultValue = EMAPMax, 260
defaultValue = mapSwitchPoint, 0
defaultValue = fpPrime, 3
defaultValue = TrigFilter, 0
defaultValue = ignCranklock,0
@ -1728,6 +1730,7 @@ menuDialog = main
twoStroke = "Four-Stroke (most engines), Two-stroke."
nInjectors = "Number of primary injectors."
mapSample = "The method used for calculating the MAP reading\nFor 1-2 Cylinder engines, Cycle Minimum is recommended.\nFor more than 2 cylinders Cycle Average is recommended"
mapSwitchPoint = "Below this RPM instantaneous map sample method is used, instead of selected one.\nSet 0 RPM to disable (Default)"
stoich = "The stoichiometric ration of the fuel being used. For flex fuel, choose the primary fuel"
injLayout = "The injector layout and timing to be used. Options are: \n 1. Paired - 2 injectors per output. Outputs active is equal to half the number of cylinders. Outputs are timed over 1 crank revolution. \n 2. Semi-sequential: Same as paired except that injector channels are mirrored (1&4, 2&3) meaning the number of outputs used are equal to the number of cylinders. Only valid for 4 cylinders or less. \n 3. Banked: 2 outputs only used. \n 4. Sequential: 1 injector per output and outputs used equals the number of cylinders. Injection is timed over full cycle. "
@ -2100,10 +2103,11 @@ menuDialog = main
; dialogs can be nested and can be mixed with fields
dialog = engine_constants_southwest, "Speeduino Board"
field = "Stoichiometric ratio", stoich
field = "Injector Layout", injLayout
field = "Board Layout", pinLayout
field = "MAP Sample method", mapSample
field = "Stoichiometric ratio", stoich
field = "Injector Layout", injLayout
field = "Board Layout", pinLayout
field = "MAP Sample method", mapSample
field = "MAP Sample switch point", mapSwitchPoint { mapSample >= 1 }
dialog = engine_constants_west, ""
panel = std_injection, North

View File

@ -872,8 +872,9 @@ struct config2 {
int8_t rtc_trim;
byte idleAdvVss;
byte mapSwitchPoint;
byte unused2_95[3];
byte unused2_95[2];
#if defined(CORE_AVR)
};

View File

@ -215,7 +215,7 @@ static inline void readMAP()
case 1:
//Average of a cycle
if ( (currentStatus.RPM > 0) && (currentStatus.hasSync == true) && (currentStatus.startRevolutions > 1) ) //If the engine isn't running, fall back to instantaneous reads
if ( (currentStatus.RPMdiv100 > configPage2.mapSwitchPoint) && (currentStatus.hasSync == true) && (currentStatus.startRevolutions > 1) ) //If the engine isn't running and RPM below switch point, fall back to instantaneous reads
{
if( (MAPcurRev == currentStatus.startRevolutions) || ( (MAPcurRev+1) == currentStatus.startRevolutions) ) //2 revolutions are looked at for 4 stroke. 2 stroke not currently catered for.
{
@ -281,12 +281,17 @@ static inline void readMAP()
MAPcount = 0;
}
}
else { instanteneousMAPReading(); }
else
{
instanteneousMAPReading();
MAPrunningValue = currentStatus.mapADC; //Keep updating the MAPrunningValue to give it head start when switching to cycle average.
MAPcount = 1;
}
break;
case 2:
//Minimum reading in a cycle
if (currentStatus.RPM > 0 ) //If the engine isn't running, fall back to instantaneous reads
if (currentStatus.RPMdiv100 > configPage2.mapSwitchPoint) //If the engine isn't running and RPM below switch point, fall back to instantaneous reads
{
if( (MAPcurRev == currentStatus.startRevolutions) || ((MAPcurRev+1) == currentStatus.startRevolutions) ) //2 revolutions are looked at for 4 stroke. 2 stroke not currently catered for.
{
@ -320,12 +325,16 @@ static inline void readMAP()
validateMAP();
}
}
else { instanteneousMAPReading(); }
else
{
instanteneousMAPReading();
MAPrunningValue = currentStatus.mapADC; //Keep updating the MAPrunningValue to give it head start when switching to cycle minimum.
}
break;
case 3:
//Average of an ignition event
if ( (currentStatus.RPM > 0) && (currentStatus.hasSync == true) && (currentStatus.startRevolutions > 1) && (! currentStatus.engineProtectStatus) ) //If the engine isn't running, fall back to instantaneous reads
if ( (currentStatus.RPMdiv100 > configPage2.mapSwitchPoint) && (currentStatus.hasSync == true) && (currentStatus.startRevolutions > 1) && (! currentStatus.engineProtectStatus) ) //If the engine isn't running, fall back to instantaneous reads
{
if( (MAPcurRev == ignitionCount) ) //Watch for a change in the ignition counter to determine whether we're still on the same event
{
@ -367,7 +376,12 @@ static inline void readMAP()
MAPcount = 0;
}
}
else { instanteneousMAPReading(); }
else
{
instanteneousMAPReading();
MAPrunningValue = currentStatus.mapADC; //Keep updating the MAPrunningValue to give it head start when switching to ignition event average.
MAPcount = 1;
}
break;
default:

View File

@ -491,6 +491,9 @@ void doUpdates()
configPage10.vvtCLMaxAng = 200;
configPage4.ANGLEFILTER_VVT = 0;
//RPM switch point added for map sample method. Set to 0 to not affect existing tunes.
configPage2.mapSwitchPoint = 0;
configPage9.boostByGearEnabled = 0;
writeAllConfig();