Output pin init/deinit needs a linked list #1803
trying to make things more consistent & smarter
This commit is contained in:
parent
e5ad8eb5c0
commit
7de1fc8e2a
|
@ -635,8 +635,6 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
addConsoleAction("analoginfo", printAnalogInfo);
|
addConsoleAction("analoginfo", printAnalogInfo);
|
||||||
|
|
||||||
#if EFI_PROD_CODE && EFI_ENGINE_CONTROL
|
#if EFI_PROD_CODE && EFI_ENGINE_CONTROL
|
||||||
enginePins.startPins();
|
|
||||||
|
|
||||||
initBenchTest(sharedLogger);
|
initBenchTest(sharedLogger);
|
||||||
#endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */
|
#endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */
|
||||||
|
|
||||||
|
|
|
@ -170,6 +170,9 @@ bool EnginePins::stopPins() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnginePins::unregisterPins() {
|
void EnginePins::unregisterPins() {
|
||||||
|
stopInjectionPins();
|
||||||
|
stopIgnitionPins();
|
||||||
|
|
||||||
#if EFI_ELECTRONIC_THROTTLE_BODY
|
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||||
unregisterEtbPins();
|
unregisterEtbPins();
|
||||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||||
|
@ -194,9 +197,30 @@ void EnginePins::unregisterPins() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnginePins::startPins() {
|
void EnginePins::startPins() {
|
||||||
|
#if EFI_ENGINE_CONTROL
|
||||||
startInjectionPins();
|
startInjectionPins();
|
||||||
startIgnitionPins();
|
startIgnitionPins();
|
||||||
startAuxValves();
|
startAuxValves();
|
||||||
|
|
||||||
|
starterRelayDisable.initPin("Starter disable", CONFIG(starterRelayDisablePin), &CONFIG(starterRelayDisablePinMode));
|
||||||
|
starterControl.initPin("Starter control", CONFIG(starterControlPin));
|
||||||
|
#endif /* EFI_ENGINE_CONTROL */
|
||||||
|
|
||||||
|
mainRelay.initPin("Main relay", CONFIG(mainRelayPin), &CONFIG(mainRelayPinMode));
|
||||||
|
|
||||||
|
fanRelay.initPin("Fan", CONFIG(fanPin), &CONFIG(fanPinMode));
|
||||||
|
acRelay.initPin("A/C relay", CONFIG(acRelayPin), &CONFIG(acRelayPinMode));
|
||||||
|
// todo: should we move this code closer to the fuel pump logic?
|
||||||
|
fuelPumpRelay.initPin("Fuel pump", CONFIG(fuelPumpPin), &CONFIG(fuelPumpPinMode));
|
||||||
|
boostPin.initPin("Boost", CONFIG(boostControlPin));
|
||||||
|
|
||||||
|
idleSolenoidPin.initPin("Idle Valve", CONFIG(idle).solenoidPin);
|
||||||
|
secondIdleSolenoidPin.initPin("Idle Valve#2", CONFIG(secondSolenoidPin));
|
||||||
|
alternatorPin.initPin("Alternator control", CONFIG(alternatorControlPin));
|
||||||
|
|
||||||
|
triggerDecoderErrorPin.initPin("led: trigger debug", CONFIG(triggerErrorPin),
|
||||||
|
&CONFIG(triggerErrorPinMode));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnginePins::reset() {
|
void EnginePins::reset() {
|
||||||
|
@ -423,24 +447,6 @@ void initOutputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
enginePins.sdCsPin.initPin("SD CS", CONFIG(sdCardCsPin));
|
enginePins.sdCsPin.initPin("SD CS", CONFIG(sdCardCsPin));
|
||||||
#endif /* HAL_USE_SPI */
|
#endif /* HAL_USE_SPI */
|
||||||
|
|
||||||
|
|
||||||
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.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.triggerDecoderErrorPin.initPin("led: trigger debug", CONFIG(triggerErrorPin),
|
|
||||||
&CONFIG(triggerErrorPinMode));
|
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
// todo: migrate remaining OutputPin to RegisteredOutputPin in order to get consistent dynamic pin init/deinit
|
// todo: migrate remaining OutputPin to RegisteredOutputPin in order to get consistent dynamic pin init/deinit
|
||||||
enginePins.debugTriggerSync.initPin("debug: sync", CONFIG(debugTriggerSync));
|
enginePins.debugTriggerSync.initPin("debug: sync", CONFIG(debugTriggerSync));
|
||||||
|
|
|
@ -147,11 +147,6 @@ public:
|
||||||
void reset();
|
void reset();
|
||||||
bool stopPins();
|
bool stopPins();
|
||||||
void unregisterPins();
|
void unregisterPins();
|
||||||
void startInjectionPins();
|
|
||||||
void startIgnitionPins();
|
|
||||||
void startAuxValves();
|
|
||||||
void stopInjectionPins();
|
|
||||||
void stopIgnitionPins();
|
|
||||||
RegisteredOutputPin mainRelay;
|
RegisteredOutputPin mainRelay;
|
||||||
// this one cranks engine
|
// this one cranks engine
|
||||||
RegisteredOutputPin starterControl;
|
RegisteredOutputPin starterControl;
|
||||||
|
@ -192,6 +187,13 @@ public:
|
||||||
InjectorOutputPin injectors[INJECTION_PIN_COUNT];
|
InjectorOutputPin injectors[INJECTION_PIN_COUNT];
|
||||||
IgnitionOutputPin coils[IGNITION_PIN_COUNT];
|
IgnitionOutputPin coils[IGNITION_PIN_COUNT];
|
||||||
NamedOutputPin auxValve[AUX_DIGITAL_VALVE_COUNT];
|
NamedOutputPin auxValve[AUX_DIGITAL_VALVE_COUNT];
|
||||||
|
private:
|
||||||
|
void startInjectionPins();
|
||||||
|
void startIgnitionPins();
|
||||||
|
void startAuxValves();
|
||||||
|
|
||||||
|
void stopInjectionPins();
|
||||||
|
void stopIgnitionPins();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
@ -313,8 +313,6 @@ void applyNewHardwareSettings(void) {
|
||||||
stopJoystickPins();
|
stopJoystickPins();
|
||||||
#endif /* HAL_USE_PAL && EFI_JOYSTICK */
|
#endif /* HAL_USE_PAL && EFI_JOYSTICK */
|
||||||
|
|
||||||
enginePins.stopInjectionPins();
|
|
||||||
enginePins.stopIgnitionPins();
|
|
||||||
#if EFI_CAN_SUPPORT
|
#if EFI_CAN_SUPPORT
|
||||||
stopCanPins();
|
stopCanPins();
|
||||||
#endif /* EFI_CAN_SUPPORT */
|
#endif /* EFI_CAN_SUPPORT */
|
||||||
|
@ -377,6 +375,8 @@ void applyNewHardwareSettings(void) {
|
||||||
|
|
||||||
ButtonDebounce::startConfigurationList();
|
ButtonDebounce::startConfigurationList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
startTriggerInputPins();
|
startTriggerInputPins();
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
|
@ -389,8 +389,7 @@ void applyNewHardwareSettings(void) {
|
||||||
startHD44780_pins();
|
startHD44780_pins();
|
||||||
#endif /* #if EFI_HD44780_LCD */
|
#endif /* #if EFI_HD44780_LCD */
|
||||||
|
|
||||||
enginePins.startInjectionPins();
|
enginePins.startPins();
|
||||||
enginePins.startIgnitionPins();
|
|
||||||
|
|
||||||
#if EFI_CAN_SUPPORT
|
#if EFI_CAN_SUPPORT
|
||||||
startCanPins();
|
startCanPins();
|
||||||
|
@ -535,6 +534,11 @@ void initHardware(Logging *l) {
|
||||||
|
|
||||||
// output pins potentially depend on 'initSmartGpio'
|
// output pins potentially depend on 'initSmartGpio'
|
||||||
initOutputPins(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initOutputPins(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
#if EFI_PROD_CODE && EFI_ENGINE_CONTROL
|
||||||
|
enginePins.startPins();
|
||||||
|
|
||||||
|
#endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */
|
||||||
|
|
||||||
|
|
||||||
#if EFI_MC33816
|
#if EFI_MC33816
|
||||||
initMc33816(sharedLogger);
|
initMc33816(sharedLogger);
|
||||||
|
|
Loading…
Reference in New Issue