[PW Math] Introduce fixed MAP multiply (#347)

* [PW Math] Introduce fixed MAP multiply

* Compilation fix

Co-authored-by: Josh Stewart <josh@noisymime.org>
This commit is contained in:
Vitor Moreno B. Sales 2020-08-15 19:59:36 -03:00 committed by GitHub
parent 99abe431db
commit f84bdade64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -247,7 +247,9 @@ page = 1
aeMode = bits, U08, 3, [0:1], "TPS", "MAP", "INVALID", "INVALID"
battVCorMode = bits, U08, 3, [2:2], "Whole PW", "Open Time only"
SoftLimitMode = bits, U08, 3, [3:3], "Fixed", "Relative "
unused1-3c = bits, U08, 3, [4:7], "MAP", "TPS", "INVALID", "INVALID"
unused1-3c = bits, U08, 3, [4:5], "MAP", "TPS", "INVALID", "INVALID"
fixedMultiplyMAP = bits, U08, 3, [6:6], "Baro", "Fixed"
unused1-3d = bits, U08, 3, [7:7], "MAP", "TPS", "INVALID", "INVALID"
wueRates = array, U08, 4, [10], "%", 1.0, 0.0, 0.0, 255, 0
crankingPct = scalar, U08, 14, "%", 1.0, 0.0, 0.0, 255, 0
pinLayout = bits, U08, 15, [0:7], "Speeduino v0.1", "Speeduino v0.2", "Speeduino v0.3", "Speeduino v0.4", "INVALID", "INVALID", "01-05 MX5 PNP", "INVALID", "96-97 MX5 PNP", "NA6 MX5 PNP", "Turtana PCB", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Plazomat I/O 0.1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Daz V6 Shield 0.1", "BMW PnP", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NO2C", "UA4C", "INVALID", "INVALID", "INVALID", "DIY-EFI CORE4 v1.0", "INVALID", "INVALID", "INVALID", "INVALID", "dvjcodec Teensy RevA", "dvjcodec Teensy RevB", "INVALID", "INVALID", "INVALID", "Drop Bear", "INVALID", "INVALID", "INVALID", "INVALID", "Black STM32F407VET6 V0.1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
@ -1307,6 +1309,7 @@ page = 13
defaultValue = TrigFilter, 0
defaultValue = ignCranklock,0
defaultValue = multiplyMAP, 0
defaultValue = fixedMultiplyMAP, 0
defaultValue = includeAFR, 0
defaultValue = incorporateAFR, 0
defaultValue = stoich, 14.7
@ -1854,6 +1857,7 @@ menuDialog = main
ignCranklock = "On certain low resolution ignition patterns, the cranking timing can be locked to occur when a pulse is recieved."
multiplyMAP = "If enabled, the MAP reading is included directly into the pulsewidth calculation by multiplying the VE lookup value by the MAP:Baro ratio. This results in a flatter VE table that can be easier to tune in some instances. VE table must be retuned when this value is changed."
fixedMultiplyMAP = "This select how MAP multiply should perform, using Baro or fixed 100% value."
legacyMAP = "Use the legacy method of reading the MAP sensor that was used prior to the 201905 firmware. This should ONLY be enabled if you are upgrading from a firmware earlier than this"
includeAFR = "When enabled, the current AFR reading is incorporated directly in the pulsewidth calculation as a percentage of the current target ratio. VE table must be retuned when this value is changed. "
useExtBaro = "By Default, Speeduino will measure barometric pressure upon startup. Optionally however, a 2nd pressure sensor can be used to perform live barometric readings whilst the system is on."
@ -2229,6 +2233,7 @@ menuDialog = main
dialog = veTableDialog_south, ""
field = "Multiply VE value by MAP:Baro ratio", multiplyMAP
field = "MAP Multiply ratio source", fixedMultiplyMAP { multiplyMAP == 1 }
field = "Multiply by ratio of AFR to Target AFR", includeAFR, { egoType == 2 && !incorporateAFR || (incorporateAFR==includeAFR) }
field = "Multiply by ratio of stoich AFR/target AFR (incorporate AFR)", incorporateAFR, { !includeAFR || (incorporateAFR==includeAFR) }

View File

@ -615,7 +615,9 @@ struct config2 {
byte aeMode : 2; /**< Acceleration Enrichment mode. 0 = TPS, 1 = MAP. Values 2 and 3 reserved for potential future use (ie blended TPS / MAP) */
byte battVCorMode : 1;
byte SoftLimitMode : 1;
byte unused1_3c : 4;
byte unused1_3c : 2;
byte fixedMultiplyMAP : 1; //0 multiplyMAP = baro | 1 multiplyMAP = 100
byte unused1_3d : 1;
byte wueValues[10]; //Warm up enrichment array (10 bytes)
byte crankingPct; //Cranking enrichment
byte pinMapping; // The board / ping mapping to be used

View File

@ -1252,7 +1252,9 @@ uint16_t PW(int REQ_FUEL, byte VE, long MAP, uint16_t corrections, int injOpen)
iVE = ((unsigned int)VE << 7) / 100;
if ( configPage2.multiplyMAP == true ) {
iMAP = ((unsigned int)MAP << 7) / currentStatus.baro; //Include multiply MAP (vs baro) if enabled
if ( configPage2.fixedMultiplyMAP == true) { iMAP = ((unsigned int)MAP << 7) / 100; }
//Include multiply MAP (vs baro) if enabled
else { iMAP = ((unsigned int)MAP << 7) / currentStatus.baro; }
}
if ( (configPage2.includeAFR == true) && (configPage6.egoType == 2) && (currentStatus.runSecs > configPage6.ego_sdelay) ) {
iAFR = ((unsigned int)currentStatus.O2 << 7) / currentStatus.afrTarget; //Include AFR (vs target) if enabled