reducing coupling between trigger emulation and FSIO

This commit is contained in:
rusefi 2018-02-03 11:42:50 -05:00
parent e767eccc99
commit 436f7aa965
6 changed files with 25 additions and 8 deletions

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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_ */

View File

@ -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,

View File

@ -276,5 +276,5 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20180201;
return 20180202;
}