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 593c65bdd3..6b46b30d4c 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 13 18:54:34 EDT 2020 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Wed Apr 15 18:17:28 EDT 2020 // by class com.rusefi.output.CHeaderConsumer // begin #ifndef CONFIG_BOARDS_KINETIS_CONFIG_CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H @@ -672,7 +672,7 @@ struct engine_configuration_s { bool useRunningMathForCranking : 1; /** offset 76 bit 24 */ - bool issue_294_25 : 1; + bool displayLogicLevelsInEngineSniffer : 1; /** offset 76 bit 25 */ bool issue_294_26 : 1; @@ -3336,4 +3336,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 13 18:54:34 EDT 2020 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Wed Apr 15 18:17:28 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 c49c0f2081..ac6dfac471 100644 --- a/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h +++ b/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h @@ -525,6 +525,8 @@ #define directSelfStimulation_offset_hex 4c #define displacement_offset 396 #define displacement_offset_hex 18c +#define displayLogicLevelsInEngineSniffer_offset 76 +#define displayLogicLevelsInEngineSniffer_offset_hex 4c #define displayMode_offset 492 #define displayMode_offset_hex 1ec #define dizzySparkOutputPin_offset 2226 @@ -1375,8 +1377,6 @@ #define isMapAveragingEnabled_offset_hex 5c4 #define isSdCardEnabled_offset 744 #define isSdCardEnabled_offset_hex 2e8 -#define issue_294_25_offset 76 -#define issue_294_25_offset_hex 4c #define issue_294_26_offset 76 #define issue_294_26_offset_hex 4c #define issue_294_27_offset 76 diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index 4cca9f41de..3a8ce409ed 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -258,9 +258,10 @@ static void handleCommandX14(uint16_t index) { case 0xB: starterRelayBench(); return; - + case 0xC: + engine->etbAutoTune = true; + return; } - } // todo: this is probably a wrong place for this method now diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 49df9af255..06652b7c11 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -121,9 +121,9 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) { case LE_METHOD_AC_TOGGLE: return getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE); case LE_METHOD_COOLANT: - return getCoolantTemperature(); + return Sensor::get(SensorType::Clt).value_or(0); case LE_METHOD_IS_COOLANT_BROKEN: - return engine->isCltBroken; + return !Sensor::get(SensorType::Clt).Valid; case LE_METHOD_INTAKE_AIR: return getIntakeAirTemperature(); case LE_METHOD_RPM: diff --git a/firmware/controllers/generated/engine_configuration_generated_structures.h b/firmware/controllers/generated/engine_configuration_generated_structures.h index e48567c514..d4e6ee9338 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 13 18:54:18 EDT 2020 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Wed Apr 15 18:17:04 EDT 2020 // by class com.rusefi.output.CHeaderConsumer // begin #ifndef CONTROLLERS_GENERATED_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H @@ -672,7 +672,7 @@ struct engine_configuration_s { bool useRunningMathForCranking : 1; /** offset 76 bit 24 */ - bool issue_294_25 : 1; + bool displayLogicLevelsInEngineSniffer : 1; /** offset 76 bit 25 */ bool issue_294_26 : 1; @@ -3336,4 +3336,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 13 18:54:18 EDT 2020 +// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Wed Apr 15 18:17:04 EDT 2020 diff --git a/firmware/controllers/generated/rusefi_generated.h b/firmware/controllers/generated/rusefi_generated.h index 0eb4ae5496..6109d77294 100644 --- a/firmware/controllers/generated/rusefi_generated.h +++ b/firmware/controllers/generated/rusefi_generated.h @@ -525,6 +525,8 @@ #define directSelfStimulation_offset_hex 4c #define displacement_offset 396 #define displacement_offset_hex 18c +#define displayLogicLevelsInEngineSniffer_offset 76 +#define displayLogicLevelsInEngineSniffer_offset_hex 4c #define displayMode_offset 492 #define displayMode_offset_hex 1ec #define dizzySparkOutputPin_offset 2226 @@ -1375,8 +1377,6 @@ #define isMapAveragingEnabled_offset_hex 5c4 #define isSdCardEnabled_offset 744 #define isSdCardEnabled_offset_hex 2e8 -#define issue_294_25_offset 76 -#define issue_294_25_offset_hex 4c #define issue_294_26_offset 76 #define issue_294_26_offset_hex 4c #define issue_294_27_offset 76 diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 83636ca4d0..bf9c126758 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -24,7 +24,7 @@ #include "trigger_simulator.h" #include "rpm_calculator.h" - +#include "tooth_logger.h" #include "perf_trace.h" #if EFI_PROD_CODE @@ -103,13 +103,33 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_ tc->vvtEventFallCounter++; } + if (!CONFIG(displayLogicLevelsInEngineSniffer)) { + addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN); + } - addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN); if (CONFIG(vvtCamSensorUseRise) ^ (front != TV_FALL)) { return; } + if (CONFIG(displayLogicLevelsInEngineSniffer)) { + if (CONFIG(vvtCamSensorUseRise)) { + // todo: unify TS composite logger code with console Engine Sniffer + // todo: better API to reduce copy/paste? + LogTriggerTooth(SHAFT_SECONDARY_RISING, nowNt PASS_ENGINE_PARAMETER_SUFFIX); + LogTriggerTooth(SHAFT_SECONDARY_FALLING, nowNt PASS_ENGINE_PARAMETER_SUFFIX); + + addEngineSnifferEvent(PROTOCOL_VVT_NAME, PROTOCOL_ES_UP); + addEngineSnifferEvent(PROTOCOL_VVT_NAME, PROTOCOL_ES_DOWN); + } else { + LogTriggerTooth(SHAFT_SECONDARY_FALLING, nowNt PASS_ENGINE_PARAMETER_SUFFIX); + LogTriggerTooth(SHAFT_SECONDARY_RISING, nowNt PASS_ENGINE_PARAMETER_SUFFIX); + + addEngineSnifferEvent(PROTOCOL_VVT_NAME, PROTOCOL_ES_DOWN); + addEngineSnifferEvent(PROTOCOL_VVT_NAME, PROTOCOL_ES_UP); + } + } + floatus_t oneDegreeUs = engine->rpmCalculator.oneDegreeUs; if (cisnan(oneDegreeUs)) { // we are here if we are getting VVT position signals while engine is not running diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index cae8058b98..f9acab3996 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -547,7 +547,8 @@ void TriggerState::decodeTriggerEvent(TriggerWaveform *triggerShape, const Trigg scheduleMsg(logger, "index=%d NaN gap, you have noise issues?", i); } else { - scheduleMsg(logger, "time=%d index=%d: gap=%.3f expected from %.3f to %.3f error=%s", + scheduleMsg(logger, "rpm=%d time=%d index=%d: gap=%.3f expected from %.3f to %.3f error=%s", + GET_RPM(), /* cast is needed to make sure we do not put 64 bit value to stack*/ (int)getTimeNowSeconds(), i, gap, diff --git a/firmware/hw_layer/trigger_input_icu.cpp b/firmware/hw_layer/trigger_input_icu.cpp index ab193386d7..d3abca5554 100644 --- a/firmware/hw_layer/trigger_input_icu.cpp +++ b/firmware/hw_layer/trigger_input_icu.cpp @@ -30,7 +30,10 @@ static Logging *logger; static void vvtRisingCallback(void *) { efitick_t now = getTimeNowNt(); #if EFI_TOOTH_LOGGER - LogTriggerTooth(SHAFT_SECONDARY_RISING, now); + if (!CONFIG(displayLogicLevelsInEngineSniffer)) { + // real physical fronts go into engine sniffer + LogTriggerTooth(SHAFT_SECONDARY_RISING, now); + } #endif /* EFI_TOOTH_LOGGER */ hwHandleVvtCamSignal(TV_RISE, now); } @@ -38,7 +41,9 @@ static void vvtRisingCallback(void *) { static void vvtFallingCallback(void *) { efitick_t now = getTimeNowNt(); #if EFI_TOOTH_LOGGER - LogTriggerTooth(SHAFT_SECONDARY_FALLING, now); + if (!CONFIG(displayLogicLevelsInEngineSniffer)) { + LogTriggerTooth(SHAFT_SECONDARY_FALLING, now); + } #endif /* EFI_TOOTH_LOGGER */ hwHandleVvtCamSignal(TV_FALL, now); } diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index f9c58ef7ce..185035d2c1 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -373,7 +373,7 @@ bit launchControlEnabled; bit rollingLaunchEnabled; bit antiLagEnabled; bit useRunningMathForCranking,Fuel Map,Fixed; -bit issue_294_25; +bit displayLogicLevelsInEngineSniffer; bit issue_294_26; bit issue_294_27; bit issue_294_28; diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 45aaed8a9a..c099704909 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -40,9 +40,6 @@ enable2ndByteCanID = false ; settingOption = DEFAULT, "Speed Density" ; DEFAULT will be over looked and this will fall into the #else block of the statement. -[MegaTune] - ; https://rusefi.com/forum/viewtopic.php?p=36201#p36201 - signature = "rusEFI v1.2020.3" [TunerStudio] queryCommand = "S" @@ -89,7 +86,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 Wed Apr 15 17:02:46 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Wed Apr 15 18:23:16 EDT 2020 pageSize = 20000 page = 1 @@ -122,7 +119,7 @@ page = 1 rollingLaunchEnabled = bits, U32, 76, [21:21], "false", "true" antiLagEnabled = bits, U32, 76, [22:22], "false", "true" useRunningMathForCranking= bits, U32, 76, [23:23], "Fixed", "Fuel Map" - issue_294_25 = bits, U32, 76, [24:24], "false", "true" + displayLogicLevelsInEngineSniffer= bits, U32, 76, [24:24], "false", "true" issue_294_26 = bits, U32, 76, [25:25], "false", "true" issue_294_27 = bits, U32, 76, [26:26], "false", "true" issue_294_28 = bits, U32, 76, [27:27], "false", "true" @@ -2609,6 +2606,7 @@ cmd_tle8888_init = "w\x00\x14\x00\x08" cmd_test_ac_relay = "w\x00\x14\x00\x09" 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_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -2746,6 +2744,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Reminder that 4-stroke cycle is 720 degrees" field = "!For well-known trigger types use '0' trigger angle offset" field = "Trigger Angle Offset", globalTriggerAngleOffset + field = "Display only interesting", displayLogicLevelsInEngineSniffer field = "#Custom Trigger" field = "total Tooth Count", trigger_customTotalToothCount, {trigger_type == 0} field = "skipped Tooth Count", trigger_customSkippedToothCount, {trigger_type == 0} @@ -3896,6 +3895,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" commandButton = "TPS#2 wide open position", cmd_calibrate_tps_2_wot commandButton = "Pedal Up", cmd_calibrate_pedal_up commandButton = "Pedal Down", cmd_calibrate_pedal_down + commandButton = "ETB PID Autotune", cmd_etb_autotune dialog = etbDialog, "Electronic Throttle Body (beta)", border topicHelp = "etbHelp" diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index ca96477731..83c034ebb9 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -1443,6 +1443,7 @@ cmd_tle8888_init = "w\x00\x14\x00\x08" cmd_test_ac_relay = "w\x00\x14\x00\x09" 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_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -1580,6 +1581,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Reminder that 4-stroke cycle is 720 degrees" field = "!For well-known trigger types use '0' trigger angle offset" field = "Trigger Angle Offset", globalTriggerAngleOffset + field = "Display only interesting", displayLogicLevelsInEngineSniffer field = "#Custom Trigger" field = "total Tooth Count", trigger_customTotalToothCount, {trigger_type == 0} field = "skipped Tooth Count", trigger_customSkippedToothCount, {trigger_type == 0} @@ -2731,6 +2733,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" commandButton = "TPS#2 wide open position", cmd_calibrate_tps_2_wot commandButton = "Pedal Up", cmd_calibrate_pedal_up commandButton = "Pedal Down", cmd_calibrate_pedal_down + commandButton = "ETB PID Autotune", cmd_etb_autotune dialog = etbDialog, "Electronic Throttle Body (beta)", border topicHelp = "etbHelp" diff --git a/firmware/tunerstudio/rusefi_frankenso.ini b/firmware/tunerstudio/rusefi_frankenso.ini index c4c2f62aa4..e299b9d79e 100644 --- a/firmware/tunerstudio/rusefi_frankenso.ini +++ b/firmware/tunerstudio/rusefi_frankenso.ini @@ -40,9 +40,6 @@ enable2ndByteCanID = false ; settingOption = DEFAULT, "Speed Density" ; DEFAULT will be over looked and this will fall into the #else block of the statement. -[MegaTune] - ; https://rusefi.com/forum/viewtopic.php?p=36201#p36201 - signature = "rusEFI v1.2020.3" [TunerStudio] queryCommand = "S" @@ -89,7 +86,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 Wed Apr 15 17:02:53 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Wed Apr 15 18:23:26 EDT 2020 pageSize = 20000 page = 1 @@ -122,7 +119,7 @@ page = 1 rollingLaunchEnabled = bits, U32, 76, [21:21], "false", "true" antiLagEnabled = bits, U32, 76, [22:22], "false", "true" useRunningMathForCranking= bits, U32, 76, [23:23], "Fixed", "Fuel Map" - issue_294_25 = bits, U32, 76, [24:24], "false", "true" + displayLogicLevelsInEngineSniffer= bits, U32, 76, [24:24], "false", "true" issue_294_26 = bits, U32, 76, [25:25], "false", "true" issue_294_27 = bits, U32, 76, [26:26], "false", "true" issue_294_28 = bits, U32, 76, [27:27], "false", "true" @@ -2609,6 +2606,7 @@ cmd_tle8888_init = "w\x00\x14\x00\x08" cmd_test_ac_relay = "w\x00\x14\x00\x09" 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_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -2746,6 +2744,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Reminder that 4-stroke cycle is 720 degrees" field = "!For well-known trigger types use '0' trigger angle offset" field = "Trigger Angle Offset", globalTriggerAngleOffset + field = "Display only interesting", displayLogicLevelsInEngineSniffer field = "#Custom Trigger" field = "total Tooth Count", trigger_customTotalToothCount, {trigger_type == 0} field = "skipped Tooth Count", trigger_customSkippedToothCount, {trigger_type == 0} @@ -3896,6 +3895,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" commandButton = "TPS#2 wide open position", cmd_calibrate_tps_2_wot commandButton = "Pedal Up", cmd_calibrate_pedal_up commandButton = "Pedal Down", cmd_calibrate_pedal_down + commandButton = "ETB PID Autotune", cmd_etb_autotune dialog = etbDialog, "Electronic Throttle Body (beta)", border topicHelp = "etbHelp" diff --git a/firmware/tunerstudio/rusefi_kinetis.ini b/firmware/tunerstudio/rusefi_kinetis.ini index 625f42d889..2f79e9785f 100644 --- a/firmware/tunerstudio/rusefi_kinetis.ini +++ b/firmware/tunerstudio/rusefi_kinetis.ini @@ -86,7 +86,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 Mon Apr 13 20:23:18 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Wed Apr 15 18:17:28 EDT 2020 pageSize = 20000 page = 1 @@ -119,7 +119,7 @@ page = 1 rollingLaunchEnabled = bits, U32, 76, [21:21], "false", "true" antiLagEnabled = bits, U32, 76, [22:22], "false", "true" useRunningMathForCranking= bits, U32, 76, [23:23], "Fixed", "Fuel Map" - issue_294_25 = bits, U32, 76, [24:24], "false", "true" + displayLogicLevelsInEngineSniffer= bits, U32, 76, [24:24], "false", "true" issue_294_26 = bits, U32, 76, [25:25], "false", "true" issue_294_27 = bits, U32, 76, [26:26], "false", "true" issue_294_28 = bits, U32, 76, [27:27], "false", "true" @@ -2374,14 +2374,14 @@ menuDialog = main subMenu = std_separator # Targets & closed loop - subMenu = afrTableTbl, "Target AFR", 0, {isInjectionEnabled == 1 && fuelAlgorithm == LM_SPEED_DENSITY} + subMenu = afrTableTbl, "Target AFR", 0, {isInjectionEnabled == 1 && (fuelAlgorithm == LM_SPEED_DENSITY || fuelAlgorithm == LM_REAL_MAF)} subMenu = fuelClosedLoopDialog, "Closed loop correction", 0, {isInjectionEnabled == 1} subMenu = coastingFuelCutControl, "Deceleration fuel cutoff (DFCO)", 0, {isInjectionEnabled == 1} subMenu = std_separator # Fuel table/VE - subMenu = fuelTableDialog, "Fuel table", 0, {isInjectionEnabled == 1 && fuelAlgorithm != LM_SPEED_DENSITY} - subMenu = veTableDialog, "VE", 0, {isInjectionEnabled == 1 && fuelAlgorithm == LM_SPEED_DENSITY} + subMenu = fuelTableDialog, "Fuel table", 0, {isInjectionEnabled == 1 && fuelAlgorithm != LM_SPEED_DENSITY && fuelAlgorithm != LM_REAL_MAF} + subMenu = veTableDialog, "VE", 0, {isInjectionEnabled == 1 && (fuelAlgorithm == LM_SPEED_DENSITY || fuelAlgorithm == LM_REAL_MAF)} subMenu = injPhaseTableTbl, "Injection phase", 0, {isInjectionEnabled == 1} subMenu = std_separator @@ -2743,6 +2743,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Reminder that 4-stroke cycle is 720 degrees" field = "!For well-known trigger types use '0' trigger angle offset" field = "Trigger Angle Offset", globalTriggerAngleOffset + field = "Display only interesting", displayLogicLevelsInEngineSniffer field = "#Custom Trigger" field = "total Tooth Count", trigger_customTotalToothCount, {trigger_type == 0} field = "skipped Tooth Count", trigger_customSkippedToothCount, {trigger_type == 0} @@ -2937,6 +2938,9 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = mc33816_cs, mc33816_cs field = mc33816_rstb, mc33816_rstb field = mc33816_flag0, mc33816_flag0 + field = "trigger stimulator pin #1", triggerSimulatorPins1 + field = "trigger stimulator pin #2", triggerSimulatorPins2 + field = "trigger stimulator pin #2", triggerSimulatorPins3 field = high_fuel_pressure_sensor_1, high_fuel_pressure_sensor_1 field = high_fuel_pressure_sensor_2, high_fuel_pressure_sensor_2 field = mc33816_driven, mc33816_driven diff --git a/firmware/tunerstudio/rusefi_microrusefi.ini b/firmware/tunerstudio/rusefi_microrusefi.ini index 1c6ba21706..b07f68f04f 100644 --- a/firmware/tunerstudio/rusefi_microrusefi.ini +++ b/firmware/tunerstudio/rusefi_microrusefi.ini @@ -40,9 +40,6 @@ enable2ndByteCanID = false ; settingOption = DEFAULT, "Speed Density" ; DEFAULT will be over looked and this will fall into the #else block of the statement. -[MegaTune] - ; https://rusefi.com/forum/viewtopic.php?p=36201#p36201 - signature = "rusEFI v1.2020.3" [TunerStudio] queryCommand = "S" @@ -89,7 +86,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 Wed Apr 15 17:02:50 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Wed Apr 15 18:23:21 EDT 2020 pageSize = 20000 page = 1 @@ -122,7 +119,7 @@ page = 1 rollingLaunchEnabled = bits, U32, 76, [21:21], "false", "true" antiLagEnabled = bits, U32, 76, [22:22], "false", "true" useRunningMathForCranking= bits, U32, 76, [23:23], "Fixed", "Fuel Map" - issue_294_25 = bits, U32, 76, [24:24], "false", "true" + displayLogicLevelsInEngineSniffer= bits, U32, 76, [24:24], "false", "true" issue_294_26 = bits, U32, 76, [25:25], "false", "true" issue_294_27 = bits, U32, 76, [26:26], "false", "true" issue_294_28 = bits, U32, 76, [27:27], "false", "true" @@ -2601,6 +2598,7 @@ cmd_tle8888_init = "w\x00\x14\x00\x08" cmd_test_ac_relay = "w\x00\x14\x00\x09" 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_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -2738,6 +2736,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Reminder that 4-stroke cycle is 720 degrees" field = "!For well-known trigger types use '0' trigger angle offset" field = "Trigger Angle Offset", globalTriggerAngleOffset + field = "Display only interesting", displayLogicLevelsInEngineSniffer field = "#Custom Trigger" field = "total Tooth Count", trigger_customTotalToothCount, {trigger_type == 0} field = "skipped Tooth Count", trigger_customSkippedToothCount, {trigger_type == 0} @@ -3856,6 +3855,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" commandButton = "TPS#2 wide open position", cmd_calibrate_tps_2_wot commandButton = "Pedal Up", cmd_calibrate_pedal_up commandButton = "Pedal Down", cmd_calibrate_pedal_down + commandButton = "ETB PID Autotune", cmd_etb_autotune dialog = etbDialog, "Electronic Throttle Body (beta)", border topicHelp = "etbHelp" diff --git a/firmware/tunerstudio/rusefi_prometheus.ini b/firmware/tunerstudio/rusefi_prometheus.ini index 440b96f00f..3296b86df0 100644 --- a/firmware/tunerstudio/rusefi_prometheus.ini +++ b/firmware/tunerstudio/rusefi_prometheus.ini @@ -40,9 +40,6 @@ enable2ndByteCanID = false ; settingOption = DEFAULT, "Speed Density" ; DEFAULT will be over looked and this will fall into the #else block of the statement. -[MegaTune] - ; https://rusefi.com/forum/viewtopic.php?p=36201#p36201 - signature = "rusEFI v1.2020.3" [TunerStudio] queryCommand = "S" @@ -89,7 +86,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 Wed Apr 15 17:02:56 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Wed Apr 15 18:23:31 EDT 2020 pageSize = 20000 page = 1 @@ -122,7 +119,7 @@ page = 1 rollingLaunchEnabled = bits, U32, 76, [21:21], "false", "true" antiLagEnabled = bits, U32, 76, [22:22], "false", "true" useRunningMathForCranking= bits, U32, 76, [23:23], "Fixed", "Fuel Map" - issue_294_25 = bits, U32, 76, [24:24], "false", "true" + displayLogicLevelsInEngineSniffer= bits, U32, 76, [24:24], "false", "true" issue_294_26 = bits, U32, 76, [25:25], "false", "true" issue_294_27 = bits, U32, 76, [26:26], "false", "true" issue_294_28 = bits, U32, 76, [27:27], "false", "true" @@ -2605,6 +2602,7 @@ cmd_tle8888_init = "w\x00\x14\x00\x08" cmd_test_ac_relay = "w\x00\x14\x00\x09" 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_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -2742,6 +2740,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Reminder that 4-stroke cycle is 720 degrees" field = "!For well-known trigger types use '0' trigger angle offset" field = "Trigger Angle Offset", globalTriggerAngleOffset + field = "Display only interesting", displayLogicLevelsInEngineSniffer field = "#Custom Trigger" field = "total Tooth Count", trigger_customTotalToothCount, {trigger_type == 0} field = "skipped Tooth Count", trigger_customSkippedToothCount, {trigger_type == 0} @@ -3892,6 +3891,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" commandButton = "TPS#2 wide open position", cmd_calibrate_tps_2_wot commandButton = "Pedal Up", cmd_calibrate_pedal_up commandButton = "Pedal Down", cmd_calibrate_pedal_down + commandButton = "ETB PID Autotune", cmd_etb_autotune dialog = etbDialog, "Electronic Throttle Body (beta)", border topicHelp = "etbHelp" diff --git a/firmware/tunerstudio/rusefi_proteus.ini b/firmware/tunerstudio/rusefi_proteus.ini index dfaa359096..e010104ded 100644 --- a/firmware/tunerstudio/rusefi_proteus.ini +++ b/firmware/tunerstudio/rusefi_proteus.ini @@ -40,9 +40,6 @@ enable2ndByteCanID = false ; settingOption = DEFAULT, "Speed Density" ; DEFAULT will be over looked and this will fall into the #else block of the statement. -[MegaTune] - ; https://rusefi.com/forum/viewtopic.php?p=36201#p36201 - signature = "rusEFI v1.2020.3" [TunerStudio] queryCommand = "S" @@ -89,7 +86,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 Wed Apr 15 17:02:58 EDT 2020 +; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Wed Apr 15 18:23:35 EDT 2020 pageSize = 20000 page = 1 @@ -122,7 +119,7 @@ page = 1 rollingLaunchEnabled = bits, U32, 76, [21:21], "false", "true" antiLagEnabled = bits, U32, 76, [22:22], "false", "true" useRunningMathForCranking= bits, U32, 76, [23:23], "Fixed", "Fuel Map" - issue_294_25 = bits, U32, 76, [24:24], "false", "true" + displayLogicLevelsInEngineSniffer= bits, U32, 76, [24:24], "false", "true" issue_294_26 = bits, U32, 76, [25:25], "false", "true" issue_294_27 = bits, U32, 76, [26:26], "false", "true" issue_294_28 = bits, U32, 76, [27:27], "false", "true" @@ -2601,6 +2598,7 @@ cmd_tle8888_init = "w\x00\x14\x00\x08" cmd_test_ac_relay = "w\x00\x14\x00\x09" 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_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -2738,6 +2736,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "!Reminder that 4-stroke cycle is 720 degrees" field = "!For well-known trigger types use '0' trigger angle offset" field = "Trigger Angle Offset", globalTriggerAngleOffset + field = "Display only interesting", displayLogicLevelsInEngineSniffer field = "#Custom Trigger" field = "total Tooth Count", trigger_customTotalToothCount, {trigger_type == 0} field = "skipped Tooth Count", trigger_customSkippedToothCount, {trigger_type == 0} @@ -3864,6 +3863,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" commandButton = "TPS#2 wide open position", cmd_calibrate_tps_2_wot commandButton = "Pedal Up", cmd_calibrate_pedal_up commandButton = "Pedal Down", cmd_calibrate_pedal_down + commandButton = "ETB PID Autotune", cmd_etb_autotune dialog = etbDialog, "Electronic Throttle Body (beta)", border topicHelp = "etbHelp" 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 1dcb36c1cd..40f8472956 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 Mon Apr 13 20:23:02 EDT 2020 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Wed Apr 15 18:17:04 EDT 2020 // by class com.rusefi.output.FileJavaFieldsConsumer import com.rusefi.config.*; @@ -345,6 +345,7 @@ public class Fields { public static final int digitalPotentiometerSpiDevice_offset = 677; public static final int directSelfStimulation_offset = 76; public static final int displacement_offset = 396; + public static final int displayLogicLevelsInEngineSniffer_offset = 76; public static final int displayMode_offset = 492; public static final int dizzySparkOutputPin_offset = 2226; public static final int dizzySparkOutputPinMode_offset = 2227; @@ -914,7 +915,6 @@ public class Fields { public static final int isManualSpinningMode_offset = 1476; public static final int isMapAveragingEnabled_offset = 1476; public static final int isSdCardEnabled_offset = 744; - public static final int issue_294_25_offset = 76; public static final int issue_294_26_offset = 76; public static final int issue_294_27_offset = 76; public static final int issue_294_28_offset = 76; @@ -1572,7 +1572,7 @@ public class Fields { public static final Field ROLLINGLAUNCHENABLED = Field.create("ROLLINGLAUNCHENABLED", 76, FieldType.BIT, 21); public static final Field ANTILAGENABLED = Field.create("ANTILAGENABLED", 76, FieldType.BIT, 22); public static final Field USERUNNINGMATHFORCRANKING = Field.create("USERUNNINGMATHFORCRANKING", 76, FieldType.BIT, 23); - public static final Field ISSUE_294_25 = Field.create("ISSUE_294_25", 76, FieldType.BIT, 24); + public static final Field DISPLAYLOGICLEVELSINENGINESNIFFER = Field.create("DISPLAYLOGICLEVELSINENGINESNIFFER", 76, FieldType.BIT, 24); public static final Field ISSUE_294_26 = Field.create("ISSUE_294_26", 76, FieldType.BIT, 25); public static final Field ISSUE_294_27 = Field.create("ISSUE_294_27", 76, FieldType.BIT, 26); public static final Field ISSUE_294_28 = Field.create("ISSUE_294_28", 76, FieldType.BIT, 27); @@ -2507,7 +2507,7 @@ public class Fields { ROLLINGLAUNCHENABLED, ANTILAGENABLED, USERUNNINGMATHFORCRANKING, - ISSUE_294_25, + DISPLAYLOGICLEVELSINENGINESNIFFER, ISSUE_294_26, ISSUE_294_27, ISSUE_294_28, diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp index dcd8f09539..17edd9567d 100644 --- a/unit_tests/engine_test_helper.cpp +++ b/unit_tests/engine_test_helper.cpp @@ -76,7 +76,10 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callb } -EngineTestHelper::EngineTestHelper(engine_type_e engineType) : EngineTestHelper(engineType, &emptyCallbackWithConfiguration) { +EngineTestHelper::EngineTestHelper(engine_type_e engineType, const std::unordered_map& sensorValues) : EngineTestHelper(engineType, &emptyCallbackWithConfiguration) { + for (const auto [s, v] : sensorValues) { + Sensor::setMockValue(s, v); + } } EngineTestHelper::~EngineTestHelper() { diff --git a/unit_tests/engine_test_helper.h b/unit_tests/engine_test_helper.h index a6dc70a7a7..47e75f8dba 100644 --- a/unit_tests/engine_test_helper.h +++ b/unit_tests/engine_test_helper.h @@ -29,7 +29,7 @@ public: */ class EngineTestHelper : public EngineTestHelperBase { public: - explicit EngineTestHelper(engine_type_e engineType); + EngineTestHelper(engine_type_e engineType, const std::unordered_map& sensorValues); EngineTestHelper(engine_type_e engineType, configuration_callback_t boardCallback); ~EngineTestHelper(); diff --git a/unit_tests/global.h b/unit_tests/global.h index 63ab479659..656b214d5a 100644 --- a/unit_tests/global.h +++ b/unit_tests/global.h @@ -87,8 +87,13 @@ void print(const char *fmt, ...); Engine *engine = ð.engine; \ EXPAND_Engine -#define WITH_ENGINE_TEST_HELPER(x) EngineTestHelper eth(x); \ - EXPAND_EngineTestHelper; +#define WITH_ENGINE_TEST_HELPER_SENS(x, sensorvals) \ + EngineTestHelper eth(x, sensorvals); \ + EXPAND_EngineTestHelper; + +#define WITH_ENGINE_TEST_HELPER(x) \ + EngineTestHelper eth(x, std::unordered_map{}); \ + EXPAND_EngineTestHelper; #define CONFIG_PARAM(x) (x) diff --git a/unit_tests/tests/test_logic_expression.cpp b/unit_tests/tests/test_logic_expression.cpp index 63dd61c90d..806d535c0c 100644 --- a/unit_tests/tests/test_logic_expression.cpp +++ b/unit_tests/tests/test_logic_expression.cpp @@ -19,7 +19,7 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) { case LE_METHOD_FAN: return engine->fsioState.mockFan; case LE_METHOD_COOLANT: - return getCoolantTemperature(); + return Sensor::get(SensorType::Clt).value_or(0); case LE_METHOD_RPM: return engine->fsioState.mockRpm; case LE_METHOD_CRANKING_RPM: @@ -101,13 +101,13 @@ static void testExpression2(float selfValue, const char *line, float expected, E ASSERT_EQ(expected, c.getValue2(selfValue, element PASS_ENGINE_PARAMETER_SUFFIX)) << line; } -static void testExpression2(float selfValue, const char *line, float expected) { - WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995); +static void testExpression2(float selfValue, const char *line, float expected, const std::unordered_map& sensorVals = {}) { + WITH_ENGINE_TEST_HELPER_SENS(FORD_INLINE_6_1995, sensorVals); testExpression2(selfValue, line, expected, engine); } -static void testExpression(const char *line, float expectedValue) { - testExpression2(0, line, expectedValue); +static void testExpression(const char *line, float expectedValue, const std::unordered_map& sensorVals = {}) { + testExpression2(0, line, expectedValue, sensorVals); } TEST(fsio, testIfFunction) { @@ -115,8 +115,6 @@ TEST(fsio, testIfFunction) { } TEST(fsio, testLogicExpressions) { - printf("*************************************************** testLogicExpressions\r\n"); - testParsing(); { @@ -181,36 +179,32 @@ TEST(fsio, testLogicExpressions) { * fan = fan NOT coolant 90 AND more fan coolant 85 more AND OR */ - { - WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995); - engine->sensors.mockClt = 100; - engine->periodicSlowCallback(PASS_ENGINE_PARAMETER_SIGNATURE); - testExpression2(0, "coolant 1 +", 101, engine); - } - testExpression("fan", 0); - testExpression("fan not", 1); - testExpression("coolant 90 >", 1); - testExpression("fan not coolant 90 > and", 1); + std::unordered_map sensorVals = {{SensorType::Clt, 100}}; + testExpression("coolant 1 +", 101, sensorVals); + + testExpression("fan", 0, sensorVals); + testExpression("fan not", 1, sensorVals); + testExpression("coolant 90 >", 1, sensorVals); + testExpression("fan not coolant 90 > and", 1, sensorVals); testExpression("100 200 1 if", 200); testExpression("10 99 max", 99); testExpression2(123, "10 self max", 123); - testExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR", 1); - { - WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995); - LEElement thepool[TEST_POOL_SIZE]; - LEElementPool pool(thepool, TEST_POOL_SIZE); - LEElement * element = pool.parseExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR"); - ASSERT_TRUE(element != NULL) << "Not NULL expected"; - LECalculator c; - ASSERT_EQ( 1, c.getValue2(0, element PASS_ENGINE_PARAMETER_SUFFIX)) << "that expression"; + testExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR", 1, sensorVals); - ASSERT_EQ(12, c.currentCalculationLogPosition); - ASSERT_EQ(102, c.calcLogAction[0]); - ASSERT_EQ(0, c.calcLogValue[0]); - } + WITH_ENGINE_TEST_HELPER_SENS(FORD_INLINE_6_1995, sensorVals); + LEElement thepool[TEST_POOL_SIZE]; + LEElementPool pool(thepool, TEST_POOL_SIZE); + LEElement * element = pool.parseExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR"); + ASSERT_TRUE(element != NULL) << "Not NULL expected"; + LECalculator c; + ASSERT_EQ( 1, c.getValue2(0, element PASS_ENGINE_PARAMETER_SUFFIX)) << "that expression"; + + ASSERT_EQ(12, c.currentCalculationLogPosition); + ASSERT_EQ(102, c.calcLogAction[0]); + ASSERT_EQ(0, c.calcLogValue[0]); testExpression("cfg_fanOffTemperature", 0); testExpression("coolant cfg_fanOffTemperature >", 1); @@ -222,13 +216,10 @@ TEST(fsio, testLogicExpressions) { testExpression(FAN_CONTROL_LOGIC, 1); - { - WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995); - engine->fsioState.mockRpm = 900; - engine->fsioState.mockCrankingRpm = 200; - testExpression2(0, "rpm", 900, engine); - testExpression2(0, "cranking_rpm", 200, engine); - testExpression2(0, STARTER_RELAY_LOGIC, 0, engine); - testExpression2(0, "rpm cranking_rpm > ", 1, engine); - } + engine->fsioState.mockRpm = 900; + engine->fsioState.mockCrankingRpm = 200; + testExpression2(0, "rpm", 900, engine); + testExpression2(0, "cranking_rpm", 200, engine); + testExpression2(0, STARTER_RELAY_LOGIC, 0, engine); + testExpression2(0, "rpm cranking_rpm > ", 1, engine); }