diff --git a/unit_tests/tests/tests.mk b/unit_tests/tests/tests.mk index d7571c22e5..b54a80cad1 100644 --- a/unit_tests/tests/tests.mk +++ b/unit_tests/tests/tests.mk @@ -4,6 +4,7 @@ TESTS_SRC_CPP = \ tests/trigger/test_trigger_noiseless.cpp \ tests/trigger/test_trigger_multi_sync.cpp \ tests/trigger/test_cam_vvt_input.cpp \ + tests/trigger/test_2jz_vvt.cpp \ tests/test_util.cpp \ tests/test_ion.cpp \ tests/test_aux_valves.cpp \ diff --git a/unit_tests/tests/trigger/test_2jz_vvt.cpp b/unit_tests/tests/trigger/test_2jz_vvt.cpp new file mode 100644 index 0000000000..9e7ce6355c --- /dev/null +++ b/unit_tests/tests/trigger/test_2jz_vvt.cpp @@ -0,0 +1,33 @@ +/* + * @file test_2jz_vvt.cpp + * + * Created on: May 10, 2020 + * @author Andrey Belomutskiy, (c) 2012-2020 + */ + +#include "engine_test_helper.h" + +TEST(sensors, test2jz) { + + WITH_ENGINE_TEST_HELPER(TOYOTA_2JZ_GTE_VVTi); + + + // this crank trigger would be easier to test, crank shape is less important for this test + engineConfiguration->useOnlyRisingEdgeForTrigger = true; + eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX); + + ASSERT_EQ( 0, GET_RPM()) << "test2jz RPM"; + for (int i = 0; i < 3;i++) { + eth.fireRise(25); + ASSERT_EQ( 0, GET_RPM()) << "test2jz RPM at " << i; + } + eth.fireRise(25); + // first time we have RPM + ASSERT_EQ(2400, GET_RPM()) << "test2jz RPM"; + + + eth.moveTimeForwardUs(MS2US(3)); // shifting VVT phase a few angles + + hwHandleVvtCamSignal(TV_FALL, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX); + +} diff --git a/unit_tests/tests/trigger/test_cam_vvt_input.cpp b/unit_tests/tests/trigger/test_cam_vvt_input.cpp index 3e53065410..c1fe6f55da 100644 --- a/unit_tests/tests/trigger/test_cam_vvt_input.cpp +++ b/unit_tests/tests/trigger/test_cam_vvt_input.cpp @@ -138,7 +138,7 @@ TEST(sensors, testNB2CamInput) { ASSERT_EQ(totalRevolutionCountBeforeVvtSync, engine->triggerCentral.triggerState.getTotalRevolutionCounter()); ASSERT_TRUE((totalRevolutionCountBeforeVvtSync % SYMMETRICAL_CRANK_SENSOR_DIVIDER) != 0); - eth.moveTimeForwardUs(MS2US(3)); // shifting VVT phase a few anlges + eth.moveTimeForwardUs(MS2US(3)); // shifting VVT phase a few angles // this would be ignored since we only consume the other kind of fronts here hwHandleVvtCamSignal(TV_FALL, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);