diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index ccfbccd21a..6f2c9a2d35 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -504,6 +504,7 @@ private: void prepareShapes(DECLARE_ENGINE_PARAMETER_SIGNATURE); void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX); +void refreshTriggerShape(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX); void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX); void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 7c704c714b..94e0cb76a9 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -179,6 +179,9 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__) onConfigurationChangeRpmEmulatorCallback(&activeConfiguration); #endif /* EFI_EMULATE_POSITION_SENSORS */ + + onConfigurationChangeFsioCallback(&activeConfiguration PASS_ENGINE_PARAMETER_SUFFIX); + rememberCurrentConfiguration(); } @@ -1276,12 +1279,7 @@ void validateConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } -void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) - efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "apply c"); - scheduleMsg(logger, "applyNonPersistentConfiguration()"); -#endif - +void refreshTriggerShape(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) { assertEngineReference(); #if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) @@ -1292,6 +1290,17 @@ void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_S return; } engine->engineCycleEventCount = engine->triggerCentral.triggerShape.getLength(); +} + +void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) { +#if EFI_PROD_CODE || defined(__DOXYGEN__) + efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "apply c"); + scheduleMsg(logger, "applyNonPersistentConfiguration()"); +#endif + + assertEngineReference(); + refreshTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX); + #if EFI_FSIO || defined(__DOXYGEN__) applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); #endif diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 1d3ff99eec..98dd91c371 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -232,6 +232,12 @@ void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } } +void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX) { +#if EFI_FSIO || defined(__DOXYGEN__) + applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); +#endif +} + #if EFI_PROD_CODE || defined(__DOXYGEN__) static SimplePwm fsioPwm[FSIO_COMMAND_COUNT] CCM_OPTIONAL; diff --git a/firmware/controllers/core/fsio_impl.h b/firmware/controllers/core/fsio_impl.h index 9d742139a0..e6372f519e 100644 --- a/firmware/controllers/core/fsio_impl.h +++ b/firmware/controllers/core/fsio_impl.h @@ -26,6 +26,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX); void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE); float getFsioOutputValue(int index DECLARE_ENGINE_PARAMETER_SUFFIX); void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE); +void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX); void prepareFsio(void); #endif /* LE_FUNCTIONS_H_ */ diff --git a/firmware/controllers/trigger/trigger_emulator_algo.cpp b/firmware/controllers/trigger/trigger_emulator_algo.cpp index 4a63dc66d5..751e1ce6c8 100644 --- a/firmware/controllers/trigger/trigger_emulator_algo.cpp +++ b/firmware/controllers/trigger/trigger_emulator_algo.cpp @@ -121,7 +121,7 @@ static void updateTriggerShapeIfNeeded(PwmConfig *state) { getGlobalConfigurationVersion(), currentTimeMillis()); // kludge: this line affects not trigger emulation but actual trigger consumption - applyNonPersistentConfiguration(logger PASS_ENGINE_PARAMETER_SUFFIX); + refreshTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX); TriggerShape *s = &engine->triggerCentral.triggerShape; pin_state_t *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = { s->wave.waves[0].pinStates, s->wave.waves[1].pinStates, diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 924d8b950e..54506584a8 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -276,5 +276,5 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20180201; + return 20180202; }