From 841875fb94a78cf271670579e2981350ead50abb Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 13 Jul 2021 15:27:27 -0400 Subject: [PATCH] NB2 hellen-72-rev-d something is off #2958 --- unit_tests/logicdata_csv_reader.cpp | 19 +++++++++++++++++++ unit_tests/logicdata_csv_reader.h | 1 + 2 files changed, 20 insertions(+) diff --git a/unit_tests/logicdata_csv_reader.cpp b/unit_tests/logicdata_csv_reader.cpp index 9068b037cf..9ecf289591 100644 --- a/unit_tests/logicdata_csv_reader.cpp +++ b/unit_tests/logicdata_csv_reader.cpp @@ -42,6 +42,7 @@ void CsvReader::processLine(EngineTestHelper *eth) { char *timeStampstr = trim(strtok(line, s)); bool newState[2]; + bool newVvtState[CAM_INPUTS_COUNT]; char *firstToken = trim(strtok(NULL, s)); char *secondToken = trim(strtok(NULL, s)); @@ -55,6 +56,11 @@ void CsvReader::processLine(EngineTestHelper *eth) { newState[columnIndeces[1]] = secondToken[0] == '1'; } + // todo: start reading states much smarter, start reading all 4 cam channels! + if (m_vvtCount > 0) { + newVvtState[0] = secondToken[0] == '1'; + } + double timeStamp = std::stod(timeStampstr); timeStamp += m_timestampOffset; @@ -70,6 +76,19 @@ void CsvReader::processLine(EngineTestHelper *eth) { currentState[index] = newState[index]; } + + for (int vvtIndex = 0; vvtIndex < m_vvtCount ; vvtIndex++) { + if (currentVvtState[vvtIndex] == newVvtState[vvtIndex]) { + continue; + } + + efitick_t nowNt = getTimeNowNt(); + trigger_value_e event = newVvtState[vvtIndex] ? TV_RISE : TV_FALL; + hwHandleVvtCamSignal(event, nowNt, vvtIndex PASS_ENGINE_PARAMETER_SUFFIX); + + currentVvtState[vvtIndex] == newVvtState[vvtIndex]; + + } } void CsvReader::readLine(EngineTestHelper *eth) { diff --git a/unit_tests/logicdata_csv_reader.h b/unit_tests/logicdata_csv_reader.h index 045458f082..041a70ee68 100644 --- a/unit_tests/logicdata_csv_reader.h +++ b/unit_tests/logicdata_csv_reader.h @@ -32,6 +32,7 @@ private: char buffer[255]; bool currentState[2]; + bool currentVvtState[CAM_INPUTS_COUNT]; int m_lineIndex = -1;