Output pin init/deinit needs a linked list #1803
This commit is contained in:
parent
148f9494f2
commit
2c322006d8
|
@ -161,13 +161,10 @@ void initAlternatorCtrl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
if (CONFIG(alternatorControlPin) == GPIO_UNASSIGNED)
|
||||
return;
|
||||
|
||||
if (CONFIG(onOffAlternatorLogic)) {
|
||||
enginePins.alternatorPin.initPin("Alternator control", CONFIG(alternatorControlPin));
|
||||
} else {
|
||||
startSimplePwmExt(&alternatorControl,
|
||||
if (!CONFIG(onOffAlternatorLogic)) {
|
||||
startSimplePwm(&alternatorControl,
|
||||
"Alternator control",
|
||||
&engine->executor,
|
||||
CONFIG(alternatorControlPin),
|
||||
&enginePins.alternatorPin,
|
||||
engineConfiguration->alternatorPwmFrequency, 0.1, (pwm_gen_callback*)applyAlternatorPinState);
|
||||
}
|
||||
|
|
|
@ -187,11 +187,10 @@ void startBoostPin() {
|
|||
return;
|
||||
}
|
||||
|
||||
startSimplePwmExt(
|
||||
startSimplePwm(
|
||||
&boostPwmControl,
|
||||
"Boost",
|
||||
&engine->executor,
|
||||
CONFIG(boostControlPin),
|
||||
&enginePins.boostPin,
|
||||
engineConfiguration->boostPwmFrequency,
|
||||
0.5f
|
||||
|
|
|
@ -735,21 +735,21 @@ void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
// todo: even for double-solenoid mode we can probably use same single SimplePWM
|
||||
// todo: open question why do we pass 'OutputPin' into 'startSimplePwmExt' if we have custom applyIdleSolenoidPinState listener anyway?
|
||||
if (!CONFIG(isDoubleSolenoidIdle)) {
|
||||
startSimplePwmExt(&idleSolenoidOpen, "Idle Valve",
|
||||
startSimplePwm(&idleSolenoidOpen, "Idle Valve",
|
||||
&engine->executor,
|
||||
CONFIG(idle).solenoidPin, &enginePins.idleSolenoidPin,
|
||||
&enginePins.idleSolenoidPin,
|
||||
CONFIG(idle).solenoidFrequency, PERCENT_TO_DUTY(CONFIG(manIdlePosition)),
|
||||
(pwm_gen_callback*)applyIdleSolenoidPinState);
|
||||
} else {
|
||||
startSimplePwmExt(&idleSolenoidOpen, "Idle Valve Open",
|
||||
startSimplePwm(&idleSolenoidOpen, "Idle Valve Open",
|
||||
&engine->executor,
|
||||
CONFIG(idle).solenoidPin, &enginePins.idleSolenoidPin,
|
||||
&enginePins.idleSolenoidPin,
|
||||
CONFIG(idle).solenoidFrequency, PERCENT_TO_DUTY(CONFIG(manIdlePosition)),
|
||||
(pwm_gen_callback*)applyIdleSolenoidPinState);
|
||||
|
||||
startSimplePwmExt(&idleSolenoidClose, "Idle Valve Close",
|
||||
startSimplePwm(&idleSolenoidClose, "Idle Valve Close",
|
||||
&engine->executor,
|
||||
CONFIG(secondSolenoidPin), &enginePins.secondIdleSolenoidPin,
|
||||
&enginePins.secondIdleSolenoidPin,
|
||||
CONFIG(idle).solenoidFrequency, PERCENT_TO_DUTY(CONFIG(manIdlePosition)),
|
||||
(pwm_gen_callback*)applyIdleSolenoidPinState);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ void RegisteredOutputPin::unregister() {
|
|||
|
||||
|
||||
EnginePins::EnginePins() :
|
||||
mainRelay("mainRelay", CONFIG_OFFSET(mainRelayPin), CONFIG_OFFSET(mainRelayPinMode)),
|
||||
mainRelay("mainRelay", CONFIG_PIN_OFFSETS(mainRelay)),
|
||||
starterControl("starterControl", CONFIG_PIN_OFFSETS(starterControl)),
|
||||
starterRelayDisable("starterRelayDisable", CONFIG_PIN_OFFSETS(starterRelayDisable)),
|
||||
fanRelay("fanRelay", CONFIG_PIN_OFFSETS(fan)),
|
||||
|
@ -423,16 +423,23 @@ void initOutputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
enginePins.sdCsPin.initPin("SD CS", CONFIG(sdCardCsPin));
|
||||
#endif /* HAL_USE_SPI */
|
||||
|
||||
// todo: should we move this code closer to the fuel pump logic?
|
||||
enginePins.fuelPumpRelay.initPin("Fuel pump", CONFIG(fuelPumpPin), &CONFIG(fuelPumpPinMode));
|
||||
|
||||
enginePins.mainRelay.initPin("Main relay", CONFIG(mainRelayPin), &CONFIG(mainRelayPinMode));
|
||||
enginePins.starterRelayDisable.initPin("Starter disable", CONFIG(starterRelayDisablePin), &CONFIG(starterRelayDisablePinMode));
|
||||
enginePins.starterControl.initPin("Starter control", CONFIG(starterControlPin));
|
||||
|
||||
enginePins.fanRelay.initPin("Fan", CONFIG(fanPin), &CONFIG(fanPinMode));
|
||||
enginePins.o2heater.initPin("O2 heater", CONFIG(o2heaterPin));
|
||||
enginePins.acRelay.initPin("A/C relay", CONFIG(acRelayPin), &CONFIG(acRelayPinMode));
|
||||
// todo: should we move this code closer to the fuel pump logic?
|
||||
enginePins.fuelPumpRelay.initPin("Fuel pump", CONFIG(fuelPumpPin), &CONFIG(fuelPumpPinMode));
|
||||
enginePins.boostPin.initPin("Boost", CONFIG(boostControlPin));
|
||||
|
||||
enginePins.idleSolenoidPin.initPin("Idle Valve", CONFIG(idle).solenoidPin);
|
||||
enginePins.secondIdleSolenoidPin.initPin("Idle Valve#2", CONFIG(secondSolenoidPin));
|
||||
enginePins.alternatorPin.initPin("Alternator control", CONFIG(alternatorControlPin));
|
||||
|
||||
|
||||
enginePins.o2heater.initPin("O2 heater", CONFIG(o2heaterPin));
|
||||
|
||||
#endif /* EFI_GPIO_HARDWARE */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue