From fdfd2244ce080ec45bd817a8a4432726d4cb4cab Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 7 Oct 2019 23:12:29 -0400 Subject: [PATCH] One cylinder, 4 stroke, only crank sensor needs special wasted_mode spark control #968 just a unit test for now --- firmware/config/engines/GY6_139QMB.cpp | 2 ++ ...p => test_dwell_corner_case_issue_796.cpp} | 2 +- unit_tests/tests/test_one_cylinder_logic.cpp | 34 +++++++++++++++++++ unit_tests/tests/tests.mk | 3 +- 4 files changed, 39 insertions(+), 2 deletions(-) rename unit_tests/tests/{test_dwell_corver_case_issue_796.cpp => test_dwell_corner_case_issue_796.cpp} (79%) create mode 100644 unit_tests/tests/test_one_cylinder_logic.cpp diff --git a/firmware/config/engines/GY6_139QMB.cpp b/firmware/config/engines/GY6_139QMB.cpp index 50cd69cd09..319a352508 100644 --- a/firmware/config/engines/GY6_139QMB.cpp +++ b/firmware/config/engines/GY6_139QMB.cpp @@ -108,4 +108,6 @@ void setGy6139qmbDefaultEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) // set injection_mode 1 engineConfiguration->injectionMode = IM_SEQUENTIAL; + // set ignition_mode 0 + engineConfiguration->ignitionMode = IM_ONE_COIL; } diff --git a/unit_tests/tests/test_dwell_corver_case_issue_796.cpp b/unit_tests/tests/test_dwell_corner_case_issue_796.cpp similarity index 79% rename from unit_tests/tests/test_dwell_corver_case_issue_796.cpp rename to unit_tests/tests/test_dwell_corner_case_issue_796.cpp index 81b56d25a4..8b68a5bd93 100644 --- a/unit_tests/tests/test_dwell_corver_case_issue_796.cpp +++ b/unit_tests/tests/test_dwell_corner_case_issue_796.cpp @@ -1,5 +1,5 @@ /* - * test_dwell_corver_case_issue_796.cpp + * test_dwell_corner_case_issue_796.cpp * * Created on: Jul 1, 2019 * @author Andrey Belomutskiy, (c) 2012-2019 diff --git a/unit_tests/tests/test_one_cylinder_logic.cpp b/unit_tests/tests/test_one_cylinder_logic.cpp new file mode 100644 index 0000000000..343210b170 --- /dev/null +++ b/unit_tests/tests/test_one_cylinder_logic.cpp @@ -0,0 +1,34 @@ +/** + * @file test_one_cylinder_logic.cpp + * @author Andrey Belomutskiy, (c) 2012-2019 + */ + +#include "engine_test_helper.h" +#include "spark_logic.h" + +TEST(issues, issueOneCylinderSpecialCase968) { + WITH_ENGINE_TEST_HELPER(GY6_139QMB); + // set injection_mode 1 + engineConfiguration->injectionMode = IM_SEQUENTIAL; + + setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); + engineConfiguration->useOnlyRisingEdgeForTrigger = true; + + eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX); + + ASSERT_EQ( 0, engine->executor.size()) << "start"; + + eth.fireTriggerEvents2(/* count */ 3, 50 /* ms */); + ASSERT_EQ( 0, GET_RPM()) << "RPM"; + ASSERT_EQ( 0, engine->executor.size()) << "first revolution(s)"; + + eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */); + + ASSERT_EQ( 2, engine->executor.size()) << "first revolution(s)"; + eth.assertEvent5("spark up#0", 0, (void*)turnSparkPinHigh, -43500); + eth.assertEvent5("spark down#0", 1, (void*)fireSparkAndPrepareNextSchedule, -37500); + + + eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */); + ASSERT_EQ( 4, engine->executor.size()) << "first revolution(s)"; +} diff --git a/unit_tests/tests/tests.mk b/unit_tests/tests/tests.mk index 2be44a7e07..3bc2de1b28 100644 --- a/unit_tests/tests/tests.mk +++ b/unit_tests/tests/tests.mk @@ -9,12 +9,13 @@ TESTS_SRC_CPP = \ tests/test_startOfCrankingPrimingPulse.cpp \ tests/test_miata_na6_real_cranking.cpp \ tests/test_fasterEngineSpinningUp.cpp \ - tests/test_dwell_corver_case_issue_796.cpp \ + tests/test_dwell_corner_case_issue_796.cpp \ tests/test_idle_controller.cpp \ tests/test_trigger_decoder.cpp \ tests/test_trigger_noiseless.cpp \ tests/test_issue_898.cpp \ tests/test_fuel_map.cpp \ + tests/test_one_cylinder_logic.cpp \ tests/test_maf2map.cpp \ tests/test_fuelCut.cpp \ tests/test_trigger_multi_sync.cpp \