mirror of https://github.com/rusefi/rusefi-1.git
progress #363
This commit is contained in:
parent
81e3fa5177
commit
93382725e6
|
@ -21,6 +21,7 @@
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
#include "LocalVersionHolder.h"
|
#include "LocalVersionHolder.h"
|
||||||
#include "trigger_central.h"
|
#include "trigger_central.h"
|
||||||
|
#include "trigger_simulator.h"
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
#include "pwm_generator.h"
|
#include "pwm_generator.h"
|
||||||
|
@ -32,16 +33,9 @@ TriggerEmulatorHelper::TriggerEmulatorHelper() {
|
||||||
thirdWheelState = false;
|
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
|
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) {
|
static void fireShaftSignal(trigger_event_e signal) {
|
||||||
if (isUsefulSignal(signal, engineConfiguration))
|
if (isUsefulSignal(signal, engineConfiguration))
|
||||||
hwHandleShaftSignal(signal);
|
hwHandleShaftSignal(signal);
|
||||||
|
|
|
@ -22,6 +22,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void initTriggerEmulatorLogic(Logging *sharedLogger, Engine *engine);
|
void initTriggerEmulatorLogic(Logging *sharedLogger, Engine *engine);
|
||||||
bool isUsefulSignal(trigger_event_e signal, engine_configuration_s *engineConfiguration);
|
|
||||||
|
|
||||||
#endif /* TRIGGER_EMULATOR_ALGO_H_ */
|
#endif /* TRIGGER_EMULATOR_ALGO_H_ */
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "trigger_simulator.h"
|
#include "trigger_simulator.h"
|
||||||
|
#include "trigger_emulator_algo.h"
|
||||||
|
|
||||||
#define SIMULATION_CYCLE_PERIOD 720000
|
#define SIMULATION_CYCLE_PERIOD 720000
|
||||||
|
|
||||||
|
@ -16,6 +17,13 @@ EXTERN_ENGINE;
|
||||||
TriggerStimulatorHelper::TriggerStimulatorHelper() {
|
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,
|
void TriggerStimulatorHelper::nextStep(TriggerState *state, TriggerShape * shape, int i,
|
||||||
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_S) {
|
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_S) {
|
||||||
int stateIndex = i % shape->getSize();
|
int stateIndex = i % shape->getSize();
|
||||||
|
|
|
@ -24,5 +24,6 @@ public:
|
||||||
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_S);
|
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_ */
|
#endif /* CONTROLLERS_TRIGGER_TRIGGER_SIMULATOR_H_ */
|
||||||
|
|
Loading…
Reference in New Issue