diff --git a/firmware/config/boards/kinetis/config/controllers/algo/engine_configuration_generated_structures.h b/firmware/config/boards/kinetis/config/controllers/algo/engine_configuration_generated_structures.h index 6d0a1b240f..54e6fd9df3 100644 --- a/firmware/config/boards/kinetis/config/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/config/boards/kinetis/config/controllers/algo/engine_configuration_generated_structures.h @@ -1,4 +1,4 @@ -// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Mon Apr 27 16:07:09 EDT 2020 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Tue Apr 28 20:11:11 EDT 2020 // by class com.rusefi.output.CHeaderConsumer // begin #ifndef CONFIG_BOARDS_KINETIS_CONFIG_CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H @@ -1449,6 +1449,8 @@ struct engine_configuration_s { offset 744 bit 26 */ bool is_enabled_spi_4 : 1; /** + * Disable the electronic throttle motor for testing. + * This mode is for testing ETB position sensors, etc without actually driving the throttle. offset 744 bit 27 */ bool pauseEtbControl : 1; /** @@ -2101,7 +2103,7 @@ struct engine_configuration_s { bool useTPSAdvanceTable : 1; /** offset 1476 bit 20 */ - bool etbCalibrationOnStart : 1; + bool unused1476b20 : 1; /** * This flag allows to use a special 'PID Multiplier' table (0.0-1.0) to compensate for nonlinear nature of IAC-RPM controller offset 1476 bit 21 */ @@ -3413,4 +3415,4 @@ typedef struct persistent_config_s persistent_config_s; #endif // end -// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Mon Apr 27 16:07:09 EDT 2020 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Tue Apr 28 20:11:11 EDT 2020 diff --git a/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h b/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h index e9d460da5a..79d09fd05c 100644 --- a/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h +++ b/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h @@ -603,8 +603,6 @@ #define etbBiasBins_offset_hex f30 #define etbBiasValues_offset 3920 #define etbBiasValues_offset_hex f50 -#define etbCalibrationOnStart_offset 1476 -#define etbCalibrationOnStart_offset_hex 5c4 #define etbDeadband_offset 3960 #define etbDeadband_offset_hex f78 #define etbFreq_offset 2514 @@ -2254,6 +2252,8 @@ #define uartConsoleSerialSpeed_offset_hex 81c #define unused1059_offset 3964 #define unused1059_offset_hex f7c +#define unused1476b20_offset 1476 +#define unused1476b20_offset_hex 5c4 #define unused2432_offset 2432 #define unused2432_offset_hex 980 #define unused711_offset 711 diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 059d04cee5..adb73fc22e 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -124,7 +124,7 @@ void EtbController::reset() { } void EtbController::onConfigurationChange(pid_s* previousConfiguration) { - if (m_motor && m_pid.isSame(previousConfiguration)) { + if (m_motor && !m_pid.isSame(previousConfiguration)) { m_shouldResetPid = true; } } @@ -147,21 +147,17 @@ expected EtbController::getSetpoint() const { return unexpected; } - if (engineConfiguration->pauseEtbControl) { - return unexpected; - } - // If the pedal map hasn't been set, we can't provide a setpoint. if (!m_pedalMap) { return unexpected; } auto pedalPosition = Sensor::get(SensorType::AcceleratorPedal); - if (!pedalPosition.Valid) { - return unexpected; - } - float sanitizedPedal = clampF(0, pedalPosition.Value, 100); + // If the pedal has failed, just use 0 position. + // This is safer than disabling throttle control - we can at least push the throttle closed + // and let the engine idle. + float sanitizedPedal = clampF(0, pedalPosition.value_or(0), 100); float rpm = GET_RPM(); float targetFromTable = m_pedalMap->getValue(rpm / RPM_1_BYTE_PACKING_MULT, sanitizedPedal); @@ -301,7 +297,8 @@ void EtbController::setOutput(expected outputValue) { if (!m_motor) return; - if (outputValue) { + // If output is valid and we aren't paused, output to motor. + if (outputValue && !engineConfiguration->pauseEtbControl) { m_motor->enable(); m_motor->set(ETB_PERCENT_TO_DUTY(outputValue.Value)); } else { @@ -329,12 +326,12 @@ void EtbController::update(efitick_t nowNt) { return; } - if (engineConfiguration->debugMode == DBG_ETB_LOGIC) { #if EFI_TUNER_STUDIO + if (engineConfiguration->debugMode == DBG_ETB_LOGIC) { tsOutputChannels.debugFloatField1 = engine->engineState.targetFromTable; tsOutputChannels.debugFloatField2 = engine->engineState.idle.etbIdleAddition; -#endif /* EFI_TUNER_STUDIO */ } +#endif m_pid.iTermMin = engineConfiguration->etb_iTermMin; m_pid.iTermMax = engineConfiguration->etb_iTermMax; @@ -386,6 +383,10 @@ void EtbController::update(efitick_t nowNt) { /* DISPLAY_ENDIF */ } +void EtbController::autoCalibrateTps() { + m_isAutocal = true; +} + #if !EFI_UNIT_TEST /** * Things running on a timer (instead of a thread) don't participate it the RTOS's thread priority system, @@ -397,6 +398,52 @@ struct EtbImpl final : public EtbController, public PeriodicController<512> { EtbImpl() : PeriodicController("ETB", NORMALPRIO + 3, ETB_LOOP_FREQUENCY) {} void PeriodicTask(efitick_t nowNt) override { + +#if EFI_TUNER_STUDIO + if (m_isAutocal) { + // Don't allow if engine is running! + if (GET_RPM() > 0) { + m_isAutocal = false; + return; + } + + auto motor = getMotor(); + if (!motor) { + m_isAutocal = false; + return; + } + + size_t myIndex = getMyIndex(); + + // First grab open + motor->set(0.5f); + motor->enable(); + chThdSleepMilliseconds(1000); + tsOutputChannels.calibrationMode = TsCalMode::Tps1Max; + tsOutputChannels.calibrationValue = Sensor::getRaw(indexToTpsSensor(myIndex)) * TPS_TS_CONVERSION; + + // Let it return + motor->set(0); + chThdSleepMilliseconds(200); + + // Now grab closed + motor->set(-0.5f); + chThdSleepMilliseconds(1000); + tsOutputChannels.calibrationMode = TsCalMode::Tps1Min; + tsOutputChannels.calibrationValue = Sensor::getRaw(indexToTpsSensor(myIndex)) * TPS_TS_CONVERSION; + + // Finally disable and reset state + motor->disable(); + + // Wait to let TS grab the state before we leave cal mode + chThdSleepMilliseconds(500); + tsOutputChannels.calibrationMode = TsCalMode::None; + + m_isAutocal = false; + return; + } +#endif /* EFI_TUNER_STUDIO */ + EtbController::update(nowNt); } @@ -518,7 +565,19 @@ void setEtbOffset(int value) { showEthInfo(); } -#endif /* EFI_UNIT_TEST */ +void etbAutocal(size_t throttleIndex) { + if (throttleIndex >= ETB_COUNT) { + return; + } + + auto etb = engine->etbControllers[throttleIndex]; + + if (etb) { + etb->autoCalibrateTps(); + } +} + +#endif /* !EFI_UNIT_TEST */ /** * This specific throttle has default position of about 7% open @@ -646,25 +705,6 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } #endif /* EFI_UNIT_TEST */ -#if EFI_PROD_CODE - if (engineConfiguration->etbCalibrationOnStart) { - - for (int i = 0 ; i < engine->etbActualCount; i++) { - setDcMotorDuty(i, 70); - chThdSleep(600); - // todo: grab with proper index - grabTPSIsWideOpen(); - setDcMotorDuty(i, -70); - chThdSleep(600); - // todo: grab with proper index - grabTPSIsClosed(); - } - } - - // manual duty cycle control without PID. Percent value from 0 to 100 - addConsoleActionNANF(CMD_ETB_DUTY, setThrottleDutyCycle); -#endif /* EFI_PROD_CODE */ - etbPidReset(PASS_ENGINE_PARAMETER_SIGNATURE); for (int i = 0 ; i < engine->etbActualCount; i++) { diff --git a/firmware/controllers/actuators/electronic_throttle.h b/firmware/controllers/actuators/electronic_throttle.h index 375b3f2eed..075cc5e40b 100644 --- a/firmware/controllers/actuators/electronic_throttle.h +++ b/firmware/controllers/actuators/electronic_throttle.h @@ -30,6 +30,7 @@ public: virtual void reset() = 0; virtual void setIdlePosition(percent_t pos) = 0; virtual void start() = 0; + virtual void autoCalibrateTps() = 0; }; class EtbController : public IEtbController { @@ -61,6 +62,16 @@ public: // Used to inspect the internal PID controller's state const pid_state_s* getPidState() const { return &m_pid; }; + // Use the throttle to automatically calibrate the relevant throttle position sensor(s). + void autoCalibrateTps() override; + +protected: + // This is set if an automatic TPS calibration should be run + bool m_isAutocal = false; + + int getMyIndex() const { return m_myIndex; } + DcMotor* getMotor() { return m_motor; } + private: int m_myIndex = 0; DcMotor *m_motor = nullptr; @@ -95,3 +106,5 @@ void setEtbOffset(int value); void setThrottleDutyCycle(percent_t level); void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration); void unregisterEtbPins(); + +void etbAutocal(size_t throttleIndex); diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index a15b460fcc..03910ed355 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -37,6 +37,7 @@ #include "idle_thread.h" #include "periodic_thread_controller.h" #include "tps.h" +#include "electronic_throttle.h" #include "cj125.h" #include "malfunction_central.h" @@ -264,6 +265,11 @@ static void handleCommandX14(uint16_t index) { case 0xD: engine->directSelfStimulation = true; return; +#if EFI_ELECTRONIC_THROTTLE_BODY + case 0xE: + etbAutocal(0); + return; +#endif } } diff --git a/firmware/controllers/generated/engine_configuration_generated_structures.h b/firmware/controllers/generated/engine_configuration_generated_structures.h index df2b89daab..9ba255f215 100644 --- a/firmware/controllers/generated/engine_configuration_generated_structures.h +++ b/firmware/controllers/generated/engine_configuration_generated_structures.h @@ -1,4 +1,4 @@ -// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Mon Apr 27 16:06:39 EDT 2020 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 20:10:00 EDT 2020 // by class com.rusefi.output.CHeaderConsumer // begin #ifndef CONTROLLERS_GENERATED_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H @@ -1449,6 +1449,8 @@ struct engine_configuration_s { offset 744 bit 26 */ bool is_enabled_spi_4 : 1; /** + * Disable the electronic throttle motor for testing. + * This mode is for testing ETB position sensors, etc without actually driving the throttle. offset 744 bit 27 */ bool pauseEtbControl : 1; /** @@ -2101,7 +2103,7 @@ struct engine_configuration_s { bool useTPSAdvanceTable : 1; /** offset 1476 bit 20 */ - bool etbCalibrationOnStart : 1; + bool unused1476b20 : 1; /** * This flag allows to use a special 'PID Multiplier' table (0.0-1.0) to compensate for nonlinear nature of IAC-RPM controller offset 1476 bit 21 */ @@ -3413,4 +3415,4 @@ typedef struct persistent_config_s persistent_config_s; #endif // end -// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Mon Apr 27 16:06:39 EDT 2020 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 20:10:00 EDT 2020 diff --git a/firmware/controllers/generated/rusefi_generated.h b/firmware/controllers/generated/rusefi_generated.h index a126f01fe7..4567df124a 100644 --- a/firmware/controllers/generated/rusefi_generated.h +++ b/firmware/controllers/generated/rusefi_generated.h @@ -603,8 +603,6 @@ #define etbBiasBins_offset_hex f30 #define etbBiasValues_offset 3920 #define etbBiasValues_offset_hex f50 -#define etbCalibrationOnStart_offset 1476 -#define etbCalibrationOnStart_offset_hex 5c4 #define etbDeadband_offset 3960 #define etbDeadband_offset_hex f78 #define etbFreq_offset 2514 @@ -2254,6 +2252,8 @@ #define uartConsoleSerialSpeed_offset_hex 81c #define unused1059_offset 3964 #define unused1059_offset_hex f7c +#define unused1476b20_offset 1476 +#define unused1476b20_offset_hex 5c4 #define unused2432_offset 2432 #define unused2432_offset_hex 980 #define unused711_offset 711 diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index ce68940b80..bcd0f2fa17 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -713,7 +713,7 @@ bit is_enabled_spi_2 bit useIdleTimingPidControl bit useTPSBasedVeTable bit is_enabled_spi_4 - bit pauseEtbControl + bit pauseEtbControl;+Disable the electronic throttle motor for testing.\nThis mode is for testing ETB position sensors, etc without actually driving the throttle. bit alignEngineSnifferAtTDC bit useETBforIdleControl;+This setting allows the ETB to act as the idle air control valve and move to regulate the airflow at idle. bit idleIncrementalPidCic @@ -944,7 +944,7 @@ bit useFixedBaroCorrFromMap bit useSeparateAdvanceForCranking;+This activates a separate advance table for cranking conditions, this allows cranking advance to be RPM dependant. bit useAdvanceCorrectionsForCranking;+This enables the various ignition corrections during cranking (IAT, CLT, FSIO and PID idle). bit useTPSAdvanceTable;+This flag allows to use TPS for ignition lookup while in Speed Density Fuel Mode -bit etbCalibrationOnStart +bit unused1476b20; bit useIacPidMultTable;+This flag allows to use a special 'PID Multiplier' table (0.0-1.0) to compensate for nonlinear nature of IAC-RPM controller bit isBoostControlEnabled; bit launchSmoothRetard;+Interpolates the Ignition Retard from 0 to 100% within the RPM Range diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 799bf09dd8..825bc57835 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -89,7 +89,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 07:35:40 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 20:10:00 EDT 2020 pageSize = 20000 page = 1 @@ -683,7 +683,7 @@ page = 1 useSeparateAdvanceForCranking= bits, U32, 1476, [17:17], "false", "true" useAdvanceCorrectionsForCranking= bits, U32, 1476, [18:18], "false", "true" useTPSAdvanceTable = bits, U32, 1476, [19:19], "false", "true" - etbCalibrationOnStart = bits, U32, 1476, [20:20], "false", "true" + unused1476b20 = bits, U32, 1476, [20:20], "false", "true" useIacPidMultTable = bits, U32, 1476, [21:21], "false", "true" isBoostControlEnabled = bits, U32, 1476, [22:22], "false", "true" launchSmoothRetard = bits, U32, 1476, [23:23], "false", "true" @@ -1212,6 +1212,7 @@ page = 1 isFasterEngineSpinUpEnabled = "Smarter cranking logic.\nSee also startOfCrankingPrimingPulse" coastingFuelCutEnabled = "This setting disables fuel injection while the engine is in overrun, this is useful as a fuel saving measure and to prevent back firing." useIacTableForCoasting = "This setting allows the ECU to open the IAC during overrun conditions to help reduce engine breaking, this can be helpful for large engines in light weight cars." + pauseEtbControl = "Disable the electronic throttle motor for testing.\nThis mode is for testing ETB position sensors, etc without actually driving the throttle." useETBforIdleControl = "This setting allows the ETB to act as the idle air control valve and move to regulate the airflow at idle." sdCardPeriodMs = "SD card logging period, in milliseconds" triggerErrorPin = "This pin is used for debugging - snap a logic analyzer on it and see if it's ever high" @@ -1645,6 +1646,8 @@ fileVersion = { 20200310 } ; defaultValue = constantName, value; defaultValue = wueAfrTargetOffset, -1.5 -1.4 -1.15 -0.95 -0.775 -0.65 -0.5625 -0.5 -0.4375 -0.375 -0.3125 -0.25 -0.1875 -0.125 -0.0625 0 + maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax } + maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin } requiresPowerCycle = warningLedPin requiresPowerCycle = runningLedPin @@ -2733,6 +2736,7 @@ cmd_write_config = "w\x00\x14\x00\x0A" cmd_test_starter_relay = "w\x00\x14\x00\x0B" cmd_etb_autotune = "w\x00\x14\x00\x0C" cmd_enable_self_stim = "w\x00\x14\x00\x0D" +cmb_etb_auto_calibrate = "w\x00\x14\x00\x0E" cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -4025,8 +4029,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" dialog = etbDialogLeft field = "https://rusefi.com/s/etb" field = "Detailed status in console", isVerboseETB - field = "Pause ETB control", pauseEtbControl - field = etbCalibrationOnStart, etbCalibrationOnStart + field = "Disable ETB Motor", pauseEtbControl ; we need the term about stepper idle in here, because there's a bug in TS that you can't have different visibility ; criteria for the same panel when used in multiple places panel = hbridgeHardware, { throttlePedalPositionAdcChannel != 16 || useStepperIdle && useHbridges } @@ -4035,6 +4038,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Set debug mode below to 'ETB Autotune' to show results" field = "Debug mode", debugMode commandButton = "ETB PID Autotune", cmd_etb_autotune + commandButton = "Auto Calibrate TPS", cmb_etb_auto_calibrate dialog = etbDialogRight panel = etbIdleDialog diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index c98a9a93cf..040960699d 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -412,6 +412,8 @@ fileVersion = { @@TS_FILE_VERSION@@ } ; defaultValue = constantName, value; defaultValue = wueAfrTargetOffset, -1.5 -1.4 -1.15 -0.95 -0.775 -0.65 -0.5625 -0.5 -0.4375 -0.375 -0.3125 -0.25 -0.1875 -0.125 -0.0625 0 + maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax } + maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin } requiresPowerCycle = warningLedPin requiresPowerCycle = runningLedPin @@ -1500,6 +1502,7 @@ cmd_write_config = "w\x00\x14\x00\x0A" cmd_test_starter_relay = "w\x00\x14\x00\x0B" cmd_etb_autotune = "w\x00\x14\x00\x0C" cmd_enable_self_stim = "w\x00\x14\x00\x0D" +cmb_etb_auto_calibrate = "w\x00\x14\x00\x0E" cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -2793,8 +2796,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" dialog = etbDialogLeft field = "https://rusefi.com/s/etb" field = "Detailed status in console", isVerboseETB - field = "Pause ETB control", pauseEtbControl - field = etbCalibrationOnStart, etbCalibrationOnStart + field = "Disable ETB Motor", pauseEtbControl ; we need the term about stepper idle in here, because there's a bug in TS that you can't have different visibility ; criteria for the same panel when used in multiple places panel = hbridgeHardware, { throttlePedalPositionAdcChannel != 16 || useStepperIdle && useHbridges } @@ -2803,6 +2805,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Set debug mode below to 'ETB Autotune' to show results" field = "Debug mode", debugMode commandButton = "ETB PID Autotune", cmd_etb_autotune + commandButton = "Auto Calibrate TPS", cmb_etb_auto_calibrate dialog = etbDialogRight panel = etbIdleDialog diff --git a/firmware/tunerstudio/rusefi_frankenso.ini b/firmware/tunerstudio/rusefi_frankenso.ini index 9b43805969..3194a9297a 100644 --- a/firmware/tunerstudio/rusefi_frankenso.ini +++ b/firmware/tunerstudio/rusefi_frankenso.ini @@ -89,7 +89,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 07:35:48 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 20:10:05 EDT 2020 pageSize = 20000 page = 1 @@ -683,7 +683,7 @@ page = 1 useSeparateAdvanceForCranking= bits, U32, 1476, [17:17], "false", "true" useAdvanceCorrectionsForCranking= bits, U32, 1476, [18:18], "false", "true" useTPSAdvanceTable = bits, U32, 1476, [19:19], "false", "true" - etbCalibrationOnStart = bits, U32, 1476, [20:20], "false", "true" + unused1476b20 = bits, U32, 1476, [20:20], "false", "true" useIacPidMultTable = bits, U32, 1476, [21:21], "false", "true" isBoostControlEnabled = bits, U32, 1476, [22:22], "false", "true" launchSmoothRetard = bits, U32, 1476, [23:23], "false", "true" @@ -1212,6 +1212,7 @@ page = 1 isFasterEngineSpinUpEnabled = "Smarter cranking logic.\nSee also startOfCrankingPrimingPulse" coastingFuelCutEnabled = "This setting disables fuel injection while the engine is in overrun, this is useful as a fuel saving measure and to prevent back firing." useIacTableForCoasting = "This setting allows the ECU to open the IAC during overrun conditions to help reduce engine breaking, this can be helpful for large engines in light weight cars." + pauseEtbControl = "Disable the electronic throttle motor for testing.\nThis mode is for testing ETB position sensors, etc without actually driving the throttle." useETBforIdleControl = "This setting allows the ETB to act as the idle air control valve and move to regulate the airflow at idle." sdCardPeriodMs = "SD card logging period, in milliseconds" triggerErrorPin = "This pin is used for debugging - snap a logic analyzer on it and see if it's ever high" @@ -1645,6 +1646,8 @@ fileVersion = { 20200310 } ; defaultValue = constantName, value; defaultValue = wueAfrTargetOffset, -1.5 -1.4 -1.15 -0.95 -0.775 -0.65 -0.5625 -0.5 -0.4375 -0.375 -0.3125 -0.25 -0.1875 -0.125 -0.0625 0 + maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax } + maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin } requiresPowerCycle = warningLedPin requiresPowerCycle = runningLedPin @@ -2733,6 +2736,7 @@ cmd_write_config = "w\x00\x14\x00\x0A" cmd_test_starter_relay = "w\x00\x14\x00\x0B" cmd_etb_autotune = "w\x00\x14\x00\x0C" cmd_enable_self_stim = "w\x00\x14\x00\x0D" +cmb_etb_auto_calibrate = "w\x00\x14\x00\x0E" cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -4025,8 +4029,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" dialog = etbDialogLeft field = "https://rusefi.com/s/etb" field = "Detailed status in console", isVerboseETB - field = "Pause ETB control", pauseEtbControl - field = etbCalibrationOnStart, etbCalibrationOnStart + field = "Disable ETB Motor", pauseEtbControl ; we need the term about stepper idle in here, because there's a bug in TS that you can't have different visibility ; criteria for the same panel when used in multiple places panel = hbridgeHardware, { throttlePedalPositionAdcChannel != 16 || useStepperIdle && useHbridges } @@ -4035,6 +4038,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Set debug mode below to 'ETB Autotune' to show results" field = "Debug mode", debugMode commandButton = "ETB PID Autotune", cmd_etb_autotune + commandButton = "Auto Calibrate TPS", cmb_etb_auto_calibrate dialog = etbDialogRight panel = etbIdleDialog diff --git a/firmware/tunerstudio/rusefi_kinetis.ini b/firmware/tunerstudio/rusefi_kinetis.ini index 62af2e7f61..3068f7b140 100644 --- a/firmware/tunerstudio/rusefi_kinetis.ini +++ b/firmware/tunerstudio/rusefi_kinetis.ini @@ -89,7 +89,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Sun Apr 26 14:18:05 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Tue Apr 28 20:11:11 EDT 2020 pageSize = 20000 page = 1 @@ -683,7 +683,7 @@ page = 1 useSeparateAdvanceForCranking= bits, U32, 1476, [17:17], "false", "true" useAdvanceCorrectionsForCranking= bits, U32, 1476, [18:18], "false", "true" useTPSAdvanceTable = bits, U32, 1476, [19:19], "false", "true" - etbCalibrationOnStart = bits, U32, 1476, [20:20], "false", "true" + unused1476b20 = bits, U32, 1476, [20:20], "false", "true" useIacPidMultTable = bits, U32, 1476, [21:21], "false", "true" isBoostControlEnabled = bits, U32, 1476, [22:22], "false", "true" launchSmoothRetard = bits, U32, 1476, [23:23], "false", "true" @@ -1212,6 +1212,7 @@ page = 1 isFasterEngineSpinUpEnabled = "Smarter cranking logic.\nSee also startOfCrankingPrimingPulse" coastingFuelCutEnabled = "This setting disables fuel injection while the engine is in overrun, this is useful as a fuel saving measure and to prevent back firing." useIacTableForCoasting = "This setting allows the ECU to open the IAC during overrun conditions to help reduce engine breaking, this can be helpful for large engines in light weight cars." + pauseEtbControl = "Disable the electronic throttle motor for testing.\nThis mode is for testing ETB position sensors, etc without actually driving the throttle." useETBforIdleControl = "This setting allows the ETB to act as the idle air control valve and move to regulate the airflow at idle." sdCardPeriodMs = "SD card logging period, in milliseconds" triggerErrorPin = "This pin is used for debugging - snap a logic analyzer on it and see if it's ever high" @@ -1645,6 +1646,8 @@ fileVersion = { 20200310 } ; defaultValue = constantName, value; defaultValue = wueAfrTargetOffset, -1.5 -1.4 -1.15 -0.95 -0.775 -0.65 -0.5625 -0.5 -0.4375 -0.375 -0.3125 -0.25 -0.1875 -0.125 -0.0625 0 + maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax } + maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin } requiresPowerCycle = warningLedPin requiresPowerCycle = runningLedPin @@ -2733,6 +2736,7 @@ cmd_write_config = "w\x00\x14\x00\x0A" cmd_test_starter_relay = "w\x00\x14\x00\x0B" cmd_etb_autotune = "w\x00\x14\x00\x0C" cmd_enable_self_stim = "w\x00\x14\x00\x0D" +cmb_etb_auto_calibrate = "w\x00\x14\x00\x0E" cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -4014,7 +4018,6 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "pFactor", etb_pFactor, {throttlePedalPositionAdcChannel != 16} field = "iFactor", etb_iFactor, {throttlePedalPositionAdcChannel != 16} field = "dFactor", etb_dFactor, {throttlePedalPositionAdcChannel != 16} - field = "control period", etb_periodMs, {throttlePedalPositionAdcChannel != 16} field = "pid min", etb_minValue, {throttlePedalPositionAdcChannel != 16} field = "pid max", etb_maxValue, {throttlePedalPositionAdcChannel != 16} field = "iTermMin", etb_iTermMin, {throttlePedalPositionAdcChannel != 16} @@ -4027,8 +4030,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" dialog = etbDialogLeft field = "https://rusefi.com/s/etb" field = "Detailed status in console", isVerboseETB - field = "Pause ETB control", pauseEtbControl - field = etbCalibrationOnStart, etbCalibrationOnStart + field = "Disable ETB Motor", pauseEtbControl ; we need the term about stepper idle in here, because there's a bug in TS that you can't have different visibility ; criteria for the same panel when used in multiple places panel = hbridgeHardware, { throttlePedalPositionAdcChannel != 16 || useStepperIdle && useHbridges } @@ -4037,6 +4039,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Set debug mode below to 'ETB Autotune' to show results" field = "Debug mode", debugMode commandButton = "ETB PID Autotune", cmd_etb_autotune + commandButton = "Auto Calibrate TPS", cmb_etb_auto_calibrate dialog = etbDialogRight panel = etbIdleDialog diff --git a/firmware/tunerstudio/rusefi_microrusefi.ini b/firmware/tunerstudio/rusefi_microrusefi.ini index 58592a984c..f8fe7627c8 100644 --- a/firmware/tunerstudio/rusefi_microrusefi.ini +++ b/firmware/tunerstudio/rusefi_microrusefi.ini @@ -89,7 +89,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 07:35:46 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 20:10:03 EDT 2020 pageSize = 20000 page = 1 @@ -683,7 +683,7 @@ page = 1 useSeparateAdvanceForCranking= bits, U32, 1476, [17:17], "false", "true" useAdvanceCorrectionsForCranking= bits, U32, 1476, [18:18], "false", "true" useTPSAdvanceTable = bits, U32, 1476, [19:19], "false", "true" - etbCalibrationOnStart = bits, U32, 1476, [20:20], "false", "true" + unused1476b20 = bits, U32, 1476, [20:20], "false", "true" useIacPidMultTable = bits, U32, 1476, [21:21], "false", "true" isBoostControlEnabled = bits, U32, 1476, [22:22], "false", "true" launchSmoothRetard = bits, U32, 1476, [23:23], "false", "true" @@ -1212,6 +1212,7 @@ page = 1 isFasterEngineSpinUpEnabled = "Smarter cranking logic.\nSee also startOfCrankingPrimingPulse" coastingFuelCutEnabled = "This setting disables fuel injection while the engine is in overrun, this is useful as a fuel saving measure and to prevent back firing." useIacTableForCoasting = "This setting allows the ECU to open the IAC during overrun conditions to help reduce engine breaking, this can be helpful for large engines in light weight cars." + pauseEtbControl = "Disable the electronic throttle motor for testing.\nThis mode is for testing ETB position sensors, etc without actually driving the throttle." useETBforIdleControl = "This setting allows the ETB to act as the idle air control valve and move to regulate the airflow at idle." sdCardPeriodMs = "SD card logging period, in milliseconds" triggerErrorPin = "This pin is used for debugging - snap a logic analyzer on it and see if it's ever high" @@ -1645,6 +1646,8 @@ fileVersion = { 20200310 } ; defaultValue = constantName, value; defaultValue = wueAfrTargetOffset, -1.5 -1.4 -1.15 -0.95 -0.775 -0.65 -0.5625 -0.5 -0.4375 -0.375 -0.3125 -0.25 -0.1875 -0.125 -0.0625 0 + maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax } + maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin } requiresPowerCycle = warningLedPin requiresPowerCycle = runningLedPin @@ -2725,6 +2728,7 @@ cmd_write_config = "w\x00\x14\x00\x0A" cmd_test_starter_relay = "w\x00\x14\x00\x0B" cmd_etb_autotune = "w\x00\x14\x00\x0C" cmd_enable_self_stim = "w\x00\x14\x00\x0D" +cmb_etb_auto_calibrate = "w\x00\x14\x00\x0E" cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -3985,8 +3989,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" dialog = etbDialogLeft field = "https://rusefi.com/s/etb" field = "Detailed status in console", isVerboseETB - field = "Pause ETB control", pauseEtbControl - field = etbCalibrationOnStart, etbCalibrationOnStart + field = "Disable ETB Motor", pauseEtbControl ; we need the term about stepper idle in here, because there's a bug in TS that you can't have different visibility ; criteria for the same panel when used in multiple places panel = hbridgeHardware, { throttlePedalPositionAdcChannel != 16 || useStepperIdle && useHbridges } @@ -3995,6 +3998,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Set debug mode below to 'ETB Autotune' to show results" field = "Debug mode", debugMode commandButton = "ETB PID Autotune", cmd_etb_autotune + commandButton = "Auto Calibrate TPS", cmb_etb_auto_calibrate dialog = etbDialogRight panel = etbIdleDialog diff --git a/firmware/tunerstudio/rusefi_prometheus.ini b/firmware/tunerstudio/rusefi_prometheus.ini index 8bd547314b..b866aeb760 100644 --- a/firmware/tunerstudio/rusefi_prometheus.ini +++ b/firmware/tunerstudio/rusefi_prometheus.ini @@ -89,7 +89,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 07:35:51 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 20:10:29 EDT 2020 pageSize = 20000 page = 1 @@ -683,7 +683,7 @@ page = 1 useSeparateAdvanceForCranking= bits, U32, 1476, [17:17], "false", "true" useAdvanceCorrectionsForCranking= bits, U32, 1476, [18:18], "false", "true" useTPSAdvanceTable = bits, U32, 1476, [19:19], "false", "true" - etbCalibrationOnStart = bits, U32, 1476, [20:20], "false", "true" + unused1476b20 = bits, U32, 1476, [20:20], "false", "true" useIacPidMultTable = bits, U32, 1476, [21:21], "false", "true" isBoostControlEnabled = bits, U32, 1476, [22:22], "false", "true" launchSmoothRetard = bits, U32, 1476, [23:23], "false", "true" @@ -1212,6 +1212,7 @@ page = 1 isFasterEngineSpinUpEnabled = "Smarter cranking logic.\nSee also startOfCrankingPrimingPulse" coastingFuelCutEnabled = "This setting disables fuel injection while the engine is in overrun, this is useful as a fuel saving measure and to prevent back firing." useIacTableForCoasting = "This setting allows the ECU to open the IAC during overrun conditions to help reduce engine breaking, this can be helpful for large engines in light weight cars." + pauseEtbControl = "Disable the electronic throttle motor for testing.\nThis mode is for testing ETB position sensors, etc without actually driving the throttle." useETBforIdleControl = "This setting allows the ETB to act as the idle air control valve and move to regulate the airflow at idle." sdCardPeriodMs = "SD card logging period, in milliseconds" triggerErrorPin = "This pin is used for debugging - snap a logic analyzer on it and see if it's ever high" @@ -1645,6 +1646,8 @@ fileVersion = { 20200310 } ; defaultValue = constantName, value; defaultValue = wueAfrTargetOffset, -1.5 -1.4 -1.15 -0.95 -0.775 -0.65 -0.5625 -0.5 -0.4375 -0.375 -0.3125 -0.25 -0.1875 -0.125 -0.0625 0 + maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax } + maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin } requiresPowerCycle = warningLedPin requiresPowerCycle = runningLedPin @@ -2729,6 +2732,7 @@ cmd_write_config = "w\x00\x14\x00\x0A" cmd_test_starter_relay = "w\x00\x14\x00\x0B" cmd_etb_autotune = "w\x00\x14\x00\x0C" cmd_enable_self_stim = "w\x00\x14\x00\x0D" +cmb_etb_auto_calibrate = "w\x00\x14\x00\x0E" cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -4021,8 +4025,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" dialog = etbDialogLeft field = "https://rusefi.com/s/etb" field = "Detailed status in console", isVerboseETB - field = "Pause ETB control", pauseEtbControl - field = etbCalibrationOnStart, etbCalibrationOnStart + field = "Disable ETB Motor", pauseEtbControl ; we need the term about stepper idle in here, because there's a bug in TS that you can't have different visibility ; criteria for the same panel when used in multiple places panel = hbridgeHardware, { throttlePedalPositionAdcChannel != 16 || useStepperIdle && useHbridges } @@ -4031,6 +4034,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Set debug mode below to 'ETB Autotune' to show results" field = "Debug mode", debugMode commandButton = "ETB PID Autotune", cmd_etb_autotune + commandButton = "Auto Calibrate TPS", cmb_etb_auto_calibrate dialog = etbDialogRight panel = etbIdleDialog diff --git a/firmware/tunerstudio/rusefi_proteus.ini b/firmware/tunerstudio/rusefi_proteus.ini index 6b3e231e8c..ea0e0a1690 100644 --- a/firmware/tunerstudio/rusefi_proteus.ini +++ b/firmware/tunerstudio/rusefi_proteus.ini @@ -89,7 +89,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 07:35:52 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 20:10:49 EDT 2020 pageSize = 20000 page = 1 @@ -683,7 +683,7 @@ page = 1 useSeparateAdvanceForCranking= bits, U32, 1476, [17:17], "false", "true" useAdvanceCorrectionsForCranking= bits, U32, 1476, [18:18], "false", "true" useTPSAdvanceTable = bits, U32, 1476, [19:19], "false", "true" - etbCalibrationOnStart = bits, U32, 1476, [20:20], "false", "true" + unused1476b20 = bits, U32, 1476, [20:20], "false", "true" useIacPidMultTable = bits, U32, 1476, [21:21], "false", "true" isBoostControlEnabled = bits, U32, 1476, [22:22], "false", "true" launchSmoothRetard = bits, U32, 1476, [23:23], "false", "true" @@ -1212,6 +1212,7 @@ page = 1 isFasterEngineSpinUpEnabled = "Smarter cranking logic.\nSee also startOfCrankingPrimingPulse" coastingFuelCutEnabled = "This setting disables fuel injection while the engine is in overrun, this is useful as a fuel saving measure and to prevent back firing." useIacTableForCoasting = "This setting allows the ECU to open the IAC during overrun conditions to help reduce engine breaking, this can be helpful for large engines in light weight cars." + pauseEtbControl = "Disable the electronic throttle motor for testing.\nThis mode is for testing ETB position sensors, etc without actually driving the throttle." useETBforIdleControl = "This setting allows the ETB to act as the idle air control valve and move to regulate the airflow at idle." sdCardPeriodMs = "SD card logging period, in milliseconds" triggerErrorPin = "This pin is used for debugging - snap a logic analyzer on it and see if it's ever high" @@ -1645,6 +1646,8 @@ fileVersion = { 20200310 } ; defaultValue = constantName, value; defaultValue = wueAfrTargetOffset, -1.5 -1.4 -1.15 -0.95 -0.775 -0.65 -0.5625 -0.5 -0.4375 -0.375 -0.3125 -0.25 -0.1875 -0.125 -0.0625 0 + maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax } + maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin } requiresPowerCycle = warningLedPin requiresPowerCycle = runningLedPin @@ -2725,6 +2728,7 @@ cmd_write_config = "w\x00\x14\x00\x0A" cmd_test_starter_relay = "w\x00\x14\x00\x0B" cmd_etb_autotune = "w\x00\x14\x00\x0C" cmd_enable_self_stim = "w\x00\x14\x00\x0D" +cmb_etb_auto_calibrate = "w\x00\x14\x00\x0E" cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -3993,8 +3997,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" dialog = etbDialogLeft field = "https://rusefi.com/s/etb" field = "Detailed status in console", isVerboseETB - field = "Pause ETB control", pauseEtbControl - field = etbCalibrationOnStart, etbCalibrationOnStart + field = "Disable ETB Motor", pauseEtbControl ; we need the term about stepper idle in here, because there's a bug in TS that you can't have different visibility ; criteria for the same panel when used in multiple places panel = hbridgeHardware, { throttlePedalPositionAdcChannel != 16 || useStepperIdle && useHbridges } @@ -4003,6 +4006,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Set debug mode below to 'ETB Autotune' to show results" field = "Debug mode", debugMode commandButton = "ETB PID Autotune", cmd_etb_autotune + commandButton = "Auto Calibrate TPS", cmb_etb_auto_calibrate dialog = etbDialogRight panel = etbIdleDialog diff --git a/java_console/models/src/com/rusefi/config/generated/Fields.java b/java_console/models/src/com/rusefi/config/generated/Fields.java index 8e48f99da6..6d14357adb 100644 --- a/java_console/models/src/com/rusefi/config/generated/Fields.java +++ b/java_console/models/src/com/rusefi/config/generated/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Sun Apr 26 14:16:11 EDT 2020 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Tue Apr 28 20:10:00 EDT 2020 // by class com.rusefi.output.FileJavaFieldsConsumer import com.rusefi.config.*; @@ -392,7 +392,6 @@ public class Fields { public static final int etb_use_two_wires_offset = 76; public static final int etbBiasBins_offset = 3888; public static final int etbBiasValues_offset = 3920; - public static final int etbCalibrationOnStart_offset = 1476; public static final int etbDeadband_offset = 3960; public static final int etbFreq_offset = 2514; public static final int etbIdleThrottleRange_offset = 4012; @@ -1503,6 +1502,7 @@ public class Fields { public static final int twoWireBatchInjection_offset = 1476; public static final int uartConsoleSerialSpeed_offset = 2076; public static final int unused1059_offset = 3964; + public static final int unused1476b20_offset = 1476; public static final int unused2432_offset = 2432; public static final int unused2432_offset_hex = 980; public static final int unused711_offset = 711; @@ -2211,7 +2211,7 @@ public class Fields { public static final Field USESEPARATEADVANCEFORCRANKING = Field.create("USESEPARATEADVANCEFORCRANKING", 1476, FieldType.BIT, 17); public static final Field USEADVANCECORRECTIONSFORCRANKING = Field.create("USEADVANCECORRECTIONSFORCRANKING", 1476, FieldType.BIT, 18); public static final Field USETPSADVANCETABLE = Field.create("USETPSADVANCETABLE", 1476, FieldType.BIT, 19); - public static final Field ETBCALIBRATIONONSTART = Field.create("ETBCALIBRATIONONSTART", 1476, FieldType.BIT, 20); + public static final Field UNUSED1476B20 = Field.create("UNUSED1476B20", 1476, FieldType.BIT, 20); public static final Field USEIACPIDMULTTABLE = Field.create("USEIACPIDMULTTABLE", 1476, FieldType.BIT, 21); public static final Field ISBOOSTCONTROLENABLED = Field.create("ISBOOSTCONTROLENABLED", 1476, FieldType.BIT, 22); public static final Field LAUNCHSMOOTHRETARD = Field.create("LAUNCHSMOOTHRETARD", 1476, FieldType.BIT, 23); @@ -3168,7 +3168,7 @@ public class Fields { USESEPARATEADVANCEFORCRANKING, USEADVANCECORRECTIONSFORCRANKING, USETPSADVANCETABLE, - ETBCALIBRATIONONSTART, + UNUSED1476B20, USEIACPIDMULTTABLE, ISBOOSTCONTROLENABLED, LAUNCHSMOOTHRETARD, diff --git a/unit_tests/mocks.h b/unit_tests/mocks.h index 4344b4f1e2..a3dca2df88 100644 --- a/unit_tests/mocks.h +++ b/unit_tests/mocks.h @@ -12,6 +12,7 @@ public: MOCK_METHOD(void, start, (), (override)); MOCK_METHOD(void, init, (DcMotor* motor, int ownIndex, pid_s* pidParameters, const ValueProvider3D* pedalMap), (override)); MOCK_METHOD(void, setIdlePosition, (percent_t pos), (override)); + MOCK_METHOD(void, autoCalibrateTps, (), (override)); // ClosedLoopController mocks MOCK_METHOD(expected, getSetpoint, (), (const, override)); diff --git a/unit_tests/tests/test_etb.cpp b/unit_tests/tests/test_etb.cpp index 98e184203b..b554e4952c 100644 --- a/unit_tests/tests/test_etb.cpp +++ b/unit_tests/tests/test_etb.cpp @@ -144,9 +144,9 @@ TEST(etb, testSetpointOnlyPedal) { Sensor::setMockValue(SensorType::AcceleratorPedal, 20); EXPECT_EQ(20, etb.getSetpoint().value_or(-1)); - // Test invalid pedal position - should give unexpected + // Test invalid pedal position - should give 0 position Sensor::resetMockValue(SensorType::AcceleratorPedal); - EXPECT_EQ(etb.getSetpoint(), unexpected); + EXPECT_EQ(0, etb.getSetpoint().value_or(-1)); } TEST(etb, setpointIdle) { @@ -223,9 +223,12 @@ TEST(etb, etbTpsSensor) { } TEST(etb, setOutputInvalid) { + WITH_ENGINE_TEST_HELPER(TEST_ENGINE); + StrictMock motor; EtbController etb; + INJECT_ENGINE_REFERENCE(&etb); etb.init(&motor, 0, nullptr, nullptr); // Should be disabled in case of unexpected @@ -235,9 +238,11 @@ TEST(etb, setOutputInvalid) { } TEST(etb, setOutputValid) { + WITH_ENGINE_TEST_HELPER(TEST_ENGINE); StrictMock motor; EtbController etb; + INJECT_ENGINE_REFERENCE(&etb); etb.init(&motor, 0, nullptr, nullptr); // Should be enabled and value set @@ -249,10 +254,11 @@ TEST(etb, setOutputValid) { } TEST(etb, setOutputValid2) { + WITH_ENGINE_TEST_HELPER(TEST_ENGINE); StrictMock motor; EtbController etb; - + INJECT_ENGINE_REFERENCE(&etb); etb.init(&motor, 0, nullptr, nullptr); // Should be enabled and value set @@ -264,9 +270,11 @@ TEST(etb, setOutputValid2) { } TEST(etb, setOutputOutOfRangeHigh) { + WITH_ENGINE_TEST_HELPER(TEST_ENGINE); StrictMock motor; EtbController etb; + INJECT_ENGINE_REFERENCE(&etb); etb.init(&motor, 0, nullptr, nullptr); // Should be enabled and value set @@ -278,9 +286,11 @@ TEST(etb, setOutputOutOfRangeHigh) { } TEST(etb, setOutputOutOfRangeLow) { + WITH_ENGINE_TEST_HELPER(TEST_ENGINE); StrictMock motor; EtbController etb; + INJECT_ENGINE_REFERENCE(&etb); etb.init(&motor, 0, nullptr, nullptr); // Should be enabled and value set @@ -291,12 +301,29 @@ TEST(etb, setOutputOutOfRangeLow) { etb.setOutput(-110); } +TEST(etb, setOutputPauseControl) { + WITH_ENGINE_TEST_HELPER(TEST_ENGINE); + StrictMock motor; + + EtbController etb; + INJECT_ENGINE_REFERENCE(&etb); + etb.init(&motor, 0, nullptr, nullptr); + + // Pause control - should get no output + engineConfiguration->pauseEtbControl = true; + + // Disable should be called, and set shouldn't be called + EXPECT_CALL(motor, disable()); + + etb.setOutput(25.0f); +} + TEST(etb, closedLoopPid) { pid_s pid = {}; pid.pFactor = 5; pid.maxValue = 75; pid.minValue = -60; - + EtbController etb; etb.init(nullptr, 0, &pid, nullptr);