fome-fw/unit_tests/tests/trigger/test_2jz_vvt.cpp

37 lines
1011 B
C++
Raw Normal View History

2020-05-09 22:21:54 -07:00
/*
* @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
2021-01-31 19:24:45 -08:00
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt(), 0 PASS_ENGINE_PARAMETER_SUFFIX);
2020-05-09 22:21:54 -07:00
2020-05-10 15:03:11 -07:00
// currentPosition
ASSERT_NEAR(608.2 - 720, engine->triggerCentral.currentVVTEventPosition, EPS3D);
2020-05-09 22:21:54 -07:00
}