steps towards #975
This commit is contained in:
parent
b001e668d4
commit
0e01355c15
|
@ -481,7 +481,7 @@ void setDefaultEtbParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
engineConfiguration->etb.maxValue = 200;
|
||||
}
|
||||
|
||||
static bool isSamePins(etb_io *current, etb_io *active) {
|
||||
static bool isEtbPinsChanged(etb_io *current, etb_io *active) {
|
||||
return current->controlPin1 != active->controlPin1 ||
|
||||
current->controlPinMode != active->controlPinMode ||
|
||||
current->directionPin1 != active->directionPin1 ||
|
||||
|
@ -493,7 +493,7 @@ bool isETBRestartNeeded(void) {
|
|||
/**
|
||||
* We do not want any interruption in HW pin while adjusting other properties
|
||||
*/
|
||||
return isSamePins(&engineConfiguration->bc.etb1, &activeConfiguration.bc.etb1);
|
||||
return isEtbPinsChanged(&engineConfiguration->bc.etb1, &activeConfiguration.bc.etb1);
|
||||
}
|
||||
|
||||
void stopETBPins(void) {
|
||||
|
|
|
@ -526,6 +526,24 @@ static void applyIdleSolenoidPinState(int stateIndex, PwmConfig *state) /* pwm_g
|
|||
}
|
||||
}
|
||||
|
||||
bool isIdleHardwareRestartNeeded() {
|
||||
return isConfigurationChanged(stepperEnablePin) ||
|
||||
isConfigurationChanged(stepperEnablePinMode) ||
|
||||
isConfigurationChanged(bc.idle.stepperStepPin) ||
|
||||
isConfigurationChanged(bc.idle.stepperStepPin) ||
|
||||
isConfigurationChanged(bc.idle.solenoidFrequency) ||
|
||||
// isConfigurationChanged() ||
|
||||
// isConfigurationChanged() ||
|
||||
// isConfigurationChanged() ||
|
||||
isConfigurationChanged(bc.useETBforIdleControl) ||
|
||||
isConfigurationChanged(bc.idle.solenoidPin);
|
||||
|
||||
}
|
||||
|
||||
static void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
||||
}
|
||||
|
||||
static void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
if (CONFIGB(useStepperIdle)) {
|
||||
iacMotor.initialize(CONFIGB(idle).stepperStepPin,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
extern persistent_config_container_s persistentState; \
|
||||
extern persistent_config_s *config; \
|
||||
|
||||
#define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x)
|
||||
|
||||
#define EXTERN_ENGINE \
|
||||
extern Engine ___engine; \
|
||||
|
|
|
@ -189,13 +189,12 @@ void EnginePins::startIgnitionPins(void) {
|
|||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
NamedOutputPin *output = &enginePins.coils[i];
|
||||
// todo: we need to check if mode has changed
|
||||
if (CONFIGB(ignitionPins)[i] != activeConfiguration.bc.ignitionPins[i]) {
|
||||
output->initPin(output->name, CONFIGB(ignitionPins)[i],
|
||||
&CONFIGB(ignitionPinMode));
|
||||
if (isConfigurationChanged(bc.ignitionPins[i])) {
|
||||
output->initPin(output->name, CONFIGB(ignitionPins)[i], &CONFIGB(ignitionPinMode));
|
||||
}
|
||||
}
|
||||
// todo: we need to check if mode has changed
|
||||
if (engineConfiguration->dizzySparkOutputPin != activeConfiguration.dizzySparkOutputPin) {
|
||||
if (isConfigurationChanged(dizzySparkOutputPin)) {
|
||||
enginePins.dizzyOutput.initPin("dizzy tach", engineConfiguration->dizzySparkOutputPin,
|
||||
&engineConfiguration->dizzySparkOutputPinMode);
|
||||
|
||||
|
|
|
@ -307,13 +307,13 @@ void applyNewHardwareSettings(void) {
|
|||
stopAuxPins();
|
||||
#endif /* EFI_AUX_PID */
|
||||
|
||||
if (engineConfiguration->bc.is_enabled_spi_1 != activeConfiguration.bc.is_enabled_spi_1)
|
||||
if (isConfigurationChanged(bc.is_enabled_spi_1))
|
||||
stopSpi(SPI_DEVICE_1);
|
||||
|
||||
if (engineConfiguration->bc.is_enabled_spi_2 != activeConfiguration.bc.is_enabled_spi_2)
|
||||
if (isConfigurationChanged(bc.is_enabled_spi_2))
|
||||
stopSpi(SPI_DEVICE_2);
|
||||
|
||||
if (engineConfiguration->bc.is_enabled_spi_3 != activeConfiguration.bc.is_enabled_spi_3)
|
||||
if (isConfigurationChanged(bc.is_enabled_spi_3))
|
||||
stopSpi(SPI_DEVICE_3);
|
||||
|
||||
#if EFI_HD44780_LCD
|
||||
|
|
|
@ -261,7 +261,7 @@ void stopTriggerInputPins(void) {
|
|||
}
|
||||
}
|
||||
for (int i = 0; i < CAM_INPUTS_COUNT; i++) {
|
||||
if (engineConfiguration->camInputs[i] != activeConfiguration.camInputs[i]) {
|
||||
if (isConfigurationChanged(camInputs[i])) {
|
||||
turnOffTriggerInputPin(activeConfiguration.camInputs[i]);
|
||||
}
|
||||
}
|
||||
|
@ -271,15 +271,14 @@ void stopTriggerInputPins(void) {
|
|||
void startTriggerInputPins(void) {
|
||||
#if EFI_PROD_CODE
|
||||
for (int i = 0; i < TRIGGER_SUPPORTED_CHANNELS; i++) {
|
||||
if (CONFIGB(triggerInputPins)[i]
|
||||
!= activeConfiguration.bc.triggerInputPins[i]) {
|
||||
if (isConfigurationChanged(bc.triggerInputPins[i])) {
|
||||
const char * msg = (i == 0 ? "trigger#1" : (i == 1 ? "trigger#2" : "trigger#3"));
|
||||
turnOnTriggerInputPin(msg, CONFIGB(triggerInputPins)[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < CAM_INPUTS_COUNT; i++) {
|
||||
if (engineConfiguration->camInputs[i] != activeConfiguration.camInputs[i]) {
|
||||
if (isConfigurationChanged(camInputs[i])) {
|
||||
turnOnTriggerInputPin("cam", engineConfiguration->camInputs[i], false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,12 +109,11 @@ void stopTriggerInputPins(void) {
|
|||
isCompEnabled = false;
|
||||
#if 0
|
||||
for (int i = 0; i < TRIGGER_SUPPORTED_CHANNELS; i++) {
|
||||
if (CONFIGB(triggerInputPins)[i]
|
||||
!= activeConfiguration.bc.triggerInputPins[i]) {
|
||||
if (isConfigurationChanged(bc.triggerInputPins[i])) {
|
||||
turnOffTriggerInputPin(activeConfiguration.bc.triggerInputPins[i]);
|
||||
}
|
||||
}
|
||||
if (engineConfiguration->camInput != activeConfiguration.camInput) {
|
||||
if (isConfigurationChanged(camInput)) {
|
||||
turnOffTriggerInputPin(activeConfiguration.camInput);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue