2020-05-09 22:21:54 -07:00
|
|
|
/*
|
|
|
|
* @file test_2jz_vvt.cpp
|
|
|
|
*
|
|
|
|
* Created on: May 10, 2020
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
|
|
|
*/
|
|
|
|
|
2021-08-03 19:05:01 -07:00
|
|
|
#include "pch.h"
|
2020-05-09 22:21:54 -07:00
|
|
|
|
|
|
|
TEST(sensors, test2jz) {
|
2021-11-16 13:52:11 -08:00
|
|
|
EngineTestHelper eth(TOYOTA_2JZ_GTE_VVTi);
|
2022-04-23 06:51:47 -07:00
|
|
|
engineConfiguration->isFasterEngineSpinUpEnabled = false;
|
2020-05-09 22:21:54 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
eth.setTriggerType(TT_ONE);
|
2020-05-09 22:21:54 -07:00
|
|
|
|
2022-01-20 19:58:12 -08:00
|
|
|
ASSERT_EQ( 0, Sensor::getOrZero(SensorType::Rpm)) << "test2jz RPM";
|
2021-11-20 22:01:27 -08:00
|
|
|
for (int i = 0; i < 2;i++) {
|
2022-10-05 17:48:28 -07:00
|
|
|
eth.fireRise(12.5);
|
|
|
|
eth.fireFall(12.5);
|
2022-01-20 19:58:12 -08:00
|
|
|
ASSERT_EQ( 0, Sensor::getOrZero(SensorType::Rpm)) << "test2jz RPM at " << i;
|
2020-05-09 22:21:54 -07:00
|
|
|
}
|
2022-10-05 17:48:28 -07:00
|
|
|
eth.fireRise(12.5);
|
|
|
|
eth.fireFall(12.5);
|
2020-05-09 22:21:54 -07:00
|
|
|
// first time we have RPM
|
2022-01-20 19:58:12 -08:00
|
|
|
ASSERT_EQ(2400, Sensor::getOrZero(SensorType::Rpm)) << "test2jz RPM";
|
2020-05-09 22:21:54 -07:00
|
|
|
|
|
|
|
|
|
|
|
eth.moveTimeForwardUs(MS2US(3)); // shifting VVT phase a few angles
|
|
|
|
|
2022-09-10 23:57:35 -07:00
|
|
|
hwHandleVvtCamSignal(TriggerValue::FALL, getTimeNowNt(), 0);
|
|
|
|
hwHandleVvtCamSignal(TriggerValue::RISE, getTimeNowNt(), 0);
|
2020-05-09 22:21:54 -07:00
|
|
|
|
2022-10-05 17:48:28 -07:00
|
|
|
// Expected angle is 12.5ms + 3ms of a 25ms revolution = 15.5/25 = 223.2 degrees from the sync point
|
|
|
|
// Minus 155 degree trigger offset = 68.2
|
|
|
|
ASSERT_NEAR(68.2f, engine->triggerCentral.currentVVTEventPosition[0][0], EPS3D);
|
2020-05-09 22:21:54 -07:00
|
|
|
}
|