Nissan progress

This commit is contained in:
Andrey 2021-07-02 18:33:32 -04:00
parent 7d7115d0d7
commit 0d7c0a7f50
1 changed files with 13 additions and 8 deletions

View File

@ -28,26 +28,32 @@ void func(TriggerCallback *callback) {
signal = SHAFT_PRIMARY_FALLING; signal = SHAFT_PRIMARY_FALLING;
} }
efitick_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
engine->triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING, nowNt PASS_ENGINE_PARAMETER_SUFFIX); engine->triggerCentral.handleShaftSignal(signal, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
} }
TEST(nissan, vq_vvt) { TEST(nissan, vq_vvt) {
WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN); WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN);
engineConfiguration->isIgnitionEnabled = false;
engineConfiguration->isInjectionEnabled = false;
{ {
static TriggerWaveform crank;
TriggerWaveform crank;
initializeNissanVQcrank(&crank); initializeNissanVQcrank(&crank);
int totalIndex = 0; int totalIndex = 0;
/**
* yet another approach to trigger testing: let's schedule a huge list of events from heap
* and then execute those one
*/
for (int r = 0; r < 20; r++) { for (int r = 0; r < 20; r++) {
for (int i = 0; i < crank.getSize(); i++) { for (int i = 0; i < crank.getSize(); i++) {
float angle = crank.getAngle(totalIndex); float angle = crank.getAngle(totalIndex);
TriggerCallback *param = new TriggerCallback(); TriggerCallback *param = new TriggerCallback();
param->engine = engine; param->engine = engine;
param->index = totalIndex; param->index = totalIndex;
param->form = &crank;
scheduling_s *sch = new scheduling_s(); scheduling_s *sch = new scheduling_s();
engine->executor.scheduleByTimestamp(sch, 1000 * angle, { func, param }); engine->executor.scheduleByTimestamp(sch, 1000 * angle, { func, param });
@ -56,11 +62,10 @@ TEST(nissan, vq_vvt) {
} }
} }
for (int r = 0; r < 20 * 720; r++) { scheduling_s *head;
// eth.moveTimeForwardMs(1); while ((head = engine->executor.getHead()) != nullptr) {
// eth.executeActions(); eth.setTimeAndInvokeEventsUs(head->momentX);
} }
ASSERT_EQ(0, GET_RPM());
ASSERT_EQ(250, GET_RPM());
} }