nicer ETB properties change
This commit is contained in:
parent
07be62b9e3
commit
5cb6cad9b9
|
@ -184,6 +184,16 @@ void setDefaultEtbParameters(void) {
|
|||
engineConfiguration->etbFreq = 300;
|
||||
}
|
||||
|
||||
bool isETBRestartNeeded(void) {
|
||||
/**
|
||||
* We do not want any interruption in HW pin while adjusting other properties
|
||||
*/
|
||||
return engineConfiguration->bc.etbControlPin1 != activeConfiguration.bc.etbControlPin1 ||
|
||||
engineConfiguration->bc.etbControlPin2 != activeConfiguration.bc.etbControlPin2 ||
|
||||
engineConfiguration->bc.etbDirectionPin1 != activeConfiguration.bc.etbDirectionPin1 ||
|
||||
engineConfiguration->bc.etbDirectionPin2 != activeConfiguration.bc.etbDirectionPin2;
|
||||
}
|
||||
|
||||
void stopETBPins(void) {
|
||||
unmarkPin(activeConfiguration.bc.etbControlPin1);
|
||||
unmarkPin(activeConfiguration.bc.etbControlPin2);
|
||||
|
|
|
@ -13,6 +13,7 @@ void initElectronicThrottle(void);
|
|||
void setDefaultEtbParameters(void);
|
||||
void setEtbPFactor(float value);
|
||||
void setEtbIFactor(float value);
|
||||
bool isETBRestartNeeded(void);
|
||||
void stopETBPins(void);
|
||||
void startETBPins(void);
|
||||
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration);
|
||||
|
|
|
@ -234,7 +234,10 @@ void applyNewHardwareSettings(void) {
|
|||
stopInjectionPins();
|
||||
stopIgnitionPins();
|
||||
stopCanPins();
|
||||
stopETBPins();
|
||||
bool etbRestartNeeded = isETBRestartNeeded();
|
||||
if (etbRestartNeeded) {
|
||||
stopETBPins();
|
||||
}
|
||||
stopVSSPins();
|
||||
stopAuxPins();
|
||||
|
||||
|
@ -293,7 +296,9 @@ void applyNewHardwareSettings(void) {
|
|||
startInjectionPins();
|
||||
startIgnitionPins();
|
||||
startCanPins();
|
||||
startETBPins();
|
||||
if (etbRestartNeeded) {
|
||||
startETBPins();
|
||||
}
|
||||
startVSSPins();
|
||||
startAuxPins();
|
||||
|
||||
|
|
Loading…
Reference in New Issue