v12 done right
This commit is contained in:
parent
1f1f7e86ae
commit
ebe6a4b981
|
@ -81,10 +81,11 @@ void setEngineBMW_M73(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
|
|
||||||
|
|
||||||
engineConfiguration->ignitionMode = IM_TWO_COILS;
|
engineConfiguration->ignitionMode = IM_TWO_COILS;
|
||||||
boardConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G
|
boardConfiguration->ignitionPins[ID2INDEX(1)] = GPIOE_14; // Frankenso high side - pin 1G
|
||||||
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
|
boardConfiguration->ignitionPins[ID2INDEX(2)] = GPIO_UNASSIGNED;
|
||||||
boardConfiguration->ignitionPins[2] = GPIOC_7; // Frankenso high side - pin 1H
|
boardConfiguration->ignitionPins[ID2INDEX(3)] = GPIO_UNASSIGNED;
|
||||||
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
|
boardConfiguration->ignitionPins[ID2INDEX(4)] = GPIO_UNASSIGNED;
|
||||||
|
boardConfiguration->ignitionPins[ID2INDEX(7)] = GPIOC_7; // Frankenso high side - pin 1H
|
||||||
|
|
||||||
|
|
||||||
boardConfiguration->injectionPins[0] = GPIOB_8;
|
boardConfiguration->injectionPins[0] = GPIOB_8;
|
||||||
|
|
|
@ -326,7 +326,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initializeIgnitionActions(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void initializeIgnitionActions(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
IgnitionEventList *list = &engine->ignitionEvents;
|
IgnitionEventList *list = &engine->ignitionEvents;
|
||||||
angle_t dwellAngle = ENGINE(engineState.dwellAngle);
|
angle_t dwellAngle = ENGINE(engineState.dwellAngle);
|
||||||
floatms_t sparkDwell = ENGINE(engineState.sparkDwell);
|
floatms_t sparkDwell = ENGINE(engineState.sparkDwell);
|
||||||
|
|
|
@ -17,5 +17,6 @@ void turnSparkPinHigh(IgnitionEvent *event);
|
||||||
void fireSparkAndPrepareNextSchedule(IgnitionEvent *event);
|
void fireSparkAndPrepareNextSchedule(IgnitionEvent *event);
|
||||||
int getNumberOfSparks(ignition_mode_e mode DECLARE_ENGINE_PARAMETER_SUFFIX);
|
int getNumberOfSparks(ignition_mode_e mode DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
percent_t getCoilDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
percent_t getCoilDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
void initializeIgnitionActions(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
#endif /* CONTROLLERS_TRIGGER_SPARK_LOGIC_H_ */
|
#endif /* CONTROLLERS_TRIGGER_SPARK_LOGIC_H_ */
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* @file test_ignition_scheduling.cpp
|
||||||
|
*
|
||||||
|
* @date Nov 17, 2019
|
||||||
|
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "engine_test_helper.h"
|
||||||
|
#include "spark_logic.h"
|
||||||
|
|
||||||
|
extern EnginePins enginePins;
|
||||||
|
|
||||||
|
TEST(ignition, twoCoils) {
|
||||||
|
WITH_ENGINE_TEST_HELPER(BMW_M73);
|
||||||
|
|
||||||
|
// first one to fire uses first coil
|
||||||
|
ASSERT_EQ(ENGINE(ignitionPin[ID2INDEX(1)]), 0);
|
||||||
|
ASSERT_EQ(ENGINE(ignitionPin[ID2INDEX(2)]), 1);
|
||||||
|
ASSERT_EQ(ENGINE(ignitionPin[ID2INDEX(3)]), 0);
|
||||||
|
ASSERT_EQ(ENGINE(ignitionPin[ID2INDEX(4)]), 1);
|
||||||
|
|
||||||
|
ASSERT_EQ(ENGINE(ignitionPin[ID2INDEX(11)]), 0);
|
||||||
|
ASSERT_EQ(ENGINE(ignitionPin[ID2INDEX(12)]), 1);
|
||||||
|
|
||||||
|
// let's recalculate with zero timing so that we can focus on relation advance between cylinders
|
||||||
|
engine->engineState.timingAdvance = 0;
|
||||||
|
initializeIgnitionActions(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
|
ASSERT_EQ(engine->ignitionEvents.elements[0].advance, 0);
|
||||||
|
ASSERT_EQ((void*)engine->ignitionEvents.elements[0].outputs[0], (void*)&enginePins.coils[0]);
|
||||||
|
|
||||||
|
|
||||||
|
ASSERT_EQ(engine->ignitionEvents.elements[1].advance, 720 / 12);
|
||||||
|
ASSERT_EQ((void*)engine->ignitionEvents.elements[1].outputs[0], (void*)&enginePins.coils[6]);
|
||||||
|
|
||||||
|
ASSERT_EQ(engine->ignitionEvents.elements[3].advance, 3 * 720 / 12);
|
||||||
|
ASSERT_EQ((void*)engine->ignitionEvents.elements[3].outputs[0], (void*)&enginePins.coils[6]);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ TESTS_SRC_CPP = \
|
||||||
tests/test_trigger_decoder.cpp \
|
tests/test_trigger_decoder.cpp \
|
||||||
tests/test_trigger_noiseless.cpp \
|
tests/test_trigger_noiseless.cpp \
|
||||||
tests/test_issue_898.cpp \
|
tests/test_issue_898.cpp \
|
||||||
|
tests/test_ignition_scheduling.cpp \
|
||||||
tests/test_fuel_map.cpp \
|
tests/test_fuel_map.cpp \
|
||||||
tests/test_fuel_wall_wetting.cpp \
|
tests/test_fuel_wall_wetting.cpp \
|
||||||
tests/test_one_cylinder_logic.cpp \
|
tests/test_one_cylinder_logic.cpp \
|
||||||
|
|
Loading…
Reference in New Issue