refactoring
This commit is contained in:
parent
c08140d112
commit
89c25af9d2
|
@ -232,7 +232,7 @@ void OutputPin::unregisterOutput(brain_pin_e oldPin, brain_pin_e newPin) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopIgnitionPins(void) {
|
void EnginePins::stopIgnitionPins(void) {
|
||||||
for (int i = 0; i < IGNITION_PIN_COUNT; i++) {
|
for (int i = 0; i < IGNITION_PIN_COUNT; i++) {
|
||||||
NamedOutputPin *output = &enginePins.coils[i];
|
NamedOutputPin *output = &enginePins.coils[i];
|
||||||
output->unregisterOutput(activeConfiguration.bc.ignitionPins[i],
|
output->unregisterOutput(activeConfiguration.bc.ignitionPins[i],
|
||||||
|
@ -240,7 +240,7 @@ void stopIgnitionPins(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopInjectionPins(void) {
|
void EnginePins::stopInjectionPins(void) {
|
||||||
for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
|
for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
|
||||||
NamedOutputPin *output = &enginePins.injectors[i];
|
NamedOutputPin *output = &enginePins.injectors[i];
|
||||||
output->unregisterOutput(activeConfiguration.bc.injectionPins[i],
|
output->unregisterOutput(activeConfiguration.bc.injectionPins[i],
|
||||||
|
@ -248,7 +248,7 @@ void stopInjectionPins(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void startIgnitionPins(void) {
|
void EnginePins::startIgnitionPins(void) {
|
||||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||||
NamedOutputPin *output = &enginePins.coils[i];
|
NamedOutputPin *output = &enginePins.coils[i];
|
||||||
// todo: we need to check if mode has changed
|
// todo: we need to check if mode has changed
|
||||||
|
@ -265,7 +265,7 @@ void startIgnitionPins(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void startInjectionPins(void) {
|
void EnginePins::startInjectionPins(void) {
|
||||||
// todo: should we move this code closer to the injection logic?
|
// todo: should we move this code closer to the injection logic?
|
||||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||||
NamedOutputPin *output = &enginePins.injectors[i];
|
NamedOutputPin *output = &enginePins.injectors[i];
|
||||||
|
@ -304,8 +304,8 @@ void initInjectorCentral(Logging *sharedLogger) {
|
||||||
is_injector_enabled[i] = true;
|
is_injector_enabled[i] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
startInjectionPins();
|
enginePins.startInjectionPins();
|
||||||
startIgnitionPins();
|
enginePins.startIgnitionPins();
|
||||||
|
|
||||||
printInjectorsStatus();
|
printInjectorsStatus();
|
||||||
addConsoleActionII("injector", setInjectorEnabled);
|
addConsoleActionII("injector", setInjectorEnabled);
|
||||||
|
|
|
@ -20,11 +20,6 @@ void milBench(void);
|
||||||
void initInjectorCentral(Logging *sharedLogger);
|
void initInjectorCentral(Logging *sharedLogger);
|
||||||
bool isRunningBenchTest(void);
|
bool isRunningBenchTest(void);
|
||||||
|
|
||||||
void stopInjectionPins(void);
|
|
||||||
void startInjectionPins(void);
|
|
||||||
|
|
||||||
void stopIgnitionPins(void);
|
|
||||||
void startIgnitionPins(void);
|
|
||||||
void runIoTest(int subsystem, int index);
|
void runIoTest(int subsystem, int index);
|
||||||
|
|
||||||
#endif /* INJECTOR_CENTRAL_H_ */
|
#endif /* INJECTOR_CENTRAL_H_ */
|
||||||
|
|
|
@ -91,6 +91,10 @@ public:
|
||||||
void reset();
|
void reset();
|
||||||
bool stopPins();
|
bool stopPins();
|
||||||
void unregisterPins();
|
void unregisterPins();
|
||||||
|
void startInjectionPins();
|
||||||
|
void startIgnitionPins();
|
||||||
|
void stopInjectionPins();
|
||||||
|
void stopIgnitionPins();
|
||||||
OutputPin mainRelay;
|
OutputPin mainRelay;
|
||||||
OutputPin fanRelay;
|
OutputPin fanRelay;
|
||||||
OutputPin acRelay;
|
OutputPin acRelay;
|
||||||
|
|
|
@ -232,8 +232,8 @@ void applyNewHardwareSettings(void) {
|
||||||
|
|
||||||
// all 'stop' methods need to go before we begin starting pins
|
// all 'stop' methods need to go before we begin starting pins
|
||||||
|
|
||||||
stopInjectionPins();
|
enginePins.stopInjectionPins();
|
||||||
stopIgnitionPins();
|
enginePins.stopIgnitionPins();
|
||||||
stopCanPins();
|
stopCanPins();
|
||||||
bool etbRestartNeeded = isETBRestartNeeded();
|
bool etbRestartNeeded = isETBRestartNeeded();
|
||||||
if (etbRestartNeeded) {
|
if (etbRestartNeeded) {
|
||||||
|
@ -265,8 +265,8 @@ void applyNewHardwareSettings(void) {
|
||||||
enginePins.unregisterPins();
|
enginePins.unregisterPins();
|
||||||
|
|
||||||
|
|
||||||
startInjectionPins();
|
enginePins.startInjectionPins();
|
||||||
startIgnitionPins();
|
enginePins.startIgnitionPins();
|
||||||
startCanPins();
|
startCanPins();
|
||||||
if (etbRestartNeeded) {
|
if (etbRestartNeeded) {
|
||||||
startETBPins();
|
startETBPins();
|
||||||
|
|
Loading…
Reference in New Issue