refactoring - following the pattern
This commit is contained in:
parent
8fa9bf07a4
commit
a1421a45db
|
@ -101,7 +101,7 @@ static LocalVersionHolder emulatorConfigVersion;
|
|||
extern WaveChart waveChart;
|
||||
#endif /* EFI_ENGINE_SNIFFER */
|
||||
|
||||
void setTriggerEmulatorRPM(int rpm, Engine *engine) {
|
||||
void setTriggerEmulatorRPM(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
engineConfiguration->bc.triggerSimulatorFrequency = rpm;
|
||||
/**
|
||||
* All we need to do here is to change the periodMs
|
||||
|
@ -170,7 +170,7 @@ void initTriggerEmulatorLogic(Logging *sharedLogger, Engine *engine) {
|
|||
logger = sharedLogger;
|
||||
|
||||
TriggerShape *s = &engine->triggerCentral.triggerShape;
|
||||
setTriggerEmulatorRPM(engineConfiguration->bc.triggerSimulatorFrequency, engine);
|
||||
setTriggerEmulatorRPM(engineConfiguration->bc.triggerSimulatorFrequency PASS_ENGINE_PARAMETER);
|
||||
pin_state_t *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = { s->wave.waves[0].pinStates, s->wave.waves[1].pinStates,
|
||||
s->wave.waves[2].pinStates };
|
||||
triggerSignal.weComplexInit("position sensor", s->getSize(), s->wave.switchTimes, PWM_PHASE_MAX_WAVE_PER_PWM,
|
||||
|
|
|
@ -34,7 +34,9 @@ void setDiag(int value) {
|
|||
|
||||
#define PERIOD 3000
|
||||
|
||||
void emulate(Engine *engine) {
|
||||
EXTERN_ENGINE;
|
||||
|
||||
static void emulate(void) {
|
||||
print("Emulating...\r\n");
|
||||
setDiag(1);
|
||||
chThdSleep(1);
|
||||
|
@ -43,11 +45,11 @@ void emulate(Engine *engine) {
|
|||
for (int i = 400; i <= 1300; i++) {
|
||||
if (i % 50 != 0)
|
||||
continue;
|
||||
setTriggerEmulatorRPM(i, engine);
|
||||
setTriggerEmulatorRPM(i PASS_ENGINE_PARAMETER);
|
||||
chThdSleepMilliseconds(PERIOD);
|
||||
}
|
||||
|
||||
setTriggerEmulatorRPM(0, engine);
|
||||
setTriggerEmulatorRPM(0 PASS_ENGINE_PARAMETER);
|
||||
|
||||
setFullLog(0);
|
||||
setDiag(0);
|
||||
|
@ -57,14 +59,15 @@ void emulate(Engine *engine) {
|
|||
|
||||
static int flag = FALSE;
|
||||
|
||||
static msg_t eeThread(Engine *engine) {
|
||||
static msg_t eeThread(void *arg) {
|
||||
(void)arg;
|
||||
chRegSetThreadName("Engine");
|
||||
|
||||
while (TRUE) {
|
||||
while (!flag)
|
||||
chThdSleepMilliseconds(200);
|
||||
flag = FALSE;
|
||||
emulate(engine);
|
||||
emulate();
|
||||
}
|
||||
#if defined __GNUC__
|
||||
return (msg_t)NULL;
|
||||
|
@ -102,5 +105,5 @@ void initEngineEmulator(Logging *sharedLogger, Engine *engine) {
|
|||
#endif /* EFI_POTENTIOMETER */
|
||||
|
||||
//initECUstimulator();
|
||||
initTriggerEmulator(sharedLogger, engine);
|
||||
initTriggerEmulator(sharedLogger PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
|
|
@ -27,10 +27,10 @@ extern PwmConfig triggerSignal;
|
|||
|
||||
static OutputPin emulatorOutputs[3];
|
||||
|
||||
void initTriggerEmulator(Logging *sharedLogger, Engine *engine) {
|
||||
EXTERN_ENGINE;
|
||||
|
||||
void initTriggerEmulator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S) {
|
||||
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__)
|
||||
print("Emulating %s\r\n", getConfigurationName(engineConfiguration->engineType));
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "trigger_structure.h"
|
||||
#include "engine.h"
|
||||
|
||||
void initTriggerEmulator(Logging *sharedLogger, Engine *engine);
|
||||
void setTriggerEmulatorRPM(int value, Engine *engine);
|
||||
void initTriggerEmulator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S);
|
||||
void setTriggerEmulatorRPM(int value DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
#endif /* DIST_EMULATOR_H_ */
|
||||
|
|
|
@ -116,7 +116,7 @@ void rusEfiFunctionalTest(void) {
|
|||
|
||||
initTriggerCentral(&sharedLogger, engine);
|
||||
|
||||
initTriggerEmulator(&sharedLogger, engine);
|
||||
initTriggerEmulator(&sharedLogger PASS_ENGINE_PARAMETER);
|
||||
|
||||
#if EFI_MAP_AVERAGING || defined(__DOXYGEN__)
|
||||
initMapAveraging(&sharedLogger, engine);
|
||||
|
@ -130,7 +130,7 @@ void rusEfiFunctionalTest(void) {
|
|||
|
||||
initPeriodicEvents(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
setTriggerEmulatorRPM(DEFAULT_SIM_RPM, engine);
|
||||
setTriggerEmulatorRPM(DEFAULT_SIM_RPM PASS_ENGINE_PARAMETER);
|
||||
engineConfiguration->engineSnifferRpmThreshold = DEFAULT_SNIFFER_THR;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue