Trigger: warning code on normal engine start up #669
making more code unit-testable
This commit is contained in:
parent
288c2620c6
commit
c40f801e6d
|
@ -33,6 +33,13 @@ bool isUsefulSignal(trigger_event_e signal, const TriggerConfiguration& triggerC
|
||||||
extern bool printTriggerDebug;
|
extern bool printTriggerDebug;
|
||||||
#endif /* ! EFI_UNIT_TEST */
|
#endif /* ! EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
int getSimulatedEventTime(const TriggerWaveform& shape, int i) {
|
||||||
|
int stateIndex = i % shape.getSize();
|
||||||
|
int loopIndex = i / shape.getSize();
|
||||||
|
|
||||||
|
return (int) (SIMULATION_CYCLE_PERIOD * (loopIndex + shape.wave.getSwitchTime(stateIndex)));
|
||||||
|
}
|
||||||
|
|
||||||
void TriggerStimulatorHelper::feedSimulatedEvent(
|
void TriggerStimulatorHelper::feedSimulatedEvent(
|
||||||
const TriggerStateCallback triggerCycleCallback,
|
const TriggerStateCallback triggerCycleCallback,
|
||||||
const TriggerConfiguration& triggerConfiguration,
|
const TriggerConfiguration& triggerConfiguration,
|
||||||
|
@ -44,9 +51,7 @@ void TriggerStimulatorHelper::feedSimulatedEvent(
|
||||||
int stateIndex = i % shape.getSize();
|
int stateIndex = i % shape.getSize();
|
||||||
int size = shape.getSize();
|
int size = shape.getSize();
|
||||||
|
|
||||||
int loopIndex = i / shape.getSize();
|
int time = getSimulatedEventTime(shape, i);
|
||||||
|
|
||||||
int time = (int) (SIMULATION_CYCLE_PERIOD * (loopIndex + shape.wave.getSwitchTime(stateIndex)));
|
|
||||||
|
|
||||||
const MultiChannelStateSequence& multiChannelStateSequence = shape.wave;
|
const MultiChannelStateSequence& multiChannelStateSequence = shape.wave;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#include "trigger_decoder.h"
|
#include "trigger_decoder.h"
|
||||||
|
|
||||||
|
int getSimulatedEventTime(const TriggerWaveform& shape, int i);
|
||||||
|
|
||||||
class TriggerStimulatorHelper {
|
class TriggerStimulatorHelper {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -26,7 +28,6 @@ public:
|
||||||
TriggerWaveform& shape
|
TriggerWaveform& shape
|
||||||
);
|
);
|
||||||
|
|
||||||
private:
|
|
||||||
// send next event so that we can see how state reacts
|
// send next event so that we can see how state reacts
|
||||||
void feedSimulatedEvent(const TriggerStateCallback triggerCycleCallback,
|
void feedSimulatedEvent(const TriggerStateCallback triggerCycleCallback,
|
||||||
const TriggerConfiguration& triggerConfiguration,
|
const TriggerConfiguration& triggerConfiguration,
|
||||||
|
|
Loading…
Reference in New Issue