Output pin init/deinit needs a linked list #1803
trying to make things more consistent & smarter
This commit is contained in:
parent
c464dfdca6
commit
4dc5c61f60
|
@ -635,8 +635,6 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
|||
addConsoleAction("analoginfo", printAnalogInfo);
|
||||
|
||||
#if EFI_PROD_CODE && EFI_ENGINE_CONTROL
|
||||
enginePins.startPins();
|
||||
|
||||
initBenchTest(sharedLogger);
|
||||
#endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */
|
||||
|
||||
|
|
|
@ -170,6 +170,9 @@ bool EnginePins::stopPins() {
|
|||
}
|
||||
|
||||
void EnginePins::unregisterPins() {
|
||||
stopInjectionPins();
|
||||
stopIgnitionPins();
|
||||
|
||||
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||
unregisterEtbPins();
|
||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||
|
@ -194,9 +197,30 @@ void EnginePins::unregisterPins() {
|
|||
}
|
||||
|
||||
void EnginePins::startPins() {
|
||||
#if EFI_ENGINE_CONTROL
|
||||
startInjectionPins();
|
||||
startIgnitionPins();
|
||||
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() {
|
||||
|
@ -423,24 +447,6 @@ void initOutputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
enginePins.sdCsPin.initPin("SD CS", CONFIG(sdCardCsPin));
|
||||
#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
|
||||
// todo: migrate remaining OutputPin to RegisteredOutputPin in order to get consistent dynamic pin init/deinit
|
||||
enginePins.debugTriggerSync.initPin("debug: sync", CONFIG(debugTriggerSync));
|
||||
|
|
|
@ -147,11 +147,6 @@ public:
|
|||
void reset();
|
||||
bool stopPins();
|
||||
void unregisterPins();
|
||||
void startInjectionPins();
|
||||
void startIgnitionPins();
|
||||
void startAuxValves();
|
||||
void stopInjectionPins();
|
||||
void stopIgnitionPins();
|
||||
RegisteredOutputPin mainRelay;
|
||||
// this one cranks engine
|
||||
RegisteredOutputPin starterControl;
|
||||
|
@ -192,6 +187,13 @@ public:
|
|||
InjectorOutputPin injectors[INJECTION_PIN_COUNT];
|
||||
IgnitionOutputPin coils[IGNITION_PIN_COUNT];
|
||||
NamedOutputPin auxValve[AUX_DIGITAL_VALVE_COUNT];
|
||||
private:
|
||||
void startInjectionPins();
|
||||
void startIgnitionPins();
|
||||
void startAuxValves();
|
||||
|
||||
void stopInjectionPins();
|
||||
void stopIgnitionPins();
|
||||
};
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -313,8 +313,6 @@ void applyNewHardwareSettings(void) {
|
|||
stopJoystickPins();
|
||||
#endif /* HAL_USE_PAL && EFI_JOYSTICK */
|
||||
|
||||
enginePins.stopInjectionPins();
|
||||
enginePins.stopIgnitionPins();
|
||||
#if EFI_CAN_SUPPORT
|
||||
stopCanPins();
|
||||
#endif /* EFI_CAN_SUPPORT */
|
||||
|
@ -377,6 +375,8 @@ void applyNewHardwareSettings(void) {
|
|||
|
||||
ButtonDebounce::startConfigurationList();
|
||||
|
||||
|
||||
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
startTriggerInputPins();
|
||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||
|
@ -389,8 +389,7 @@ void applyNewHardwareSettings(void) {
|
|||
startHD44780_pins();
|
||||
#endif /* #if EFI_HD44780_LCD */
|
||||
|
||||
enginePins.startInjectionPins();
|
||||
enginePins.startIgnitionPins();
|
||||
enginePins.startPins();
|
||||
|
||||
#if EFI_CAN_SUPPORT
|
||||
startCanPins();
|
||||
|
@ -535,6 +534,11 @@ void initHardware(Logging *l) {
|
|||
|
||||
// output pins potentially depend on 'initSmartGpio'
|
||||
initOutputPins(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
#if EFI_PROD_CODE && EFI_ENGINE_CONTROL
|
||||
enginePins.startPins();
|
||||
|
||||
#endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */
|
||||
|
||||
|
||||
#if EFI_MC33816
|
||||
initMc33816(sharedLogger);
|
||||
|
|
Loading…
Reference in New Issue