Trigger: warning code on normal engine start up #669
This commit is contained in:
parent
cbfc4cdd8d
commit
74c5a80cac
|
@ -6,12 +6,12 @@ TESTS_SRC_CPP = \
|
||||||
tests/trigger/test_cam_vvt_input.cpp \
|
tests/trigger/test_cam_vvt_input.cpp \
|
||||||
tests/trigger/test_2jz_vvt.cpp \
|
tests/trigger/test_2jz_vvt.cpp \
|
||||||
tests/trigger/test_real_cranking_miata_NA.cpp \
|
tests/trigger/test_real_cranking_miata_NA.cpp \
|
||||||
|
tests/trigger/test_real_cranking_miata_na6.cpp \
|
||||||
tests/trigger/test_quad_cam.cpp \
|
tests/trigger/test_quad_cam.cpp \
|
||||||
tests/trigger/test_override_gaps.cpp \
|
tests/trigger/test_override_gaps.cpp \
|
||||||
tests/trigger/test_injection_scheduling.cpp \
|
tests/trigger/test_injection_scheduling.cpp \
|
||||||
tests/ignition_injection/injection_mode_transition.cpp \
|
tests/ignition_injection/injection_mode_transition.cpp \
|
||||||
tests/ignition_injection/test_startOfCrankingPrimingPulse.cpp \
|
tests/ignition_injection/test_startOfCrankingPrimingPulse.cpp \
|
||||||
tests/ignition_injection/test_miata_na6_real_cranking.cpp \
|
|
||||||
tests/ignition_injection/test_multispark.cpp \
|
tests/ignition_injection/test_multispark.cpp \
|
||||||
tests/ignition_injection/test_ignition_scheduling.cpp \
|
tests/ignition_injection/test_ignition_scheduling.cpp \
|
||||||
tests/ignition_injection/test_fuelCut.cpp \
|
tests/ignition_injection/test_fuelCut.cpp \
|
||||||
|
|
|
@ -5,17 +5,31 @@
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2021
|
* @author Andrey Belomutskiy, (c) 2012-2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#include "engine_test_helper.h"
|
#include "engine_test_helper.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
TEST(cranking, realNA) {
|
static constexpr trigger_event_e riseEvents[] = { SHAFT_PRIMARY_RISING, SHAFT_SECONDARY_RISING, SHAFT_3RD_RISING };
|
||||||
|
static constexpr trigger_event_e fallEvents[] = { SHAFT_PRIMARY_FALLING, SHAFT_SECONDARY_FALLING, SHAFT_3RD_FALLING };
|
||||||
|
|
||||||
|
static char* trim(char*str) {
|
||||||
|
while (str != nullptr && str[0] == ' ') {
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(cranking, realCrankingFromFile) {
|
||||||
FILE *fp = fopen("tests/trigger/recourses/cranking_na_3.csv", "r");
|
FILE *fp = fopen("tests/trigger/recourses/cranking_na_3.csv", "r");
|
||||||
|
ASSERT_TRUE(fp != nullptr);
|
||||||
|
|
||||||
|
WITH_ENGINE_TEST_HELPER(MIATA_NA6_MAP);
|
||||||
|
|
||||||
ssize_t read;
|
ssize_t read;
|
||||||
|
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
|
|
||||||
|
bool currentState[2];
|
||||||
|
|
||||||
int index = -1;
|
int index = -1;
|
||||||
while (fgets(buffer, sizeof(buffer), fp)) {
|
while (fgets(buffer, sizeof(buffer), fp)) {
|
||||||
index++;
|
index++;
|
||||||
|
@ -26,19 +40,26 @@ TEST(cranking, realNA) {
|
||||||
const char s[2] = ",";
|
const char s[2] = ",";
|
||||||
char *line = buffer;
|
char *line = buffer;
|
||||||
|
|
||||||
char *token;
|
char *timeStampstr = trim(strtok(line, s));
|
||||||
|
bool newState[2];
|
||||||
|
newState[0] = trim(strtok(NULL, s))[0] == '1';
|
||||||
|
newState[1] = trim(strtok(NULL, s))[0] == '1';
|
||||||
|
|
||||||
/* get the first token */
|
double timeStamp = std::stod(timeStampstr);
|
||||||
token = strtok(line, s);
|
|
||||||
|
|
||||||
/* walk through other tokens */
|
eth.setTimeAndInvokeEventsUs(1'000'000 * timeStamp);
|
||||||
while (token != NULL) {
|
for (int index = 0;index <2;index ++) {
|
||||||
// printf(" %s\n", token);
|
if (currentState[index] == newState[index]) {
|
||||||
|
continue;
|
||||||
token = strtok(NULL, s);
|
|
||||||
}
|
}
|
||||||
|
trigger_event_e event = (newState[index] ? riseEvents : fallEvents)[index];
|
||||||
|
efitick_t nowNt = getTimeNowNt();
|
||||||
|
// engine->triggerCentral.handleShaftSignal(event, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
currentState[index] = newState[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_TRUE(fp != nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* test_miata_na6_real_cranking.cpp
|
* test_real_cranking_miata_na6.cpp
|
||||||
*
|
*
|
||||||
* @date May 11, 2019
|
* @date May 11, 2019
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||||
|
@ -32,14 +32,14 @@ static void fireTriggerEvent(EngineTestHelper*eth, double timestampS, int channe
|
||||||
engine->triggerCentral.handleShaftSignal(event, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
engine->triggerCentral.handleShaftSignal(event, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(miataNA6, realCranking) {
|
TEST(cranking, hardcodedRealCranking) {
|
||||||
WITH_ENGINE_TEST_HELPER(MIATA_NA6_VAF);
|
WITH_ENGINE_TEST_HELPER(MIATA_NA6_VAF);
|
||||||
|
unitTestWarningCodeState.clear();
|
||||||
|
|
||||||
#define EVENT(timestamp, channel, value) { fireTriggerEvent(ð, timestamp, channel, value); }
|
#define EVENT(timestamp, channel, value) { fireTriggerEvent(ð, timestamp, channel, value); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* generates using logicdata2c tool
|
* Generated using logicdata2c tool
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* 3 */ EVENT(/* timestamp*/0.597303, /*index*/0, /*value*/false);
|
/* 3 */ EVENT(/* timestamp*/0.597303, /*index*/0, /*value*/false);
|
Loading…
Reference in New Issue