Trigger: warning code on normal engine start up #669
making more code unit-testable
This commit is contained in:
parent
28a27367e5
commit
266e50f4ca
|
@ -198,7 +198,7 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
#if EFI_SHAFT_POSITION_INPUT
|
||||
onConfigurationChangeTriggerCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||
#if EFI_EMULATE_POSITION_SENSORS
|
||||
#if EFI_EMULATE_POSITION_SENSORS && ! EFI_UNIT_TEST
|
||||
onConfigurationChangeRpmEmulatorCallback(&activeConfiguration);
|
||||
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ void setTriggerEmulatorRPM(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
efiPrintf("Emulating position sensor(s). RPM=%d", rpm);
|
||||
}
|
||||
|
||||
static void updateTriggerWaveformIfNeeded(PwmConfig *state) {
|
||||
static void updateTriggerWaveformIfNeeded(PwmConfig *state DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
if (atTriggerVersion < engine->triggerCentral.triggerShape.version) {
|
||||
atTriggerVersion = engine->triggerCentral.triggerShape.version;
|
||||
efiPrintf("Stimulator: updating trigger shape: %d/%d %d", atTriggerVersion,
|
||||
|
@ -127,6 +127,10 @@ static void updateTriggerWaveformIfNeeded(PwmConfig *state) {
|
|||
static TriggerEmulatorHelper helper;
|
||||
static bool hasStimPins = false;
|
||||
|
||||
static bool hasInitTriggerEmulator = false;
|
||||
|
||||
# if !EFI_UNIT_TEST
|
||||
|
||||
static void emulatorApplyPinState(int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
|
||||
if (engine->directSelfStimulation) {
|
||||
/**
|
||||
|
@ -143,9 +147,7 @@ static void emulatorApplyPinState(int stateIndex, PwmConfig *state) /* pwm_gen_c
|
|||
#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
static bool hasInitTriggerEmulator = false;
|
||||
|
||||
static void initTriggerPwm() {
|
||||
static void initTriggerPwm(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
// No need to start more than once
|
||||
if (hasInitTriggerEmulator) {
|
||||
return;
|
||||
|
@ -195,15 +197,17 @@ void onConfigurationChangeRpmEmulatorCallback(engine_configuration_s *previousCo
|
|||
setTriggerEmulatorRPM(engineConfiguration->triggerSimulatorFrequency);
|
||||
}
|
||||
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
||||
void initTriggerEmulator(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
efiPrintf("Emulating %s", getConfigurationName(engineConfiguration->engineType));
|
||||
|
||||
startTriggerEmulatorPins();
|
||||
startTriggerEmulatorPins(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
initTriggerEmulatorLogic();
|
||||
initTriggerEmulatorLogic(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
void startTriggerEmulatorPins() {
|
||||
void startTriggerEmulatorPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
hasStimPins = false;
|
||||
for (size_t i = 0; i < efi::size(emulatorOutputs); i++) {
|
||||
triggerSignal.outputPins[i] = &emulatorOutputs[i];
|
||||
|
|
|
@ -13,7 +13,7 @@ class PwmConfig;
|
|||
class MultiChannelStateSequence;
|
||||
|
||||
void initTriggerEmulator(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void startTriggerEmulatorPins();
|
||||
void startTriggerEmulatorPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void stopTriggerEmulatorPins();
|
||||
void setTriggerEmulatorRPM(int value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void onConfigurationChangeRpmEmulatorCallback(engine_configuration_s *previousConfiguration);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#define EFI_ENABLE_ASSERTS TRUE
|
||||
|
||||
#define EFI_EMULATE_POSITION_SENSORS TRUE
|
||||
|
||||
#define EFI_ENGINE_SNIFFER TRUE
|
||||
|
||||
#define EFI_PRINTF_FUEL_DETAILS TRUE
|
||||
|
|
Loading…
Reference in New Issue