From d05432df12b078a6085c0db889161665db720e88 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 7 Jan 2018 12:11:49 -0500 Subject: [PATCH] fix #532 --- README.md | 1 + .../controllers/algo/engine_configuration.cpp | 55 +++++--- ...ngine_configuration_generated_structures.h | 6 +- firmware/controllers/core/table_helper.cpp | 2 +- firmware/integration/rusefi_config.txt | 18 +-- firmware/rusefi.cpp | 2 +- firmware/svnversion.h | 4 +- firmware/tunerstudio/rusefi.ini | 123 +++++++++--------- firmware/tunerstudio/rusefi.input | 41 +++--- firmware/util/efilib.cpp | 6 + 10 files changed, 144 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index 8397daf312..7e11338e17 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ current binaries are always available at http://rusefi.com/build_server/ | Release date | Revision | Details | | ------------ | --------- | ------- | +| 01/07/2018 | r14952 | usability & minor bugfix #532 idle defaults are broken | | 12/17/2017 | r14892 | bugfix #513: console: erase on older chips does not work | | 11/26/2017 | r14789 | bugfix #500: set_rpn_expression command is broken | | 11/23/2017 | r14779 | bugfix #497: engine does not start with SD card | diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index cfc9ea437f..514abd8a72 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -517,8 +517,12 @@ static void setDefaultCrankingSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } +/** + * see also setTargetRpmCurve() + */ static void setDefaultIdleSpeedTarget(DECLARE_ENGINE_PARAMETER_SIGNATURE) { - // todo: set bins + setLinearCurve(engineConfiguration->cltIdleRpmBins, CLT_CURVE_SIZE, -40, 140, 10); + setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, -30, 1350); setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, -20, 1300); setCurveValue(engineConfiguration->cltIdleRpmBins, engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, -10, 1200); @@ -556,9 +560,12 @@ static void setCanDefaults(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8; } +/** + * see also setDefaultIdleSpeedTarget() + */ void setTargetRpmCurve(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { - setLinearCurve(engineConfiguration->cltIdleRpmBins, DWELL_CURVE_SIZE, -40, 90, 0); - setLinearCurve(engineConfiguration->cltIdleRpm, DWELL_CURVE_SIZE, rpm, rpm, 0); + setLinearCurve(engineConfiguration->cltIdleRpmBins, CLT_CURVE_SIZE, -40, 90, 10); + setLinearCurve(engineConfiguration->cltIdleRpm, CLT_CURVE_SIZE, rpm, rpm, 10); } /** @@ -728,9 +735,6 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->warmupTargetAfrBins[3] = 60; engineConfiguration->warmupTargetAfr[3] = 14.5; - setDefaultIdleSpeedTarget(PASS_ENGINE_PARAMETER_SIGNATURE); - - engineConfiguration->fuelClosedLoopCorrectionEnabled = false; engineConfiguration->fuelClosedLoopCltThreshold = 70; engineConfiguration->fuelClosedLoopRpmThreshold = 900; @@ -739,8 +743,11 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->fuelClosedLoopAfrHighThreshold = 19.8; engineConfiguration->fuelClosedLoopPid.pFactor = -0.1; - engineConfiguration->cranking.baseFuel = 5; - engineConfiguration->startUpFuelPumpDuration = 4; + /** + * Idle control defaults + */ + setDefaultIdleSpeedTarget(PASS_ENGINE_PARAMETER_SIGNATURE); + // setTargetRpmCurve(1200 PASS_ENGINE_PARAMETER_SUFFIX); engineConfiguration->idleRpmPid.pFactor = 0.05; engineConfiguration->idleRpmPid.iFactor = 0.002; @@ -749,12 +756,31 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->idleRpmPid.maxValue = 95; boardConfiguration->idlePidDeactivationTpsThreshold = 2; - engineConfiguration->analogInputDividerCoefficient = 2; + boardConfiguration->idleStepperPulseDuration = 10; + boardConfiguration->idle.solenoidFrequency = 200; + // set idle_position 50 + boardConfiguration->manIdlePosition = 50; + engineConfiguration->crankingIACposition = 50; +// engineConfiguration->idleMode = IM_AUTO; + engineConfiguration->idleMode = IM_MANUAL; + boardConfiguration->useStepperIdle = false; + + setDefaultStepperIdleParameters(PASS_ENGINE_PARAMETER_SIGNATURE); + + /** + * Cranking defaults + */ + engineConfiguration->startUpFuelPumpDuration = 4; + engineConfiguration->cranking.baseFuel = 5; engineConfiguration->crankingChargeAngle = 70; + + engineConfiguration->timingMode = TM_DYNAMIC; engineConfiguration->fixedModeTiming = 50; + engineConfiguration->analogInputDividerCoefficient = 2; + // performance optimization boardConfiguration->sensorChartMode = SC_OFF; @@ -841,22 +867,11 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->useOnlyRisingEdgeForTrigger = false; - boardConfiguration->idleStepperPulseDuration = 10; - boardConfiguration->idle.solenoidFrequency = 200; - // set idle_position 50 - boardConfiguration->manIdlePosition = 50; - engineConfiguration->crankingIACposition = 50; - setTargetRpmCurve(1200 PASS_ENGINE_PARAMETER_SUFFIX); -// engineConfiguration->idleMode = IM_AUTO; - engineConfiguration->idleMode = IM_MANUAL; engineConfiguration->acSwitchAdc = EFI_ADC_NONE; engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE; - boardConfiguration->useStepperIdle = false; - - setDefaultStepperIdleParameters(PASS_ENGINE_PARAMETER_SIGNATURE); #if EFI_PROD_CODE || defined(__DOXYGEN__) diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index ef7178d5c5..b06d346e6d 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -1,4 +1,4 @@ -// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 06 10:47:12 EST 2018 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jan 07 12:06:45 EST 2018 // begin #ifndef ENGINE_CONFIGURATION_GENERATED_H_ #define ENGINE_CONFIGURATION_GENERATED_H_ @@ -1591,6 +1591,7 @@ typedef struct { */ int step1RpmWindow; /** + * See cltIdleRpmBins * offset 1884 */ pid_s idleRpmPid; @@ -1663,6 +1664,7 @@ typedef struct { */ float cltIdleRpmBins[CLT_CURVE_SIZE]; /** + * See idleRpmPid * offset 2076 */ float cltIdleRpm[CLT_CURVE_SIZE]; @@ -2317,4 +2319,4 @@ typedef struct { #endif // end -// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 06 10:47:12 EST 2018 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jan 07 12:06:45 EST 2018 diff --git a/firmware/controllers/core/table_helper.cpp b/firmware/controllers/core/table_helper.cpp index 162ecd5ba4..11d1b1b69b 100644 --- a/firmware/controllers/core/table_helper.cpp +++ b/firmware/controllers/core/table_helper.cpp @@ -15,7 +15,7 @@ */ void setLinearCurve(float array[], int size, float from, float to, float precision) { for (int i = 0; i < size; i++) { - float value = interpolateMsg("setTable", 0, from, size - 1, to, i); + float value = interpolateMsg("setLinearCurve", 0, from, size - 1, to, i); /** * rounded values look nicer, also we want to avoid precision mismatch with Tuner Studio */ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 3dbe685ee0..6084de7fa4 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -133,10 +133,10 @@ custom ignition_table_t 1024 array, F32, @OFFSET@, [16x16],"deg", 1, custom angle_table_t 1024 array, F32, @OFFSET@, [16x16],"deg", 1, 0, -720, 720, 2 struct pid_s - float pFactor;;"value", 1, 0, -10000, 10000, 7 - float iFactor;;"value", 1, 0, -10000, 10000, 7 - float dFactor;;"value", 1, 0, -10000, 10000, 7 - int16_t offset;Linear addition to PID logic;"value", 1, 0, 0, 1000, 0 + float pFactor;;"", 1, 0, -10000, 10000, 7 + float iFactor;;"", 1, 0, -10000, 10000, 7 + float dFactor;;"", 1, 0, -10000, 10000, 7 + int16_t offset;Linear addition to PID logic;"", 1, 0, 0, 1000, 0 int16_t period;PID dTime;"ms", 1, 0, 0, 3000, 0 int16_t minValue;;"", 1, 0, 0, 3000.0, 3 int16_t maxValue;;"", 1, 0, 0, 3000.0, 3 @@ -185,9 +185,9 @@ adc_channel_e hwChannel; end_struct struct MAP_sensor_config_s @brief MAP averaging configuration -float[MAP_ANGLE_SIZE] samplingAngleBins;;"RPM", 1, 0, 0.0, 18000, 2 +float[MAP_ANGLE_SIZE] samplingAngleBins;;"", 1, 0, 0.0, 18000, 2 float[MAP_ANGLE_SIZE] samplingAngle;@brief MAP averaging sampling start angle, by RPM;"deg", 1, 0, -180, 180, 2 -float[MAP_WINDOW_SIZE] samplingWindowBins;;"RPM", 1, 0, 0.0, 18000, 2 +float[MAP_WINDOW_SIZE] samplingWindowBins;;"", 1, 0, 0.0, 18000, 2 float[MAP_WINDOW_SIZE] samplingWindow;@brief MAP averaging angle duration, by RPM;"deg", 1, 0, 0, 180, 2 air_pressure_sensor_config_s sensor end_struct @@ -663,7 +663,7 @@ bit unused_bit_1472_26; bit unused_bit_1472_27; adc_channel_e hipOutputChannel; -custom idle_mode_e 4 bits, U32, @OFFSET@, [0:0], "false", "true" +custom idle_mode_e 4 bits, U32, @OFFSET@, [0:0], "Automatic", "Manual" idle_mode_e idleMode; bit isInjectionEnabled;+enable injection @@ -753,7 +753,7 @@ custom pin_mode_e 4 bits, U32, @OFFSET@, [0:5], @@pin_mode_e_enum@@ float mapErrorDetectionTooLow;kPa value which is too low to be true;"kPa", 1, 0, -100.0, 100.0, 2 float mapErrorDetectionTooHigh;kPa value which is too high to be true;"kPa", 1, 0, -100.0, 800.0, 2 int step1RpmWindow;RPMs prior to step1rpm point where ignition advance is retarded;"rpm", 1, 0, 0, 3000.0, 2 - pid_s idleRpmPid; + pid_s idleRpmPid;See cltIdleRpmBins float addedToWallCoef;;"%", 1, 0, 0.0, 300.0, 2 brain_pin_e communicationPin;blue LED on discovery by default brain_pin_e runningPin;green LED on discovery by default @@ -773,7 +773,7 @@ custom pin_mode_e 4 bits, U32, @OFFSET@, [0:5], @@pin_mode_e_enum@@ float[CLT_CURVE_SIZE] cltIdleRpmBins;CLT-based target RPM for automatic idle controller;"C", 1, 0, -100.0, 250.0, 2 - float[CLT_CURVE_SIZE] cltIdleRpm;;"RPM", 1, 0, 0.0, 8000.0, 0 + float[CLT_CURVE_SIZE] cltIdleRpm;See idleRpmPid;"", 1, 0, 0.0, 8000.0, 0 float targetVBatt;set targetvbatt VOLTS;"Volts", 1, 0, 0,30, 1 float alternatorOffAboveTps;Turn off alternator output above specified TPS;"%", 1, 0, 0, 200, 2 diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 5d20f9eb5e..e843d1f782 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -263,5 +263,5 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20180104; + return 20180107; } diff --git a/firmware/svnversion.h b/firmware/svnversion.h index 86a66c337d..700d1ea29e 100644 --- a/firmware/svnversion.h +++ b/firmware/svnversion.h @@ -1,5 +1,5 @@ // This file was generated by Version2Header -// Mon Dec 25 10:11:16 EST 2017 +// Sun Jan 07 12:10:11 EST 2018 #ifndef VCS_VERSION -#define VCS_VERSION "14915" +#define VCS_VERSION "14952" #endif diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 54789e9bdc..cc9d8ed971 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -63,7 +63,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jan 06 10:47:12 EST 2018 +; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jan 07 12:06:45 EST 2018 pageSize = 20000 page = 1 @@ -111,9 +111,9 @@ page = 1 primingSquirtDurationMs = scalar, F32, 96, "*C", 1, 0, -40, 200, 1 ignitionDwellForCrankingMs = scalar, F32, 100, "ms", 1, 0, 0, 200, 1 crankingChargeAngle = scalar, F32, 104, "deg", 1, 0, 0, 3000.0, 0 - map_samplingAngleBins = array, F32, 108, [8], "RPM", 1, 0, 0.0, 18000, 2 + map_samplingAngleBins = array, F32, 108, [8], "", 1, 0, 0.0, 18000, 2 map_samplingAngle = array, F32, 140, [8], "deg", 1, 0, -180, 180, 2 - map_samplingWindowBins = array, F32, 172, [8], "RPM", 1, 0, 0.0, 18000, 2 + map_samplingWindowBins = array, F32, 172, [8], "", 1, 0, 0.0, 18000, 2 map_samplingWindow = array, F32, 204, [8], "deg", 1, 0, 0, 180, 2 map_sensor_lowValue = scalar, F32, 236, "kpa", 1, 0, -400, 800, 2 map_sensor_highValue = scalar, F32, 240, "kpa", 1, 0, -400, 800, 2 @@ -480,7 +480,7 @@ page = 1 unused_bit_1472_26 = bits, U32, 1472, [26:26], "false", "true" unused_bit_1472_27 = bits, U32, 1472, [27:27], "false", "true" hipOutputChannel = bits, U32, 1476, [0:4] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "Disabled", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" - idleMode = bits, U32, 1480, [0:0], "false", "true" + idleMode = bits, U32, 1480, [0:0], "Automatic", "Manual" isInjectionEnabled = bits, U32, 1484, [0:0], "false", "true" isIgnitionEnabled = bits, U32, 1484, [1:1], "false", "true" isCylinderCleanupEnabled= bits, U32, 1484, [2:2], "false", "true" @@ -550,34 +550,34 @@ page = 1 tachPulseDuractionMs = scalar, F32, 1800, "ms", 1, 0, 0.0, 100.0, 2 tachPulseTriggerIndex = scalar, S32, 1804, "index", 1, 0, 0.0, 360.0, 0 suckedOffCoef = scalar, F32, 1808, "%", 1, 0, 0.0, 300.0, 2 - alternatorControl_pFactor = scalar, F32, 1812, "value", 1, 0, -10000, 10000, 7 - alternatorControl_iFactor = scalar, F32, 1816, "value", 1, 0, -10000, 10000, 7 - alternatorControl_dFactor = scalar, F32, 1820, "value", 1, 0, -10000, 10000, 7 - alternatorControl_offset = scalar, S16, 1824, "value", 1, 0, 0, 1000, 0 + alternatorControl_pFactor = scalar, F32, 1812, "", 1, 0, -10000, 10000, 7 + alternatorControl_iFactor = scalar, F32, 1816, "", 1, 0, -10000, 10000, 7 + alternatorControl_dFactor = scalar, F32, 1820, "", 1, 0, -10000, 10000, 7 + alternatorControl_offset = scalar, S16, 1824, "", 1, 0, 0, 1000, 0 alternatorControl_period = scalar, S16, 1826, "ms", 1, 0, 0, 3000, 0 alternatorControl_minValue = scalar, S16, 1828, "", 1, 0, 0, 3000.0, 3 alternatorControl_maxValue = scalar, S16, 1830, "", 1, 0, 0, 3000.0, 3 - etb_pFactor = scalar, F32, 1832, "value", 1, 0, -10000, 10000, 7 - etb_iFactor = scalar, F32, 1836, "value", 1, 0, -10000, 10000, 7 - etb_dFactor = scalar, F32, 1840, "value", 1, 0, -10000, 10000, 7 - etb_offset = scalar, S16, 1844, "value", 1, 0, 0, 1000, 0 + etb_pFactor = scalar, F32, 1832, "", 1, 0, -10000, 10000, 7 + etb_iFactor = scalar, F32, 1836, "", 1, 0, -10000, 10000, 7 + etb_dFactor = scalar, F32, 1840, "", 1, 0, -10000, 10000, 7 + etb_offset = scalar, S16, 1844, "", 1, 0, 0, 1000, 0 etb_period = scalar, S16, 1846, "ms", 1, 0, 0, 3000, 0 etb_minValue = scalar, S16, 1848, "", 1, 0, 0, 3000.0, 3 etb_maxValue = scalar, S16, 1850, "", 1, 0, 0, 3000.0, 3 - warmupAfrPid_pFactor = scalar, F32, 1852, "value", 1, 0, -10000, 10000, 7 - warmupAfrPid_iFactor = scalar, F32, 1856, "value", 1, 0, -10000, 10000, 7 - warmupAfrPid_dFactor = scalar, F32, 1860, "value", 1, 0, -10000, 10000, 7 - warmupAfrPid_offset = scalar, S16, 1864, "value", 1, 0, 0, 1000, 0 + warmupAfrPid_pFactor = scalar, F32, 1852, "", 1, 0, -10000, 10000, 7 + warmupAfrPid_iFactor = scalar, F32, 1856, "", 1, 0, -10000, 10000, 7 + warmupAfrPid_dFactor = scalar, F32, 1860, "", 1, 0, -10000, 10000, 7 + warmupAfrPid_offset = scalar, S16, 1864, "", 1, 0, 0, 1000, 0 warmupAfrPid_period = scalar, S16, 1866, "ms", 1, 0, 0, 3000, 0 warmupAfrPid_minValue = scalar, S16, 1868, "", 1, 0, 0, 3000.0, 3 warmupAfrPid_maxValue = scalar, S16, 1870, "", 1, 0, 0, 3000.0, 3 mapErrorDetectionTooLow = scalar, F32, 1872, "kPa", 1, 0, -100.0, 100.0, 2 mapErrorDetectionTooHigh = scalar, F32, 1876, "kPa", 1, 0, -100.0, 800.0, 2 step1RpmWindow = scalar, S32, 1880, "rpm", 1, 0, 0, 3000.0, 2 - idleRpmPid_pFactor = scalar, F32, 1884, "value", 1, 0, -10000, 10000, 7 - idleRpmPid_iFactor = scalar, F32, 1888, "value", 1, 0, -10000, 10000, 7 - idleRpmPid_dFactor = scalar, F32, 1892, "value", 1, 0, -10000, 10000, 7 - idleRpmPid_offset = scalar, S16, 1896, "value", 1, 0, 0, 1000, 0 + idleRpmPid_pFactor = scalar, F32, 1884, "", 1, 0, -10000, 10000, 7 + idleRpmPid_iFactor = scalar, F32, 1888, "", 1, 0, -10000, 10000, 7 + idleRpmPid_dFactor = scalar, F32, 1892, "", 1, 0, -10000, 10000, 7 + idleRpmPid_offset = scalar, S16, 1896, "", 1, 0, 0, 1000, 0 idleRpmPid_period = scalar, S16, 1898, "ms", 1, 0, 0, 3000, 0 idleRpmPid_minValue = scalar, S16, 1900, "", 1, 0, 0, 3000.0, 3 idleRpmPid_maxValue = scalar, S16, 1902, "", 1, 0, 0, 3000.0, 3 @@ -596,7 +596,7 @@ page = 1 startUpFuelPumpDuration = scalar, S16, 2008, "seconds", 1, 0, 0, 6000, 0 idlePidRpmDeadZone = scalar, S16, 2010, "RPM", 1, 0, 0, 1000, 0 cltIdleRpmBins = array, F32, 2012, [16], "C", 1, 0, -100.0, 250.0, 2 - cltIdleRpm = array, F32, 2076, [16], "RPM", 1, 0, 0.0, 8000.0, 0 + cltIdleRpm = array, F32, 2076, [16], "", 1, 0, 0.0, 8000.0, 0 targetVBatt = scalar, F32, 2140, "Volts", 1, 0, 0,30, 1 alternatorOffAboveTps = scalar, F32, 2144, "%", 1, 0, 0, 200, 2 startOfCrankingPrimingPulse = scalar, F32, 2148, "ms", 1, 0, 0, 200, 1 @@ -692,10 +692,10 @@ page = 1 fuelClosedLoopTpsThreshold = scalar, S16, 2686, "%", 1, 0, 0, 100, 0 fuelClosedLoopRpmThreshold = scalar, S16, 2688, "rpm", 1, 0, 0, 5000, 0 etbFreq = scalar, S16, 2690, "Hz", 1, 0, 0, 1500, 0 - fuelClosedLoopPid_pFactor = scalar, F32, 2692, "value", 1, 0, -10000, 10000, 7 - fuelClosedLoopPid_iFactor = scalar, F32, 2696, "value", 1, 0, -10000, 10000, 7 - fuelClosedLoopPid_dFactor = scalar, F32, 2700, "value", 1, 0, -10000, 10000, 7 - fuelClosedLoopPid_offset = scalar, S16, 2704, "value", 1, 0, 0, 1000, 0 + fuelClosedLoopPid_pFactor = scalar, F32, 2692, "", 1, 0, -10000, 10000, 7 + fuelClosedLoopPid_iFactor = scalar, F32, 2696, "", 1, 0, -10000, 10000, 7 + fuelClosedLoopPid_dFactor = scalar, F32, 2700, "", 1, 0, -10000, 10000, 7 + fuelClosedLoopPid_offset = scalar, S16, 2704, "", 1, 0, 0, 1000, 0 fuelClosedLoopPid_period = scalar, S16, 2706, "ms", 1, 0, 0, 3000, 0 fuelClosedLoopPid_minValue = scalar, S16, 2708, "", 1, 0, 0, 3000.0, 3 fuelClosedLoopPid_maxValue = scalar, S16, 2710, "", 1, 0, 0, 3000.0, 3 @@ -725,31 +725,31 @@ page = 1 spi1MosiMode = bits, U32, 2804, [0:5], "default", "INVALID", "INVALID", "INVALID", "opendrain", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "mode12", "mode13", "mode14", "mode15", "mode16", "mode17", "mode18", "mode19", "mode20", "mode21", "mode22", "mode23", "mode24", "mode25", "mode26", "mode27", "mode28", "mode29", "mode30", "mode31", "PULLUP", "mode33", "mode34", "mode35" spi1MisoMode = bits, U32, 2808, [0:5], "default", "INVALID", "INVALID", "INVALID", "opendrain", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "mode12", "mode13", "mode14", "mode15", "mode16", "mode17", "mode18", "mode19", "mode20", "mode21", "mode22", "mode23", "mode24", "mode25", "mode26", "mode27", "mode28", "mode29", "mode30", "mode31", "PULLUP", "mode33", "mode34", "mode35" brakePedalPin = bits, U32, 2812, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "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" - auxPid1_pFactor = scalar, F32, 2816, "value", 1, 0, -10000, 10000, 7 - auxPid1_iFactor = scalar, F32, 2820, "value", 1, 0, -10000, 10000, 7 - auxPid1_dFactor = scalar, F32, 2824, "value", 1, 0, -10000, 10000, 7 - auxPid1_offset = scalar, S16, 2828, "value", 1, 0, 0, 1000, 0 + auxPid1_pFactor = scalar, F32, 2816, "", 1, 0, -10000, 10000, 7 + auxPid1_iFactor = scalar, F32, 2820, "", 1, 0, -10000, 10000, 7 + auxPid1_dFactor = scalar, F32, 2824, "", 1, 0, -10000, 10000, 7 + auxPid1_offset = scalar, S16, 2828, "", 1, 0, 0, 1000, 0 auxPid1_period = scalar, S16, 2830, "ms", 1, 0, 0, 3000, 0 auxPid1_minValue = scalar, S16, 2832, "", 1, 0, 0, 3000.0, 3 auxPid1_maxValue = scalar, S16, 2834, "", 1, 0, 0, 3000.0, 3 - auxPid2_pFactor = scalar, F32, 2836, "value", 1, 0, -10000, 10000, 7 - auxPid2_iFactor = scalar, F32, 2840, "value", 1, 0, -10000, 10000, 7 - auxPid2_dFactor = scalar, F32, 2844, "value", 1, 0, -10000, 10000, 7 - auxPid2_offset = scalar, S16, 2848, "value", 1, 0, 0, 1000, 0 + auxPid2_pFactor = scalar, F32, 2836, "", 1, 0, -10000, 10000, 7 + auxPid2_iFactor = scalar, F32, 2840, "", 1, 0, -10000, 10000, 7 + auxPid2_dFactor = scalar, F32, 2844, "", 1, 0, -10000, 10000, 7 + auxPid2_offset = scalar, S16, 2848, "", 1, 0, 0, 1000, 0 auxPid2_period = scalar, S16, 2850, "ms", 1, 0, 0, 3000, 0 auxPid2_minValue = scalar, S16, 2852, "", 1, 0, 0, 3000.0, 3 auxPid2_maxValue = scalar, S16, 2854, "", 1, 0, 0, 3000.0, 3 - auxPid3_pFactor = scalar, F32, 2856, "value", 1, 0, -10000, 10000, 7 - auxPid3_iFactor = scalar, F32, 2860, "value", 1, 0, -10000, 10000, 7 - auxPid3_dFactor = scalar, F32, 2864, "value", 1, 0, -10000, 10000, 7 - auxPid3_offset = scalar, S16, 2868, "value", 1, 0, 0, 1000, 0 + auxPid3_pFactor = scalar, F32, 2856, "", 1, 0, -10000, 10000, 7 + auxPid3_iFactor = scalar, F32, 2860, "", 1, 0, -10000, 10000, 7 + auxPid3_dFactor = scalar, F32, 2864, "", 1, 0, -10000, 10000, 7 + auxPid3_offset = scalar, S16, 2868, "", 1, 0, 0, 1000, 0 auxPid3_period = scalar, S16, 2870, "ms", 1, 0, 0, 3000, 0 auxPid3_minValue = scalar, S16, 2872, "", 1, 0, 0, 3000.0, 3 auxPid3_maxValue = scalar, S16, 2874, "", 1, 0, 0, 3000.0, 3 - auxPid4_pFactor = scalar, F32, 2876, "value", 1, 0, -10000, 10000, 7 - auxPid4_iFactor = scalar, F32, 2880, "value", 1, 0, -10000, 10000, 7 - auxPid4_dFactor = scalar, F32, 2884, "value", 1, 0, -10000, 10000, 7 - auxPid4_offset = scalar, S16, 2888, "value", 1, 0, 0, 1000, 0 + auxPid4_pFactor = scalar, F32, 2876, "", 1, 0, -10000, 10000, 7 + auxPid4_iFactor = scalar, F32, 2880, "", 1, 0, -10000, 10000, 7 + auxPid4_dFactor = scalar, F32, 2884, "", 1, 0, -10000, 10000, 7 + auxPid4_offset = scalar, S16, 2888, "", 1, 0, 0, 1000, 0 auxPid4_period = scalar, S16, 2890, "ms", 1, 0, 0, 3000, 0 auxPid4_minValue = scalar, S16, 2892, "", 1, 0, 0, 3000.0, 3 auxPid4_maxValue = scalar, S16, 2894, "", 1, 0, 0, 3000.0, 3 @@ -1259,14 +1259,14 @@ fileVersion = { 20171101 } curve = cltIdleRPMCurve, "Idle Target RPM" columnLabel = "Coolant", "RPM" xAxis = -40, 120, 10 - yAxis = 0, 0, 8000 + yAxis = 0, 8000, 10 xBins = cltIdleRpmBins, coolant yBins = cltIdleRpm, RPMValue gauge = CLTGauge curve = idleAdvanceCurve, "Idle Advance Angle" columnLabel = "RPM", "degrees" - xAxis = 0, 8000, 1000 + xAxis = 0, 8000, 10 yAxis = -100, 100, 10 xBins = idleAdvanceBins, RPMValue yBins = idleAdvance @@ -1274,7 +1274,7 @@ fileVersion = { 20171101 } curve = idleVeCurve, "Idle VE" columnLabel = "RPM", "%" - xAxis = 0, 8000, 1000 + xAxis = 0, 8000, 10 yAxis = 0, 250, 10 xBins = idleVeBins, RPMValue yBins = idleVe @@ -1740,7 +1740,6 @@ gaugeCategory = Fuel Data subMenu = tachSettings, "Tachometer output" subMenu = std_separator subMenu = fanSetting, "Fan Settings" - subMenu = idleSettings, "Idle Settings" subMenu = mainRealay, "Main Relay Settings" subMenu = fuelPump, "Fuel Pump Settings" subMenu = malfunction, "MIL Settings" @@ -1763,6 +1762,7 @@ gaugeCategory = Fuel Data subMenu = warmupTargetAfrCurve, "Warmup fuel auto correction AFR target", 0, {useWarmupPidAfr == 1} subMenu = cltIdleCurve, "Warmup Idle multiplier" subMenu = cltTimingCorrCurve, "Warmup timing correction" + subMenu = idleSettings, "Idle Settings" subMenu = cltIdleRPMCurve, "Idle Target RPM", 0, {idleMode == 0} subMenu = std_separator subMenu = fuelTableDialog, "Fuel Table", 0, {fuelAlgorithm != LM_SPEED_DENSITY} @@ -2309,12 +2309,12 @@ cmd_stop_engine = "w\x00\x99\x00\x00" field = "CS #8", max31855_cs8 ; Engine->idle Settings - dialog = idleSolenoid, "solenoid" + dialog = idleSolenoid, "Solenoid" field = "Idle Solenoid Pin Mode", idle_solenoidPinMode, !useStepperIdle field = "Idle Solenoid Pin", idle_solenoidPin, !useStepperIdle field = "Idle Solenoid Frequency", idle_solenoidFrequency, !useStepperIdle - dialog = idleStepper, "stepper" + dialog = idleStepper, "Stepper" field = "Idle Stepper Step", idle_stepperStepPin, useStepperIdle field = "Idle Stepper Dir", idle_stepperDirectionPin, useStepperIdle field = "Idle Stepper Enable", stepperEnablePin, useStepperIdle @@ -2322,34 +2322,37 @@ cmd_stop_engine = "w\x00\x99\x00\x00" field = "Stepper reaction time", idleStepperReactionTime, useStepperIdle field = "Stepper total steps", idleStepperTotalSteps, useStepperIdle - dialog = idleType, "Type idle valve", border + dialog = idleHwType, "Idle Valve Hardware", border + field = "use stepper", useStepperIdle panel = idleSolenoid, West panel = idleStepper, East + dialog = idlePidSettings, "PID control" + field = "P-factor", idleRpmPid_pFactor + field = "I-factor", idleRpmPid_iFactor + field = "D-factor", idleRpmPid_dFactor + field = "Offset", idleRpmPid_offset + field = "Min", idleRpmPid_minValue + field = "Max", idleRpmPid_maxValue + + dialog = idleSettings, "", yAxis - field = "#Automatic Mode is still Alpha Version" - field = "Manual mode", idleMode + field = "!Automatic Mode is now Beta Version" + field = "Idle control mode", idleMode field = "Use separate Advance Table for idle", useSeparateAdvanceForIdle field = "Use separate VE Table for idle", useSeparateVeForIdle field = "Cranking Idle Air", crankingIACposition field = "TPS deactivation threshold", idlePidDeactivationTpsThreshold -; field = "# Warmup Idle multipplier is apploed to target RPM" -; field = "Auto target", targetIdleRpm, { idleMode == 0} - field = "idle P", idleRpmPid_pFactor, { idleMode == 0} - field = "idle I", idleRpmPid_iFactor, { idleMode == 0} - field = "idle D", idleRpmPid_dFactor, { idleMode == 0} - field = "idle offset", idleRpmPid_offset, { idleMode == 0} + field = "#See Idle Target RPM Curve" + panel = idlePidSettings, { idleMode == 0} field = "period", idleRpmPid_period - field = "pid min", idleRpmPid_minValue, { idleMode == 0} - field = "pid max", idleRpmPid_maxValue, { idleMode == 0} field = "RPM dead zone to deactivate IAC pid", idlePidRpmDeadZone, { idleMode == 0} field = "RPM upper limit to deactivate IAC pid",idlePidRpmUpperLimit, { idleMode == 0} field = "iacByTpsTaper", iacByTpsTaper; field = "verbose", isVerboseIAC slider = "Manual Idle Position", manIdlePosition, horizontal field = "" - field = "use stepper", useStepperIdle - panel = idleType + panel = idleHwType ; Engine->Fan Settings dialog = fanSetting, "Fan Settings" diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index fa6febe320..29b9527953 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -445,14 +445,14 @@ fileVersion = { 20171101 } curve = cltIdleRPMCurve, "Idle Target RPM" columnLabel = "Coolant", "RPM" xAxis = -40, 120, 10 - yAxis = 0, 0, 8000 + yAxis = 0, 8000, 10 xBins = cltIdleRpmBins, coolant yBins = cltIdleRpm, RPMValue gauge = CLTGauge curve = idleAdvanceCurve, "Idle Advance Angle" columnLabel = "RPM", "degrees" - xAxis = 0, 8000, 1000 + xAxis = 0, 8000, 10 yAxis = -100, 100, 10 xBins = idleAdvanceBins, RPMValue yBins = idleAdvance @@ -460,7 +460,7 @@ fileVersion = { 20171101 } curve = idleVeCurve, "Idle VE" columnLabel = "RPM", "%" - xAxis = 0, 8000, 1000 + xAxis = 0, 8000, 10 yAxis = 0, 250, 10 xBins = idleVeBins, RPMValue yBins = idleVe @@ -926,7 +926,6 @@ gaugeCategory = Fuel Data subMenu = tachSettings, "Tachometer output" subMenu = std_separator subMenu = fanSetting, "Fan Settings" - subMenu = idleSettings, "Idle Settings" subMenu = mainRealay, "Main Relay Settings" subMenu = fuelPump, "Fuel Pump Settings" subMenu = malfunction, "MIL Settings" @@ -949,6 +948,7 @@ gaugeCategory = Fuel Data subMenu = warmupTargetAfrCurve, "Warmup fuel auto correction AFR target", 0, {useWarmupPidAfr == 1} subMenu = cltIdleCurve, "Warmup Idle multiplier" subMenu = cltTimingCorrCurve, "Warmup timing correction" + subMenu = idleSettings, "Idle Settings" subMenu = cltIdleRPMCurve, "Idle Target RPM", 0, {idleMode == 0} subMenu = std_separator subMenu = fuelTableDialog, "Fuel Table", 0, {fuelAlgorithm != LM_SPEED_DENSITY} @@ -1495,12 +1495,12 @@ cmd_stop_engine = "w\x00\x99\x00\x00" field = "CS #8", max31855_cs8 ; Engine->idle Settings - dialog = idleSolenoid, "solenoid" + dialog = idleSolenoid, "Solenoid" field = "Idle Solenoid Pin Mode", idle_solenoidPinMode, !useStepperIdle field = "Idle Solenoid Pin", idle_solenoidPin, !useStepperIdle field = "Idle Solenoid Frequency", idle_solenoidFrequency, !useStepperIdle - dialog = idleStepper, "stepper" + dialog = idleStepper, "Stepper" field = "Idle Stepper Step", idle_stepperStepPin, useStepperIdle field = "Idle Stepper Dir", idle_stepperDirectionPin, useStepperIdle field = "Idle Stepper Enable", stepperEnablePin, useStepperIdle @@ -1508,34 +1508,37 @@ cmd_stop_engine = "w\x00\x99\x00\x00" field = "Stepper reaction time", idleStepperReactionTime, useStepperIdle field = "Stepper total steps", idleStepperTotalSteps, useStepperIdle - dialog = idleType, "Type idle valve", border + dialog = idleHwType, "Idle Valve Hardware", border + field = "use stepper", useStepperIdle panel = idleSolenoid, West panel = idleStepper, East + dialog = idlePidSettings, "PID control" + field = "P-factor", idleRpmPid_pFactor + field = "I-factor", idleRpmPid_iFactor + field = "D-factor", idleRpmPid_dFactor + field = "Offset", idleRpmPid_offset + field = "Min", idleRpmPid_minValue + field = "Max", idleRpmPid_maxValue + + dialog = idleSettings, "", yAxis - field = "#Automatic Mode is still Alpha Version" - field = "Manual mode", idleMode + field = "!Automatic Mode is now Beta Version" + field = "Idle control mode", idleMode field = "Use separate Advance Table for idle", useSeparateAdvanceForIdle field = "Use separate VE Table for idle", useSeparateVeForIdle field = "Cranking Idle Air", crankingIACposition field = "TPS deactivation threshold", idlePidDeactivationTpsThreshold -; field = "# Warmup Idle multipplier is apploed to target RPM" -; field = "Auto target", targetIdleRpm, { idleMode == 0} - field = "idle P", idleRpmPid_pFactor, { idleMode == 0} - field = "idle I", idleRpmPid_iFactor, { idleMode == 0} - field = "idle D", idleRpmPid_dFactor, { idleMode == 0} - field = "idle offset", idleRpmPid_offset, { idleMode == 0} + field = "#See Idle Target RPM Curve" + panel = idlePidSettings, { idleMode == 0} field = "period", idleRpmPid_period - field = "pid min", idleRpmPid_minValue, { idleMode == 0} - field = "pid max", idleRpmPid_maxValue, { idleMode == 0} field = "RPM dead zone to deactivate IAC pid", idlePidRpmDeadZone, { idleMode == 0} field = "RPM upper limit to deactivate IAC pid",idlePidRpmUpperLimit, { idleMode == 0} field = "iacByTpsTaper", iacByTpsTaper; field = "verbose", isVerboseIAC slider = "Manual Idle Position", manIdlePosition, horizontal field = "" - field = "use stepper", useStepperIdle - panel = idleType + panel = idleHwType ; Engine->Fan Settings dialog = fanSetting, "Fan Settings" diff --git a/firmware/util/efilib.cpp b/firmware/util/efilib.cpp index 5b514f3591..67b8340134 100644 --- a/firmware/util/efilib.cpp +++ b/firmware/util/efilib.cpp @@ -12,6 +12,7 @@ #include "efilib.h" #include "datalogging.h" #include "histogram.h" +#include "error_handling.h" const char * boolToString(bool value) { return value ? "Yes" : "No"; @@ -28,7 +29,12 @@ float efiFloor(float value, float precision) { } */ +/** + * + * @param precision for example '0.1' for one digit fractional part + */ float efiRound(float value, float precision) { + efiAssert(precision != 0, "zero precision", NAN); float a = rintf (value / precision); return a * precision; }