From 602203d3e0f9ceffae98edfa22af6e4b8987d712 Mon Sep 17 00:00:00 2001 From: 155ac <143891251+155ac@users.noreply.github.com> Date: Tue, 24 Oct 2023 08:06:53 -0300 Subject: [PATCH] MAP Limits for EGO (#1124) * Map Limits for EGO * Better update value for not breaking old tunes my guess is that 300 kpa max will be good for not disabling EGO when using boost now but you can change for what value you think is the best * Atualizar o updates.cpp fix my dumbo mistake * Prevent signed vs unsigned warning --------- Co-authored-by: Josh Stewart --- reference/speeduino.ini | 12 ++++++++++-- speeduino/corrections.cpp | 2 +- speeduino/globals.h | 4 ++-- speeduino/updates.cpp | 3 +++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index f4fd9b6a..ad54524b 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -1005,8 +1005,8 @@ page = 9 unused10_110 = scalar, U08, 110, "", 1, 0, 0, 255, 0 unused10_111 = scalar, U08, 111, "", 1, 0, 0, 255, 0 - unused10_112 = scalar, U08, 112, "", 1, 0, 0, 255, 0 - unused10_113 = scalar, U08, 113, "", 1, 0, 0, 255, 0 + egoMAPMax = scalar, U08, 112, "kPa", 2.0, 0.0, 2.0, 511.0, 0 + egoMAPMin = scalar, U08, 113, "kPa", 2.0, 0.0, 2.0, 511.0, 0 speeduino_tsCanId = bits, U08, 114, [0:3], $tsCanId_list true_address = bits, U16, 115, [0:10], $CAN_ADDRESS_HEX @@ -1835,6 +1835,9 @@ page = 15 defaultValue = rollingProtRPMDelta, -300 -200 -100 -50 defaultValue = rollingProtCutPercent, 50 65 80 95 + defaultValue = egoMAPMax, 100 + defaultValue = egoMAPMin, 26 + #if LAMBDA defaultValue = wueAFR, -0.136 -0.102 -0.082 -0.068 -0.054 -0.041 -0.027 -0.014 -0.007 0.000 #else @@ -2393,6 +2396,9 @@ menuDialog = main boostDCWhenDisabled = "When the closedloop boost controller is disabled by 'enable trigger', this is the Duty cycle set on the boost selenoid. Ususally this is 99% because it keeps the waste gate firmly closed until the threshold and builds boost as fast as possible (no wastegate leak)" boostControlEnableThreshold = "When the 'Boost control enable trigger' is set to 'fixed', this value is used as threshold. Usually the value is set just below the wastgate pressure of the used turbo setup. For example 130kpa for a 0.3 bar wastegate actuator. Below this value the ECU has no control over the boost anyway." + egoMAPMax = "Only Correct below this MAP Value" + egoMAPMin = "Only Correct above this MAP Value" + [UserDefined] ; Enhanced TunerStudio dialogs can be defined here @@ -2701,6 +2707,8 @@ menuDialog = main field = "Active Above Coolant", egoTemp, { egoType && (egoAlgorithm < 3) } field = "Active Above RPM", egoRPM, { egoType && (egoAlgorithm < 3) } field = "Active Below TPS", egoTPSMax, { egoType && (egoAlgorithm < 3) } + field = "Active Below MAP", egoMAPMax, { egoType && (egoAlgorithm < 3) } + field = "Active Above MAP", egoMAPMin, { egoType && (egoAlgorithm < 3) } field = "EGO delay after start", ego_sdelay, { (egoAlgorithm < 3) } field = "PID Proportional Gain", egoKP, { egoType && (egoAlgorithm == 2) } field = "PID Integral", egoKI, { egoType && (egoAlgorithm == 2) } diff --git a/speeduino/corrections.cpp b/speeduino/corrections.cpp index f1edba50..4cce67a6 100644 --- a/speeduino/corrections.cpp +++ b/speeduino/corrections.cpp @@ -631,7 +631,7 @@ byte correctionAFRClosedLoop(void) AFRnextCycle = ignitionCount + configPage6.egoCount; //Set the target ignition event for the next calculation //Check all other requirements for closed loop adjustments - if( (currentStatus.coolant > (int)(configPage6.egoTemp - CALIBRATION_TEMPERATURE_OFFSET)) && (currentStatus.RPM > (unsigned int)(configPage6.egoRPM * 100)) && (currentStatus.TPS <= configPage6.egoTPSMax) && (currentStatus.O2 < configPage6.ego_max) && (currentStatus.O2 > configPage6.ego_min) && (currentStatus.runSecs > configPage6.ego_sdelay) && (BIT_CHECK(currentStatus.status1, BIT_STATUS1_DFCO) == 0) ) + if( (currentStatus.coolant > (int)(configPage6.egoTemp - CALIBRATION_TEMPERATURE_OFFSET)) && (currentStatus.RPM > (unsigned int)(configPage6.egoRPM * 100)) && (currentStatus.TPS <= configPage6.egoTPSMax) && (currentStatus.O2 < configPage6.ego_max) && (currentStatus.O2 > configPage6.ego_min) && (currentStatus.runSecs > configPage6.ego_sdelay) && (BIT_CHECK(currentStatus.status1, BIT_STATUS1_DFCO) == 0) && ( currentStatus.MAP <= (configPage9.egoMAPMax * 2U) ) && ( currentStatus.MAP >= (configPage9.egoMAPMin * 2U) ) ) { //Check which algorithm is used, simple or PID diff --git a/speeduino/globals.h b/speeduino/globals.h index 823de024..41422806 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -1098,8 +1098,8 @@ struct config9 { byte unused10_110; byte unused10_111; - byte unused10_112; - byte unused10_113; + byte egoMAPMax; //needs to be multiplied by 2 to get the proper value + byte egoMAPMin; //needs to be multiplied by 2 to get the proper value byte speeduino_tsCanId:4; //speeduino TS canid (0-14) uint16_t true_address; //speeduino 11bit can address uint16_t realtime_base_address; //speeduino 11 bit realtime base address diff --git a/speeduino/updates.cpp b/speeduino/updates.cpp index 2bdc03e1..5197a6cd 100644 --- a/speeduino/updates.cpp +++ b/speeduino/updates.cpp @@ -728,6 +728,9 @@ void doUpdates(void) { //202311-dev + //EGO MAP Limits + configPage9.egoMAPMax = 255, // 255 will be 510 kpa + configPage9.egoMAPMin = 0, // 0 will be 0 kpa writeAllConfig(); storeEEPROMVersion(23);