This commit is contained in:
rusefi 2017-03-04 00:17:53 -05:00
parent 81e3fa5177
commit 93382725e6
4 changed files with 10 additions and 8 deletions

View File

@ -21,6 +21,7 @@
#include "engine_configuration.h"
#include "LocalVersionHolder.h"
#include "trigger_central.h"
#include "trigger_simulator.h"
#if EFI_PROD_CODE
#include "pwm_generator.h"
@ -32,16 +33,9 @@ TriggerEmulatorHelper::TriggerEmulatorHelper() {
thirdWheelState = false;
}
// this is not the only place where we have 'isUpEvent'. todo: reuse
static bool isRisingEdge[6] = { false, true, false, true, false, true };
EXTERN_ENGINE
;
bool isUsefulSignal(trigger_event_e signal, engine_configuration_s *engineConfiguration) {
return !engineConfiguration->useOnlyRisingEdgeForTrigger || isRisingEdge[(int) signal];
}
static void fireShaftSignal(trigger_event_e signal) {
if (isUsefulSignal(signal, engineConfiguration))
hwHandleShaftSignal(signal);

View File

@ -22,6 +22,5 @@ public:
};
void initTriggerEmulatorLogic(Logging *sharedLogger, Engine *engine);
bool isUsefulSignal(trigger_event_e signal, engine_configuration_s *engineConfiguration);
#endif /* TRIGGER_EMULATOR_ALGO_H_ */

View File

@ -8,6 +8,7 @@
#include "main.h"
#include "engine.h"
#include "trigger_simulator.h"
#include "trigger_emulator_algo.h"
#define SIMULATION_CYCLE_PERIOD 720000
@ -16,6 +17,13 @@ EXTERN_ENGINE;
TriggerStimulatorHelper::TriggerStimulatorHelper() {
}
// this is not the only place where we have 'isUpEvent'. todo: reuse
static bool isRisingEdge[6] = { false, true, false, true, false, true };
bool isUsefulSignal(trigger_event_e signal, engine_configuration_s *engineConfiguration) {
return !engineConfiguration->useOnlyRisingEdgeForTrigger || isRisingEdge[(int) signal];
}
void TriggerStimulatorHelper::nextStep(TriggerState *state, TriggerShape * shape, int i,
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_S) {
int stateIndex = i % shape->getSize();

View File

@ -24,5 +24,6 @@ public:
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_S);
};
bool isUsefulSignal(trigger_event_e signal, engine_configuration_s *engineConfiguration);
#endif /* CONTROLLERS_TRIGGER_TRIGGER_SIMULATOR_H_ */