From 3a7f719d5c2b4e3789f4079631f2586b11c9f3c6 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 24 Dec 2018 23:23:45 -0500 Subject: [PATCH] #635 --- .../trigger/decoders/trigger_mazda.cpp | 24 +++++++++---------- .../controllers/trigger/trigger_structure.cpp | 2 +- .../controllers/trigger/trigger_structure.h | 2 +- unit_tests/engine_test_helper.cpp | 4 ++-- unit_tests/test_fuel_map.cpp | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/firmware/controllers/trigger/decoders/trigger_mazda.cpp b/firmware/controllers/trigger/decoders/trigger_mazda.cpp index b41edb9077..d58daaa83a 100644 --- a/firmware/controllers/trigger/decoders/trigger_mazda.cpp +++ b/firmware/controllers/trigger/decoders/trigger_mazda.cpp @@ -33,21 +33,21 @@ void initializeMazdaMiataNaShape(TriggerShape *s, bool useOnlyRisingEdgeForTrigg /** * http://rusefi.com/forum/viewtopic.php?f=3&t=729&p=12983#p12983 */ - s->addEvent(52.960405 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_RISE); - s->addEvent(122.635956 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_FALL); + s->addEvent(useOnlyRisingEdgeForTrigger, 52.960405 / 720, T_SECONDARY, TV_RISE); + s->addEvent(useOnlyRisingEdgeForTrigger, 122.635956 / 720, T_SECONDARY, TV_FALL); - s->addEvent(216.897031 / 720, useOnlyRisingEdgeForTrigger, T_PRIMARY, TV_RISE); - s->addEvent(232.640068 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_RISE); - s->addEvent(288.819688 / 720, useOnlyRisingEdgeForTrigger, T_PRIMARY, TV_FALL); - s->addEvent(302.646323 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_FALL); + s->addEvent(useOnlyRisingEdgeForTrigger, 216.897031 / 720, T_PRIMARY, TV_RISE); + s->addEvent(useOnlyRisingEdgeForTrigger, 232.640068 / 720, T_SECONDARY, TV_RISE); + s->addEvent(useOnlyRisingEdgeForTrigger, 288.819688 / 720, T_PRIMARY, TV_FALL); + s->addEvent(useOnlyRisingEdgeForTrigger, 302.646323 / 720, T_SECONDARY, TV_FALL); - s->addEvent(412.448056 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_RISE); - s->addEvent(482.816719 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_FALL); + s->addEvent(useOnlyRisingEdgeForTrigger, 412.448056 / 720, T_SECONDARY, TV_RISE); + s->addEvent(useOnlyRisingEdgeForTrigger, 482.816719 / 720, T_SECONDARY, TV_FALL); - s->addEvent(577.035495 / 720, useOnlyRisingEdgeForTrigger, T_PRIMARY, TV_RISE); - s->addEvent(592.878113 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_RISE); - s->addEvent(662.899708 / 720, useOnlyRisingEdgeForTrigger, T_SECONDARY, TV_FALL); - s->addEvent(720.0f / 720, useOnlyRisingEdgeForTrigger, T_PRIMARY, TV_FALL); + s->addEvent(useOnlyRisingEdgeForTrigger, 577.035495 / 720, T_PRIMARY, TV_RISE); + s->addEvent(useOnlyRisingEdgeForTrigger, 592.878113 / 720, T_SECONDARY, TV_RISE); + s->addEvent(useOnlyRisingEdgeForTrigger, 662.899708 / 720, T_SECONDARY, TV_FALL); + s->addEvent(useOnlyRisingEdgeForTrigger, 720.0f / 720, T_PRIMARY, TV_FALL); s->useOnlyPrimaryForSync = true; } diff --git a/firmware/controllers/trigger/trigger_structure.cpp b/firmware/controllers/trigger/trigger_structure.cpp index 0535f0a615..9357be0cea 100644 --- a/firmware/controllers/trigger/trigger_structure.cpp +++ b/firmware/controllers/trigger/trigger_structure.cpp @@ -314,7 +314,7 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri // todo: the whole 'useOnlyRisingEdgeForTrigger' parameter and logic should not be here // todo: see calculateExpectedEventCounts // related calculation should be done once trigger is initialized outside of trigger shape scope -void TriggerShape::addEvent(angle_t angle, bool useOnlyRisingEdgeForTrigger, trigger_wheel_e const waveIndex, trigger_value_e const stateParam) { +void TriggerShape::addEvent(bool useOnlyRisingEdgeForTrigger, angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam) { efiAssertVoid(CUSTOM_OMODE_UNDEF, operationMode != OM_NONE, "operationMode not set"); diff --git a/firmware/controllers/trigger/trigger_structure.h b/firmware/controllers/trigger/trigger_structure.h index 7ff3861de0..bafe024c86 100644 --- a/firmware/controllers/trigger/trigger_structure.h +++ b/firmware/controllers/trigger/trigger_structure.h @@ -175,7 +175,7 @@ public: */ int privateTriggerDefinitionSize; - void addEvent(angle_t angle, bool useOnlyRisingEdgeForTrigger, trigger_wheel_e const waveIndex, trigger_value_e const state); + void addEvent(bool useOnlyRisingEdgeForTrigger, angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const state); void addEvent2(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const state DECLARE_ENGINE_PARAMETER_SUFFIX); void addEvent2(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam, float filterLeft, float filterRight DECLARE_ENGINE_PARAMETER_SUFFIX); diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp index c917be3a0f..b44d3d8c36 100644 --- a/unit_tests/engine_test_helper.cpp +++ b/unit_tests/engine_test_helper.cpp @@ -64,7 +64,7 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persiste engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE); prepareTimingMap(PASS_ENGINE_PARAMETER_SIGNATURE); - TRIGGER_SHAPE(initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX)); + TRIGGER_SHAPE(initializeTriggerShape(NULL, false PASS_ENGINE_PARAMETER_SUFFIX)); engine->triggerCentral.addEventListener(rpmShaftPositionCallback, "rpm reporter", engine); engine->triggerCentral.addEventListener(mainTriggerCallback, "main loop", engine); resetTriggerConfigChangedForUnitTest(); @@ -120,7 +120,7 @@ void EngineTestHelper::applyTriggerShape() { Engine *engine = &this->engine; EXPAND_Engine - TRIGGER_SHAPE(initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX)); + TRIGGER_SHAPE(initializeTriggerShape(NULL, false PASS_ENGINE_PARAMETER_SUFFIX)); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); } diff --git a/unit_tests/test_fuel_map.cpp b/unit_tests/test_fuel_map.cpp index 388addccc8..547e3e6387 100644 --- a/unit_tests/test_fuel_map.cpp +++ b/unit_tests/test_fuel_map.cpp @@ -170,7 +170,7 @@ void testAngleResolver(void) { engineConfiguration->globalTriggerAngleOffset = 175; TriggerShape * ts = &engine->triggerCentral.triggerShape; - ts->initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX); + ts->initializeTriggerShape(NULL, false PASS_ENGINE_PARAMETER_SUFFIX); assertEqualsM("index 2", 52.76, ts->eventAngles[3]); // this angle is relation to synch point assertEqualsM("time 2", 0.3233, ts->wave.getSwitchTime(2));