Nissan VVT trigger decoder #2887
This commit is contained in:
parent
2c7761801a
commit
24cfbeba35
|
@ -12,6 +12,9 @@ void setHellen121nissan(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
|
||||
engineConfiguration->vvtMode[0] = VVT_NISSAN_VQ;
|
||||
|
||||
// we have this here and not in board_configuration.cpp so that unit test would get this value
|
||||
engineConfiguration->invertCamVVTSignal = true;
|
||||
|
||||
engineConfiguration->vvtOffsets[0] = NISSAN_VQ_VVT_OFFSET;
|
||||
engineConfiguration->vvtOffsets[1 * CAMS_PER_BANK] = NISSAN_VQ_VVT_OFFSET - NISSAN_VQ_CAM_OFFSET;
|
||||
}
|
||||
|
|
|
@ -615,7 +615,7 @@ void TriggerState::decodeTriggerEvent(
|
|||
efiPrintf("index=%d NaN gap, you have noise issues?",
|
||||
i);
|
||||
} else {
|
||||
efiPrintf("%s rpm=%d time=%d eventIndex=%d gapIndex=%d: gap=%.3f expected from %.3f to %.3f error=%s",
|
||||
efiPrintf("%srpm=%d time=%d eventIndex=%d gapIndex=%d: gap=%.3f expected from %.3f to %.3f error=%s",
|
||||
triggerConfiguration.PrintPrefix,
|
||||
GET_RPM(),
|
||||
/* cast is needed to make sure we do not put 64 bit value to stack*/ (int)getTimeNowSeconds(),
|
||||
|
@ -633,7 +633,8 @@ void TriggerState::decodeTriggerEvent(
|
|||
float gap = 1.0 * toothDurations[0] / toothDurations[1];
|
||||
for (int i = 0;i<triggerShape.gapTrackingLength;i++) {
|
||||
float gap = 1.0 * toothDurations[i] / toothDurations[i + 1];
|
||||
printf("index=%d: gap=%.2f expected from %.2f to %.2f error=%s\r\n",
|
||||
printf("%sindex=%d: gap=%.2f expected from %.2f to %.2f error=%s\r\n",
|
||||
triggerConfiguration.PrintPrefix,
|
||||
i,
|
||||
gap,
|
||||
triggerShape.syncronizationRatioFrom[i],
|
||||
|
|
|
@ -72,6 +72,7 @@ void CsvReader::processLine(EngineTestHelper *eth) {
|
|||
}
|
||||
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
// todo: we invert VVT but we do not invert trigger input!!!
|
||||
hwHandleShaftSignal(index, newState[index], nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
currentState[index] = newState[index];
|
||||
|
@ -83,7 +84,7 @@ void CsvReader::processLine(EngineTestHelper *eth) {
|
|||
}
|
||||
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
trigger_value_e event = newVvtState[vvtIndex] ? TV_RISE : TV_FALL;
|
||||
trigger_value_e event = newVvtState[vvtIndex] ^ engineConfiguration->invertCamVVTSignal ? TV_RISE : TV_FALL;
|
||||
hwHandleVvtCamSignal(event, nowNt, vvtIndex PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
currentVvtState[vvtIndex] = newVvtState[vvtIndex];
|
||||
|
|
|
@ -8,6 +8,7 @@ TESTS_SRC_CPP = \
|
|||
tests/trigger/test_2jz_vvt.cpp \
|
||||
tests/trigger/test_real_cranking_miata_NA.cpp \
|
||||
tests/trigger/test_real_cranking_miata_na6.cpp \
|
||||
tests/trigger/test_real_cranking_nissan_vq40.cpp \
|
||||
tests/trigger/test_real_volkswagen.cpp \
|
||||
tests/trigger/test_real_nb2_cranking.cpp \
|
||||
tests/trigger/test_rpm_multiplier.cpp \
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* @file test_real_cranking_nissan_vq40.cpp
|
||||
*
|
||||
* @date Jul 21, 2021
|
||||
* @author Andrey Belomutskiy, (c) 2012-2021
|
||||
*/
|
||||
|
||||
#include "engine_test_helper.h"
|
||||
#include "logicdata_csv_reader.h"
|
||||
|
||||
TEST(realCrankingVQ40, normalCranking) {
|
||||
CsvReader reader(1, /* vvtCount */ 2);
|
||||
int indeces[] = {0};
|
||||
|
||||
reader.open("tests/trigger/resources/nissan_vq40_cranking-1.csv", indeces);
|
||||
WITH_ENGINE_TEST_HELPER (ET_HELLEN_121_NISSAN);
|
||||
|
||||
while (reader.haveMore()) {
|
||||
reader.processLine(ð);
|
||||
}
|
||||
|
||||
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);
|
||||
ASSERT_EQ(241, GET_RPM())<< reader.lineIndex();
|
||||
|
||||
}
|
|
@ -5,7 +5,6 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
|
||||
#include "engine_test_helper.h"
|
||||
#include "logicdata_csv_reader.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue