auto-sync
This commit is contained in:
parent
473c0bda3a
commit
9af8706443
|
@ -176,7 +176,7 @@ void printState(Engine *engine, int currentCkpEventCounter) {
|
||||||
debugFloat(&logger, "fuel_lag", getInjectorLag(engineConfiguration, getVBatt(engineConfiguration)), 2);
|
debugFloat(&logger, "fuel_lag", getInjectorLag(engineConfiguration, getVBatt(engineConfiguration)), 2);
|
||||||
debugFloat(&logger, "fuel", getFuelMs(rpm, engine), 2);
|
debugFloat(&logger, "fuel", getFuelMs(rpm, engine), 2);
|
||||||
|
|
||||||
debugFloat(&logger, "timing", getAdvance(rpm, engineLoad), 2);
|
debugFloat(&logger, "timing", getAdvance(engineConfiguration, rpm, engineLoad), 2);
|
||||||
|
|
||||||
// float map = getMap();
|
// float map = getMap();
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ float getBaseAdvance(int rpm, float engineLoad) {
|
||||||
engineConfiguration->ignitionRpmBins);
|
engineConfiguration->ignitionRpmBins);
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAdvance(int rpm, float engineLoad) {
|
float getAdvance(engine_configuration_s *engineConfiguration, int rpm, float engineLoad) {
|
||||||
float angle;
|
float angle;
|
||||||
if (isCrankingR(rpm)) {
|
if (isCrankingR(rpm)) {
|
||||||
angle = engineConfiguration->crankingTimingAngle;
|
angle = engineConfiguration->crankingTimingAngle;
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
#define AD_LOAD_COUNT 16
|
#define AD_LOAD_COUNT 16
|
||||||
#define AD_RPM_COUNT 16
|
#define AD_RPM_COUNT 16
|
||||||
|
|
||||||
float getAdvance(int rpm, float engineLoad);
|
#include "engine_configuration.h"
|
||||||
|
|
||||||
|
float getAdvance(engine_configuration_s *engineConfiguration, int rpm, float engineLoad);
|
||||||
void prepareTimingMap(void);
|
void prepareTimingMap(void);
|
||||||
|
|
||||||
#endif /* ADVANCE_H_ */
|
#endif /* ADVANCE_H_ */
|
||||||
|
|
|
@ -235,9 +235,6 @@ void showMainHistogram(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: eliminate this 'extern'
|
|
||||||
extern Engine engine;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main trigger event handler.
|
* This is the main trigger event handler.
|
||||||
* Both injection and ignition are controlled from this method.
|
* Both injection and ignition are controlled from this method.
|
||||||
|
@ -246,10 +243,10 @@ void onTriggerEvent(trigger_event_e ckpSignalType, uint32_t eventIndex, MainTrig
|
||||||
(void) ckpSignalType;
|
(void) ckpSignalType;
|
||||||
efiAssertVoid(eventIndex < 2 * mainTriggerCallback->engineConfiguration2->triggerShape.shaftPositionEventCount,
|
efiAssertVoid(eventIndex < 2 * mainTriggerCallback->engineConfiguration2->triggerShape.shaftPositionEventCount,
|
||||||
"event index");
|
"event index");
|
||||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#2");
|
efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowstck#2");
|
||||||
|
|
||||||
// todo int rpm = getRpmE(mainTriggerCallback->engine);
|
int rpm = getRpmE(mainTriggerCallback->engine);
|
||||||
int rpm = getRpmE(&engine);
|
// int rpm = getRpmE(&engine);
|
||||||
if (rpm == 0) {
|
if (rpm == 0) {
|
||||||
// this happens while we just start cranking
|
// this happens while we just start cranking
|
||||||
// todo: check for 'trigger->is_synchnonized?'
|
// todo: check for 'trigger->is_synchnonized?'
|
||||||
|
@ -291,7 +288,7 @@ void onTriggerEvent(trigger_event_e ckpSignalType, uint32_t eventIndex, MainTrig
|
||||||
firmwareError("invalid dwell: %f at %d", dwellMs, rpm);
|
firmwareError("invalid dwell: %f at %d", dwellMs, rpm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float advance = getAdvance(rpm, getEngineLoadT(mainTriggerCallback->engine));
|
float advance = getAdvance(mainTriggerCallback->engineConfiguration, rpm, getEngineLoadT(mainTriggerCallback->engine));
|
||||||
if (cisnan(advance)) {
|
if (cisnan(advance)) {
|
||||||
// error should already be reported
|
// error should already be reported
|
||||||
return;
|
return;
|
||||||
|
@ -306,7 +303,7 @@ void onTriggerEvent(trigger_event_e ckpSignalType, uint32_t eventIndex, MainTrig
|
||||||
|
|
||||||
triggerEventsQueue.executeAll(getCrankEventCounter());
|
triggerEventsQueue.executeAll(getCrankEventCounter());
|
||||||
|
|
||||||
handleFuel(&engine, mainTriggerCallback, eventIndex, rpm);
|
handleFuel(mainTriggerCallback->engine, mainTriggerCallback, eventIndex, rpm);
|
||||||
handleSpark(mainTriggerCallback, eventIndex, rpm,
|
handleSpark(mainTriggerCallback, eventIndex, rpm,
|
||||||
&mainTriggerCallback->engineConfiguration2->ignitionEvents[revolutionIndex]);
|
&mainTriggerCallback->engineConfiguration2->ignitionEvents[revolutionIndex]);
|
||||||
#if EFI_HISTOGRAMS && EFI_PROD_CODE
|
#if EFI_HISTOGRAMS && EFI_PROD_CODE
|
||||||
|
@ -340,7 +337,7 @@ static void showMainInfo(Engine *engine) {
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
scheduleMsg(&logger, "rpm %d engine_load %f", rpm, el);
|
scheduleMsg(&logger, "rpm %d engine_load %f", rpm, el);
|
||||||
scheduleMsg(&logger, "fuel %fms timing %f", getFuelMs(rpm, mainTriggerCallbackInstance.engine),
|
scheduleMsg(&logger, "fuel %fms timing %f", getFuelMs(rpm, mainTriggerCallbackInstance.engine),
|
||||||
getAdvance(rpm, el));
|
getAdvance(mainTriggerCallbackInstance.engine->engineConfiguration, rpm, el));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, v
|
||||||
extern Engine engine;
|
extern Engine engine;
|
||||||
|
|
||||||
void hwHandleShaftSignal(trigger_event_e signal) {
|
void hwHandleShaftSignal(trigger_event_e signal) {
|
||||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#8");
|
efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowstck#8");
|
||||||
triggerCentral.handleShaftSignal(&engine, signal);
|
triggerCentral.handleShaftSignal(&engine, signal);
|
||||||
}
|
}
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
@ -94,9 +94,6 @@ static void reportEventToWaveChart(trigger_event_e ckpSignalType, int index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: improve this
|
|
||||||
extern Engine engine;
|
|
||||||
|
|
||||||
void TriggerCentral::handleShaftSignal(Engine *engine, trigger_event_e signal) {
|
void TriggerCentral::handleShaftSignal(Engine *engine, trigger_event_e signal) {
|
||||||
efiAssertVoid(engine!=NULL, "configuration");
|
efiAssertVoid(engine!=NULL, "configuration");
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ static LocalVersionHolder localVersion;
|
||||||
|
|
||||||
extern Engine engine;
|
extern Engine engine;
|
||||||
|
|
||||||
void setTriggerEmulatorRPM(int rpm) {
|
void setTriggerEmulatorRPM(int rpm, Engine *engine) {
|
||||||
engineConfiguration->bc.triggerSimulatorFrequency = rpm;
|
engineConfiguration->bc.triggerSimulatorFrequency = rpm;
|
||||||
/**
|
/**
|
||||||
* All we need to do here is to change the periodMs
|
* All we need to do here is to change the periodMs
|
||||||
|
@ -125,11 +125,11 @@ static void emulatorApplyPinState(PwmConfig *state, int stateIndex) {
|
||||||
}
|
}
|
||||||
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
||||||
|
|
||||||
static void setEmulatorAtIndex(int index) {
|
static void setEmulatorAtIndex(int index, Engine *engine) {
|
||||||
stopEmulationAtIndex = index;
|
stopEmulationAtIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resumeStimulator(void) {
|
static void resumeStimulator(Engine *engine) {
|
||||||
isEmulating = true;
|
isEmulating = true;
|
||||||
stopEmulationAtIndex = DO_NOT_STOP;
|
stopEmulationAtIndex = DO_NOT_STOP;
|
||||||
}
|
}
|
||||||
|
@ -138,14 +138,14 @@ void initTriggerEmulatorLogic(Engine *engine) {
|
||||||
initLogging(&logger, "position sensor(s) emulator");
|
initLogging(&logger, "position sensor(s) emulator");
|
||||||
|
|
||||||
trigger_shape_s *s = &engineConfiguration2->triggerShape;
|
trigger_shape_s *s = &engineConfiguration2->triggerShape;
|
||||||
setTriggerEmulatorRPM(engineConfiguration->bc.triggerSimulatorFrequency);
|
setTriggerEmulatorRPM(engineConfiguration->bc.triggerSimulatorFrequency, engine);
|
||||||
int *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = { s->wave.waves[0].pinStates, s->wave.waves[1].pinStates,
|
int *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = { s->wave.waves[0].pinStates, s->wave.waves[1].pinStates,
|
||||||
s->wave.waves[2].pinStates };
|
s->wave.waves[2].pinStates };
|
||||||
weComplexInit("position sensor", &triggerSignal, s->getSize(), s->wave.switchTimes, PWM_PHASE_MAX_WAVE_PER_PWM,
|
weComplexInit("position sensor", &triggerSignal, s->getSize(), s->wave.switchTimes, PWM_PHASE_MAX_WAVE_PER_PWM,
|
||||||
pinStates, updateTriggerShapeIfNeeded, emulatorApplyPinState);
|
pinStates, updateTriggerShapeIfNeeded, emulatorApplyPinState);
|
||||||
|
|
||||||
addConsoleActionI("rpm", &setTriggerEmulatorRPM);
|
addConsoleActionIP("rpm", (VoidIntVoidPtr)setTriggerEmulatorRPM, engine);
|
||||||
addConsoleActionI("stop_stimulator_at_index", setEmulatorAtIndex);
|
addConsoleActionIP("stop_stimulator_at_index", (VoidIntVoidPtr)setEmulatorAtIndex, engine);
|
||||||
addConsoleAction("resume_stimulator", resumeStimulator);
|
addConsoleActionP("resume_stimulator", (VoidPtr) resumeStimulator, engine);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#include "trigger_emulator.h"
|
#include "trigger_emulator.h"
|
||||||
|
|
||||||
|
|
||||||
static THD_WORKING_AREA(eeThreadStack, UTILITY_THREAD_STACK_SIZE);
|
static THD_WORKING_AREA(eeThreadStack, UTILITY_THREAD_STACK_SIZE);
|
||||||
|
|
||||||
#define DIAG_PORT GPIOD
|
#define DIAG_PORT GPIOD
|
||||||
|
@ -35,7 +34,7 @@ void setDiag(int value) {
|
||||||
|
|
||||||
#define PERIOD 3000
|
#define PERIOD 3000
|
||||||
|
|
||||||
void emulate(void) {
|
void emulate(Engine *engine) {
|
||||||
print("Emulating...\r\n");
|
print("Emulating...\r\n");
|
||||||
setDiag(1);
|
setDiag(1);
|
||||||
chThdSleep(1);
|
chThdSleep(1);
|
||||||
|
@ -44,11 +43,11 @@ void emulate(void) {
|
||||||
for (int i = 400; i <= 1300; i++) {
|
for (int i = 400; i <= 1300; i++) {
|
||||||
if (i % 50 != 0)
|
if (i % 50 != 0)
|
||||||
continue;
|
continue;
|
||||||
setTriggerEmulatorRPM(i);
|
setTriggerEmulatorRPM(i, engine);
|
||||||
chThdSleepMilliseconds(PERIOD);
|
chThdSleepMilliseconds(PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTriggerEmulatorRPM(0);
|
setTriggerEmulatorRPM(0, engine);
|
||||||
|
|
||||||
setFullLog(0);
|
setFullLog(0);
|
||||||
setDiag(0);
|
setDiag(0);
|
||||||
|
@ -58,15 +57,14 @@ void emulate(void) {
|
||||||
|
|
||||||
static int flag = FALSE;
|
static int flag = FALSE;
|
||||||
|
|
||||||
static msg_t eeThread(void *arg) {
|
static msg_t eeThread(Engine *engine) {
|
||||||
(void)arg;
|
|
||||||
chRegSetThreadName("Engine");
|
chRegSetThreadName("Engine");
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
while (!flag)
|
while (!flag)
|
||||||
chThdSleepMilliseconds(200);
|
chThdSleepMilliseconds(200);
|
||||||
flag = FALSE;
|
flag = FALSE;
|
||||||
emulate();
|
emulate(engine);
|
||||||
}
|
}
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
return (msg_t)NULL;
|
return (msg_t)NULL;
|
||||||
|
@ -77,22 +75,22 @@ void startEmulator(void) {
|
||||||
flag = TRUE;
|
flag = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printAdvance(int rpm, int maf100) {
|
//static void printAdvance(int rpm, int maf100) {
|
||||||
float advance = getAdvance(rpm, maf100 / 100.0);
|
// float advance = getAdvance(rpm, maf100 / 100.0);
|
||||||
print("advance for %d rpm %d maf100: %f\r\n", rpm, maf100, advance);
|
// print("advance for %d rpm %d maf100: %f\r\n", rpm, maf100, advance);
|
||||||
}
|
//}
|
||||||
|
|
||||||
static void initECUstimulator(void) {
|
static void initECUstimulator(Engine *engine) {
|
||||||
mySetPadMode("TEN", DIAG_PORT, DIAG_PIN,
|
mySetPadMode("TEN", DIAG_PORT, DIAG_PIN,
|
||||||
PAL_MODE_OUTPUT_PUSHPULL);
|
PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
|
||||||
addConsoleActionI("diag", setDiag);
|
addConsoleActionI("diag", setDiag);
|
||||||
addConsoleAction("emu", startEmulator);
|
addConsoleAction("emu", startEmulator);
|
||||||
addConsoleActionII("ad", printAdvance);
|
// addConsoleActionII("ad", printAdvance);
|
||||||
|
|
||||||
setDiag(1);
|
setDiag(1);
|
||||||
|
|
||||||
chThdCreateStatic(eeThreadStack, sizeof(eeThreadStack), NORMALPRIO, (tfunc_t) eeThread, NULL);
|
chThdCreateStatic(eeThreadStack, sizeof(eeThreadStack), NORMALPRIO, (tfunc_t) eeThread, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initEngineEmulator(Engine *engine) {
|
void initEngineEmulator(Engine *engine) {
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
void initTriggerEmulator(Engine *engine);
|
void initTriggerEmulator(Engine *engine);
|
||||||
void setTriggerEmulatorRPM(int value);
|
void setTriggerEmulatorRPM(int value, Engine *engine);
|
||||||
|
|
||||||
#endif /* DIST_EMULATOR_H_ */
|
#endif /* DIST_EMULATOR_H_ */
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
|
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
|
||||||
|
|
||||||
|
#define INLINE inline
|
||||||
|
|
||||||
typedef int bool_t;
|
typedef int bool_t;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "engine_test_helper.h"
|
#include "engine_test_helper.h"
|
||||||
#include "speed_density.h"
|
#include "speed_density.h"
|
||||||
|
|
||||||
Engine engine;
|
//Engine engine;
|
||||||
|
|
||||||
extern int timeNow;
|
extern int timeNow;
|
||||||
|
|
||||||
|
@ -407,8 +407,8 @@ static void testRpmCalculator(void) {
|
||||||
eth.initTriggerShapeAndRpmCalculator();
|
eth.initTriggerShapeAndRpmCalculator();
|
||||||
|
|
||||||
// this is a very dirty and sad hack. todo: eliminate
|
// this is a very dirty and sad hack. todo: eliminate
|
||||||
engine.engineConfiguration = eth.engine.engineConfiguration;
|
// engine.engineConfiguration = eth.engine.engineConfiguration;
|
||||||
engine.engineConfiguration->injectorLag = 0.0;
|
eth.engine.engineConfiguration->injectorLag = 0.0;
|
||||||
|
|
||||||
timeNow = 0;
|
timeNow = 0;
|
||||||
assertEquals(0, eth.rpmState.rpm());
|
assertEquals(0, eth.rpmState.rpm());
|
||||||
|
@ -421,15 +421,17 @@ static void testRpmCalculator(void) {
|
||||||
triggerCallbackInstance.init(ð.engine, ec2);
|
triggerCallbackInstance.init(ð.engine, ec2);
|
||||||
eth.triggerCentral.addEventListener((ShaftPositionListener)&onTriggerEvent, "main loop", &triggerCallbackInstance);
|
eth.triggerCentral.addEventListener((ShaftPositionListener)&onTriggerEvent, "main loop", &triggerCallbackInstance);
|
||||||
|
|
||||||
engine.rpmCalculator = ð.rpmState;
|
eth.engine.rpmCalculator = ð.rpmState;
|
||||||
|
|
||||||
|
// engine.rpmCalculator = ð.rpmState;
|
||||||
prepareTimingMap();
|
prepareTimingMap();
|
||||||
|
|
||||||
timeNow += 5000; // 5ms
|
timeNow += 5000; // 5ms
|
||||||
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP);
|
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP);
|
||||||
assertEqualsM("index #2", 0, eth.triggerCentral.triggerState.getCurrentIndex());
|
assertEqualsM("index #2", 0, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||||
assertEqualsM("queue size", 4, schedulingQueue.size());
|
assertEqualsM("queue size", 6, schedulingQueue.size());
|
||||||
assertEqualsM("ev 1", 248000, schedulingQueue.getForUnitText(0)->momentUs);
|
assertEqualsM("ev 1", 246444, schedulingQueue.getForUnitText(0)->momentUs);
|
||||||
assertEqualsM("ev 2", 245000, schedulingQueue.getForUnitText(1)->momentUs);
|
assertEqualsM("ev 2", 245944, schedulingQueue.getForUnitText(1)->momentUs);
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
|
||||||
timeNow += 5000;
|
timeNow += 5000;
|
||||||
|
@ -440,8 +442,8 @@ static void testRpmCalculator(void) {
|
||||||
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN);
|
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN);
|
||||||
assertEqualsM("index #3", 3, eth.triggerCentral.triggerState.getCurrentIndex());
|
assertEqualsM("index #3", 3, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||||
assertEqualsM("queue size 3", 6, schedulingQueue.size());
|
assertEqualsM("queue size 3", 6, schedulingQueue.size());
|
||||||
assertEquals(258333, schedulingQueue.getForUnitText(0)->momentUs);
|
assertEqualsM("ev 3", 259777, schedulingQueue.getForUnitText(0)->momentUs);
|
||||||
assertEquals(257833, schedulingQueue.getForUnitText(1)->momentUs);
|
assertEquals(259277, schedulingQueue.getForUnitText(1)->momentUs);
|
||||||
assertEqualsM("ev 5", 261333, schedulingQueue.getForUnitText(2)->momentUs);
|
assertEqualsM("ev 5", 261333, schedulingQueue.getForUnitText(2)->momentUs);
|
||||||
assertEqualsM("3/3", 258333, schedulingQueue.getForUnitText(3)->momentUs);
|
assertEqualsM("3/3", 258333, schedulingQueue.getForUnitText(3)->momentUs);
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
@ -454,21 +456,21 @@ static void testRpmCalculator(void) {
|
||||||
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP);
|
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP);
|
||||||
assertEqualsM("index #4", 6, eth.triggerCentral.triggerState.getCurrentIndex());
|
assertEqualsM("index #4", 6, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||||
assertEqualsM("queue size 4", 6, schedulingQueue.size());
|
assertEqualsM("queue size 4", 6, schedulingQueue.size());
|
||||||
assertEqualsM("4/0", 271666, schedulingQueue.getForUnitText(0)->momentUs);
|
assertEqualsM("4/0", 273111, schedulingQueue.getForUnitText(0)->momentUs);
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
|
||||||
timeNow += 5000;
|
timeNow += 5000;
|
||||||
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN);
|
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN);
|
||||||
assertEqualsM("queue size 5", 1, schedulingQueue.size());
|
assertEqualsM("queue size 5", 0, schedulingQueue.size());
|
||||||
assertEqualsM("5/1", 284500, schedulingQueue.getForUnitText(0)->momentUs);
|
// assertEqualsM("5/1", 284500, schedulingQueue.getForUnitText(0)->momentUs);
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
|
||||||
timeNow += 5000; // 5ms
|
timeNow += 5000; // 5ms
|
||||||
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP);
|
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP);
|
||||||
assertEqualsM("queue size 6", 5, schedulingQueue.size());
|
assertEqualsM("queue size 6", 6, schedulingQueue.size());
|
||||||
assertEqualsM("6/0", 285000, schedulingQueue.getForUnitText(0)->momentUs);
|
assertEqualsM("6/0", 286444, schedulingQueue.getForUnitText(0)->momentUs);
|
||||||
assertEqualsM("6/1", 288000, schedulingQueue.getForUnitText(1)->momentUs);
|
assertEqualsM("6/1", 285944, schedulingQueue.getForUnitText(1)->momentUs);
|
||||||
assertEqualsM("6/0", 285000, schedulingQueue.getForUnitText(2)->momentUs);
|
assertEqualsM("6/2", 288000, schedulingQueue.getForUnitText(2)->momentUs);
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
|
||||||
timeNow += 5000;
|
timeNow += 5000;
|
||||||
|
@ -479,8 +481,8 @@ static void testRpmCalculator(void) {
|
||||||
timeNow += 5000; // 5ms
|
timeNow += 5000; // 5ms
|
||||||
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP);
|
eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP);
|
||||||
assertEqualsM("queue size 8", 6, schedulingQueue.size());
|
assertEqualsM("queue size 8", 6, schedulingQueue.size());
|
||||||
assertEqualsM("8/0", 298333, schedulingQueue.getForUnitText(0)->momentUs);
|
assertEqualsM("8/0", 299777, schedulingQueue.getForUnitText(0)->momentUs);
|
||||||
assertEqualsM("8/1", 297833, schedulingQueue.getForUnitText(1)->momentUs);
|
assertEqualsM("8/1", 299277, schedulingQueue.getForUnitText(1)->momentUs);
|
||||||
assertEqualsM("8/2", 301333, schedulingQueue.getForUnitText(2)->momentUs);
|
assertEqualsM("8/2", 301333, schedulingQueue.getForUnitText(2)->momentUs);
|
||||||
assertEqualsM("8/3", 298333, schedulingQueue.getForUnitText(3)->momentUs);
|
assertEqualsM("8/3", 298333, schedulingQueue.getForUnitText(3)->momentUs);
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
|
Loading…
Reference in New Issue