Injection/Ignition angle inaccuracy on 60-2? EngineSniffer vs Real Hardware #778

only renaming methods
This commit is contained in:
rusefi 2019-05-07 17:10:47 -04:00
parent 61231fb1af
commit 5f70acab9f
3 changed files with 9 additions and 9 deletions

View File

@ -30,7 +30,7 @@ int isIgnitionTimingError(void) {
return ignitionErrorDetection.sum(6) > 4; return ignitionErrorDetection.sum(6) > 4;
} }
static void turnSparkPinLow2(IgnitionEvent *event, IgnitionOutputPin *output) { static void fireSparkBySettingPinLow(IgnitionEvent *event, IgnitionOutputPin *output) {
#if SPARK_EXTREME_LOGGING #if SPARK_EXTREME_LOGGING
scheduleMsg(logger, "spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(), scheduleMsg(logger, "spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
output->currentLogicValue, output->outOfOrder, event->sparkId); output->currentLogicValue, output->outOfOrder, event->sparkId);
@ -107,11 +107,11 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngle, IgnitionEvent *e
#endif /* FUEL_MATH_EXTREME_LOGGING */ #endif /* FUEL_MATH_EXTREME_LOGGING */
} }
void turnSparkPinLow(IgnitionEvent *event) { void fireSparkAndPrepareNextSchedule(IgnitionEvent *event) {
for (int i = 0; i< MAX_OUTPUTS_FOR_IGNITION;i++) { for (int i = 0; i< MAX_OUTPUTS_FOR_IGNITION;i++) {
IgnitionOutputPin *output = event->outputs[i]; IgnitionOutputPin *output = event->outputs[i];
if (output != NULL) { if (output != NULL) {
turnSparkPinLow2(event, output); fireSparkBySettingPinLow(event, output);
} }
} }
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
@ -128,7 +128,7 @@ void turnSparkPinLow(IgnitionEvent *event) {
prepareCylinderIgnitionSchedule(dwellAngle, event PASS_ENGINE_PARAMETER_SUFFIX); prepareCylinderIgnitionSchedule(dwellAngle, event PASS_ENGINE_PARAMETER_SUFFIX);
} }
static void turnSparkPinHigh2(IgnitionEvent *event, IgnitionOutputPin *output) { static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutputPin *output) {
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
if (GET_RPM_VALUE > 2 * engineConfiguration->cranking.rpm) { if (GET_RPM_VALUE > 2 * engineConfiguration->cranking.rpm) {
@ -166,7 +166,7 @@ void turnSparkPinHigh(IgnitionEvent *event) {
for (int i = 0; i< MAX_OUTPUTS_FOR_IGNITION;i++) { for (int i = 0; i< MAX_OUTPUTS_FOR_IGNITION;i++) {
IgnitionOutputPin *output = event->outputs[i]; IgnitionOutputPin *output = event->outputs[i];
if (output != NULL) { if (output != NULL) {
turnSparkPinHigh2(event, output); startDwellByTurningSparkPinHigh(event, output);
} }
} }
} }
@ -261,7 +261,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs, iEvent->sparkId); scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs, iEvent->sparkId);
#endif /* FUEL_MATH_EXTREME_LOGGING */ #endif /* FUEL_MATH_EXTREME_LOGGING */
engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent); engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, (schfunc_t) &fireSparkAndPrepareNextSchedule, iEvent);
} else { } else {
#if SPARK_EXTREME_LOGGING #if SPARK_EXTREME_LOGGING
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), iEvent->sparkPosition.eventIndex); scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), iEvent->sparkPosition.eventIndex);
@ -350,7 +350,7 @@ static void scheduleAllSparkEventsUntilNextTriggerTooth(uint32_t trgEventIndex D
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * current->sparkPosition.angleOffset; float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * current->sparkPosition.angleOffset;
engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, current); engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, (schfunc_t) &fireSparkAndPrepareNextSchedule, current);
} }
} }
} }

View File

@ -14,7 +14,7 @@ int isInjectionEnabled(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void onTriggerEventSparkLogic(bool limitedSpark, uint32_t trgEventIndex, int rpm DECLARE_ENGINE_PARAMETER_SUFFIX); void onTriggerEventSparkLogic(bool limitedSpark, uint32_t trgEventIndex, int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
void initSparkLogic(Logging *sharedLogger); void initSparkLogic(Logging *sharedLogger);
void turnSparkPinHigh(IgnitionEvent *event); void turnSparkPinHigh(IgnitionEvent *event);
void turnSparkPinLow(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);

View File

@ -356,7 +356,7 @@ TEST(misc, testRpmCalculator) {
assertEqualsLM("coil 0", (long)&enginePins.coils[0], (long)((IgnitionEvent*)ev0->param)->outputs[0]); assertEqualsLM("coil 0", (long)&enginePins.coils[0], (long)((IgnitionEvent*)ev0->param)->outputs[0]);
scheduling_s *ev1 = engine->executor.getForUnitTest(1); scheduling_s *ev1 = engine->executor.getForUnitTest(1);
assertREqualsM("Call@1", (void*)ev1->callback, (void*)turnSparkPinLow); assertREqualsM("Call@1", (void*)ev1->callback, (void*)fireSparkAndPrepareNextSchedule);
assertEqualsM("ev 1", start + 1444, ev1->momentX); assertEqualsM("ev 1", start + 1444, ev1->momentX);
assertEqualsLM("coil 1", (long)&enginePins.coils[0], (long)((IgnitionEvent*)ev1->param)->outputs[0]); assertEqualsLM("coil 1", (long)&enginePins.coils[0], (long)((IgnitionEvent*)ev1->param)->outputs[0]);