refactoring: code duplication
This commit is contained in:
parent
bb9aaeb1ca
commit
1eb5d7f927
|
@ -26,9 +26,8 @@ static void plainPinTurnOff(NamedOutputPin *output) {
|
||||||
output->setLow();
|
output->setLow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void auxPlainPinTurnOn(AuxActor *current) {
|
|
||||||
NamedOutputPin *output = &enginePins.auxValve[current->valveIndex];
|
static void scheduleOpen(AuxActor *current) {
|
||||||
output->setHigh();
|
|
||||||
|
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
Engine *engine = current->engine;
|
Engine *engine = current->engine;
|
||||||
|
@ -42,6 +41,18 @@ void auxPlainPinTurnOn(AuxActor *current) {
|
||||||
{ auxPlainPinTurnOn, current }
|
{ auxPlainPinTurnOn, current }
|
||||||
PASS_ENGINE_PARAMETER_SUFFIX
|
PASS_ENGINE_PARAMETER_SUFFIX
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void auxPlainPinTurnOn(AuxActor *current) {
|
||||||
|
NamedOutputPin *output = &enginePins.auxValve[current->valveIndex];
|
||||||
|
output->setHigh();
|
||||||
|
|
||||||
|
#if EFI_UNIT_TEST
|
||||||
|
Engine *engine = current->engine;
|
||||||
|
EXPAND_Engine;
|
||||||
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
scheduleOpen(current);
|
||||||
|
|
||||||
angle_t duration = engine->engineState.auxValveEnd - engine->engineState.auxValveStart;
|
angle_t duration = engine->engineState.auxValveEnd - engine->engineState.auxValveStart;
|
||||||
|
|
||||||
|
@ -78,14 +89,7 @@ void initAuxValves(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
actor->extra = phaseIndex * 360 + valveIndex * 180;
|
actor->extra = phaseIndex * 360 + valveIndex * 180;
|
||||||
|
|
||||||
INJECT_ENGINE_REFERENCE(actor);
|
INJECT_ENGINE_REFERENCE(actor);
|
||||||
|
scheduleOpen(actor);
|
||||||
scheduleOrQueue(&actor->open,
|
|
||||||
TRIGGER_EVENT_UNDEFINED,
|
|
||||||
getTimeNowNt(),
|
|
||||||
actor->extra + engine->engineState.auxValveStart,
|
|
||||||
{ auxPlainPinTurnOn, actor }
|
|
||||||
PASS_ENGINE_PARAMETER_SUFFIX
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue