Nissan VVT trigger decoder #2887

This commit is contained in:
Andrey 2021-07-21 23:24:23 -04:00
parent c75dd65b56
commit 783fd70cce
2 changed files with 8 additions and 4 deletions

View File

@ -84,7 +84,10 @@ void CsvReader::processLine(EngineTestHelper *eth) {
efitick_t nowNt = getTimeNowNt();
trigger_value_e event = newVvtState[vvtIndex] ^ engineConfiguration->invertCamVVTSignal ? TV_RISE : TV_FALL;
hwHandleVvtCamSignal(event, nowNt, vvtIndex PASS_ENGINE_PARAMETER_SUFFIX);
// todo: configurable selection of vvt mode - dual bank or dual cam single bank
int bankIndex = vvtIndex;
int camIndex = 0;
hwHandleVvtCamSignal(event, nowNt, bankIndex *2 + camIndex PASS_ENGINE_PARAMETER_SUFFIX);
currentVvtState[vvtIndex] = newVvtState[vvtIndex];

View File

@ -13,15 +13,16 @@ TEST(realCrankingVQ40, normalCranking) {
int indeces[] = {0};
reader.open("tests/trigger/resources/nissan_vq40_cranking-1.csv", indeces);
WITH_ENGINE_TEST_HELPER (ET_HELLEN_121_NISSAN);
WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN);
while (reader.haveMore()) {
reader.processLine(&eth);
}
EXPECT_NEAR(engine->triggerCentral.getVVTPosition(/*bankIndex*/0, /*camIndex*/0), -46.817, 1e-2);
// todo: read second channel
EXPECT_NEAR(engine->triggerCentral.getVVTPosition(/*bankIndex*/1, /*camIndex*/0), 0, 1e-2);
EXPECT_NEAR(engine->triggerCentral.getVVTPosition(/*bankIndex*/1, /*camIndex*/0), -47.411, 1e-2);
ASSERT_EQ(241, GET_RPM())<< reader.lineIndex();
// TODO: why warnings?
ASSERT_EQ(2, eth.recentWarnings()->getCount());
}