Nissan progress

This commit is contained in:
Andrey 2021-07-02 17:32:29 -04:00
parent 1380be7c38
commit d18d4496d1
2 changed files with 55 additions and 3 deletions

View File

@ -8,7 +8,6 @@
#include "global_execution_queue.h"
bool_t debugSignalExecutor = false;
extern bool verboseMode;
TestExecutor::~TestExecutor() {
// Flush the queue and reset all scheduling_s at the end of a test's execution

View File

@ -6,8 +6,61 @@
*/
#include "engine_test_helper.h"
#include "trigger_nissan.h"
class TriggerCallback {
public:
Engine *engine;
int index;
TriggerWaveform *form;
};
void func(TriggerCallback *callback) {
int formIndex = callback->index % callback->form->getSize();
Engine *engine = callback->engine;
EXPAND_Engine;
int value = callback->form->wave.channels[0].getState(formIndex);
trigger_event_e signal;
if (value) {
signal = SHAFT_PRIMARY_RISING;
} else {
signal = SHAFT_PRIMARY_FALLING;
}
efitick_t nowNt = getTimeNowNt();
engine->triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
}
TEST(nissan, vq_vvt) {
WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN);
{
TriggerWaveform crank;
initializeNissanVQcrank(&crank);
int totalIndex = 0;
for (int r = 0; r < 20; r++) {
for (int i = 0; i < crank.getSize(); i++) {
float angle = crank.getAngle(totalIndex);
TriggerCallback *param = new TriggerCallback();
param->engine = engine;
param->index = totalIndex;
scheduling_s *sch = new scheduling_s();
engine->executor.scheduleByTimestamp(sch, 1000 * angle, { func, param });
totalIndex++;
}
}
}
for (int r = 0; r < 20 * 720; r++) {
// eth.moveTimeForwardMs(1);
// eth.executeActions();
}
ASSERT_EQ(0, GET_RPM());
TEST(nissan, vq_vvt) {
WITH_ENGINE_TEST_HELPER(HELLEN_121_NISSAN);
}