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;
|
||||
#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(
|
||||
const TriggerStateCallback triggerCycleCallback,
|
||||
const TriggerConfiguration& triggerConfiguration,
|
||||
|
@ -44,9 +51,7 @@ void TriggerStimulatorHelper::feedSimulatedEvent(
|
|||
int stateIndex = i % shape.getSize();
|
||||
int size = shape.getSize();
|
||||
|
||||
int loopIndex = i / shape.getSize();
|
||||
|
||||
int time = (int) (SIMULATION_CYCLE_PERIOD * (loopIndex + shape.wave.getSwitchTime(stateIndex)));
|
||||
int time = getSimulatedEventTime(shape, i);
|
||||
|
||||
const MultiChannelStateSequence& multiChannelStateSequence = shape.wave;
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "trigger_decoder.h"
|
||||
|
||||
int getSimulatedEventTime(const TriggerWaveform& shape, int i);
|
||||
|
||||
class TriggerStimulatorHelper {
|
||||
public:
|
||||
|
||||
|
@ -26,7 +28,6 @@ public:
|
|||
TriggerWaveform& shape
|
||||
);
|
||||
|
||||
private:
|
||||
// send next event so that we can see how state reacts
|
||||
void feedSimulatedEvent(const TriggerStateCallback triggerCycleCallback,
|
||||
const TriggerConfiguration& triggerConfiguration,
|
||||
|
|
Loading…
Reference in New Issue