Nissan progress

This commit is contained in:
Andrey 2021-07-02 19:57:26 -04:00
parent 00ea760979
commit 1660a5b3fd
2 changed files with 6 additions and 8 deletions

View File

@ -150,10 +150,6 @@ size_t TriggerWaveform::getLength() const {
}
angle_t TriggerWaveform::getAngle(int index) const {
// todo: why is this check here? looks like the code below could be used universally
if (operationMode == FOUR_STROKE_CAM_SENSOR) {
return getSwitchAngle(index);
}
/**
* FOUR_STROKE_CRANK_SENSOR magic:
* We have two crank shaft revolutions for each engine cycle

View File

@ -32,14 +32,14 @@ void func(TriggerCallback *callback) {
}
static void scheduleTriggerEvents(TriggerWaveform *shape, bool isVvt DECLARE_ENGINE_PARAMETER_SUFFIX) {
static void scheduleTriggerEvents(TriggerWaveform *shape, int count, bool isVvt DECLARE_ENGINE_PARAMETER_SUFFIX) {
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 < count; r++) {
for (int i = 0; i < shape->getSize(); i++) {
float angle = shape->getAngle(totalIndex);
TriggerCallback *param = new TriggerCallback();
@ -61,18 +61,20 @@ TEST(nissan, vq_vvt) {
engineConfiguration->isIgnitionEnabled = false;
engineConfiguration->isInjectionEnabled = false;
int cyclesCount = 12;
{
static TriggerWaveform crank;
initializeNissanVQcrank(&crank);
scheduleTriggerEvents(&crank, false PASS_ENGINE_PARAMETER_SUFFIX);
scheduleTriggerEvents(&crank, cyclesCount, false PASS_ENGINE_PARAMETER_SUFFIX);
}
{
static TriggerWaveform vvt;
initializeNissanVQvvt(&vvt);
scheduleTriggerEvents(&vvt, true PASS_ENGINE_PARAMETER_SUFFIX);
scheduleTriggerEvents(&vvt, cyclesCount / 6, true PASS_ENGINE_PARAMETER_SUFFIX);
}