mirror of https://github.com/rusefi/rusefi.git
FATAL on NB2 tune jim stim input signal #2965
This commit is contained in:
parent
d475b4721f
commit
e1c41ff798
|
@ -44,7 +44,7 @@ static void toggleTestAndScheduleNext(void *) {
|
||||||
testPin.toggle();
|
testPin.toggle();
|
||||||
periodIndex = (periodIndex + 1) % TEST_LEN;
|
periodIndex = (periodIndex + 1) % TEST_LEN;
|
||||||
testTime += test557[periodIndex];
|
testTime += test557[periodIndex];
|
||||||
engine->executor.scheduleByTimestamp(&testScheduling, testTime, &toggleTestAndScheduleNext);
|
engine->executor.scheduleByTimestamp("test", &testScheduling, testTime, &toggleTestAndScheduleNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -102,8 +102,8 @@ static void runBench(brain_pin_e brainPin, OutputPin *output, float delayMs, flo
|
||||||
efitick_t endTime = startTime + US2NT(onTimeUs);
|
efitick_t endTime = startTime + US2NT(onTimeUs);
|
||||||
|
|
||||||
// Schedule both events
|
// Schedule both events
|
||||||
engine->executor.scheduleByTimestampNt(&benchSchedStart, startTime, {benchOn, output});
|
engine->executor.scheduleByTimestampNt("bstart", &benchSchedStart, startTime, {benchOn, output});
|
||||||
engine->executor.scheduleByTimestampNt(&benchSchedEnd, endTime, {benchOff, output});
|
engine->executor.scheduleByTimestampNt("bend", &benchSchedEnd, endTime, {benchOff, output});
|
||||||
|
|
||||||
// Wait one full cycle time for the event + delay to happen
|
// Wait one full cycle time for the event + delay to happen
|
||||||
chThdSleepMicroseconds(onTimeUs + offTimeUs);
|
chThdSleepMicroseconds(onTimeUs + offTimeUs);
|
||||||
|
|
|
@ -296,7 +296,7 @@ void InjectionEvent::onTriggerTooth(size_t trgEventIndex, int rpm, efitick_t now
|
||||||
|
|
||||||
efitick_t startTime = scheduleByAngle(&signalTimerUp, nowNt, injectionStart.angleOffsetFromTriggerEvent, startAction PASS_ENGINE_PARAMETER_SUFFIX);
|
efitick_t startTime = scheduleByAngle(&signalTimerUp, nowNt, injectionStart.angleOffsetFromTriggerEvent, startAction PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
efitick_t turnOffTime = startTime + US2NT((int)durationUs);
|
efitick_t turnOffTime = startTime + US2NT((int)durationUs);
|
||||||
engine->executor.scheduleByTimestampNt(&endOfInjectionEvent, turnOffTime, endAction);
|
engine->executor.scheduleByTimestampNt("inj", &endOfInjectionEvent, turnOffTime, endAction);
|
||||||
|
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
printf("scheduling injection angle=%.2f/delay=%.2f injectionDuration=%.2f\r\n", injectionStart.angleOffsetFromTriggerEvent, NT2US(startTime - nowNt), injectionDuration);
|
printf("scheduling injection angle=%.2f/delay=%.2f injectionDuration=%.2f\r\n", injectionStart.angleOffsetFromTriggerEvent, NT2US(startTime - nowNt), injectionDuration);
|
||||||
|
|
|
@ -404,7 +404,7 @@ efitick_t scheduleByAngle(scheduling_s *timer, efitick_t edgeTimestamp, angle_t
|
||||||
int32_t delayNt = USF2NT(delayUs);
|
int32_t delayNt = USF2NT(delayUs);
|
||||||
efitime_t delayedTime = edgeTimestamp + delayNt;
|
efitime_t delayedTime = edgeTimestamp + delayNt;
|
||||||
|
|
||||||
ENGINE(executor.scheduleByTimestampNt(timer, delayedTime, action));
|
ENGINE(executor.scheduleByTimestampNt("angle", timer, delayedTime, action));
|
||||||
|
|
||||||
return delayedTime;
|
return delayedTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,8 +201,8 @@ if (engineConfiguration->debugMode == DBG_DWELL_METRIC) {
|
||||||
efitick_t nextFiring = nextDwellStart + engine->engineState.multispark.dwell;
|
efitick_t nextFiring = nextDwellStart + engine->engineState.multispark.dwell;
|
||||||
|
|
||||||
// We can schedule both of these right away, since we're going for "asap" not "particular angle"
|
// We can schedule both of these right away, since we're going for "asap" not "particular angle"
|
||||||
engine->executor.scheduleByTimestampNt(&event->dwellStartTimer, nextDwellStart, { &turnSparkPinHigh, event });
|
engine->executor.scheduleByTimestampNt("dwell", &event->dwellStartTimer, nextDwellStart, { &turnSparkPinHigh, event });
|
||||||
engine->executor.scheduleByTimestampNt(&event->sparkEvent.scheduling, nextFiring, { fireSparkAndPrepareNextSchedule, event });
|
engine->executor.scheduleByTimestampNt("firing", &event->sparkEvent.scheduling, nextFiring, { fireSparkAndPrepareNextSchedule, event });
|
||||||
} else {
|
} else {
|
||||||
if (CONFIG(enableTrailingSparks)) {
|
if (CONFIG(enableTrailingSparks)) {
|
||||||
// Trailing sparks are enabled - schedule an event for the corresponding trailing coil
|
// Trailing sparks are enabled - schedule an event for the corresponding trailing coil
|
||||||
|
|
|
@ -269,7 +269,7 @@ static void timerCallback(PwmConfig *state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->executor->scheduleByTimestampNt(&state->scheduling, switchTimeNt, { timerCallback, state });
|
state->executor->scheduleByTimestampNt("pwm", &state->scheduling, switchTimeNt, { timerCallback, state });
|
||||||
state->dbgNestingLevel--;
|
state->dbgNestingLevel--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct ExecutorInterface {
|
||||||
/**
|
/**
|
||||||
* see also scheduleByAngle
|
* see also scheduleByAngle
|
||||||
*/
|
*/
|
||||||
virtual void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) = 0;
|
virtual void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) = 0;
|
||||||
virtual void scheduleByTimestampNt(scheduling_s *scheduling, efitime_t timeUs, action_s action) = 0;
|
virtual void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitime_t timeUs, action_s action) = 0;
|
||||||
virtual void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) = 0;
|
virtual void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,12 +38,12 @@ bool printSchedulerDebug = true;
|
||||||
|
|
||||||
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
||||||
|
|
||||||
void SleepExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
void SleepExecutor::scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
||||||
scheduleForLater(scheduling, timeUs - getTimeNowUs(), action);
|
scheduleForLater(scheduling, timeUs - getTimeNowUs(), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SleepExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
void SleepExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
||||||
scheduleByTimestamp(scheduling, NT2US(timeNt), action);
|
scheduleByTimestamp(msg, scheduling, NT2US(timeNt), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void timerCallback(scheduling_s *scheduling) {
|
static void timerCallback(scheduling_s *scheduling) {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
class SleepExecutor : public ExecutorInterface {
|
class SleepExecutor : public ExecutorInterface {
|
||||||
public:
|
public:
|
||||||
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
||||||
void scheduleByTimestampNt(scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
||||||
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,7 +50,7 @@ SingleTimerExecutor::SingleTimerExecutor()
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleTimerExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) {
|
void SingleTimerExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) {
|
||||||
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, action);
|
scheduleByTimestamp("scheduleForLater", scheduling, getTimeNowUs() + delayUs, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,11 +63,11 @@ void SingleTimerExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs
|
||||||
* @param [in] delayUs the number of microseconds before the output signal immediate output if delay is zero.
|
* @param [in] delayUs the number of microseconds before the output signal immediate output if delay is zero.
|
||||||
* @param [in] dwell the number of ticks of output duration.
|
* @param [in] dwell the number of ticks of output duration.
|
||||||
*/
|
*/
|
||||||
void SingleTimerExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
void SingleTimerExecutor::scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
||||||
scheduleByTimestampNt(scheduling, US2NT(timeUs), action);
|
scheduleByTimestampNt(msg, scheduling, US2NT(timeUs), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleTimerExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitime_t nt, action_s action) {
|
void SingleTimerExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitime_t nt, action_s action) {
|
||||||
ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp);
|
ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp);
|
||||||
|
|
||||||
#if EFI_ENABLE_ASSERTS
|
#if EFI_ENABLE_ASSERTS
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
class SingleTimerExecutor final : public ExecutorInterface {
|
class SingleTimerExecutor final : public ExecutorInterface {
|
||||||
public:
|
public:
|
||||||
SingleTimerExecutor();
|
SingleTimerExecutor();
|
||||||
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
||||||
void scheduleByTimestampNt(scheduling_s *scheduling, efitime_t timeNt, action_s action) override;
|
void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitime_t timeNt, action_s action) override;
|
||||||
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
||||||
void onTimerCallback();
|
void onTimerCallback();
|
||||||
int timerCallbackCounter = 0;
|
int timerCallbackCounter = 0;
|
||||||
|
|
|
@ -200,7 +200,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
writePad("cam debug", CONFIG(camInputsDebug[index]), 1);
|
writePad("cam debug", CONFIG(camInputsDebug[index]), 1);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
engine->executor.scheduleByTimestamp(&debugToggleScheduling, nowNt + DEBUG_PIN_DELAY, &turnOffAllDebugFields);
|
engine->executor.scheduleByTimestamp("dbg_on", &debugToggleScheduling, nowNt + DEBUG_PIN_DELAY, &turnOffAllDebugFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONFIG(displayLogicLevelsInEngineSniffer) && isImportantFront) {
|
if (CONFIG(displayLogicLevelsInEngineSniffer) && isImportantFront) {
|
||||||
|
@ -421,7 +421,7 @@ void handleShaftSignal(int signalIndex, bool isRising, efitick_t timestamp DECLA
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
writePad("trigger debug", CONFIG(triggerInputDebugPins[signalIndex]), 1);
|
writePad("trigger debug", CONFIG(triggerInputDebugPins[signalIndex]), 1);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
engine->executor.scheduleByTimestamp(&debugToggleScheduling, timestamp + DEBUG_PIN_DELAY, &turnOffAllDebugFields);
|
engine->executor.scheduleByTimestamp("dbg_off", &debugToggleScheduling, timestamp + DEBUG_PIN_DELAY, &turnOffAllDebugFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_TOOTH_LOGGER
|
#if EFI_TOOTH_LOGGER
|
||||||
|
|
|
@ -24,7 +24,7 @@ void TestExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, actio
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, action);
|
scheduleByTimestamp("test", scheduling, getTimeNowUs() + delayUs, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestExecutor::executeAll(efitime_t now) {
|
int TestExecutor::executeAll(efitime_t now) {
|
||||||
|
@ -47,26 +47,26 @@ scheduling_s* TestExecutor::getForUnitTest(int index) {
|
||||||
return schedulingQueue.getElementAtIndexForUnitText(index);
|
return schedulingQueue.getElementAtIndexForUnitText(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
void TestExecutor::scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
||||||
if (debugSignalExecutor) {
|
if (debugSignalExecutor) {
|
||||||
printf("scheduleByTime %d\r\n", timeUs);
|
printf("scheduleByTime %d\r\n", timeUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_mockExecutor) {
|
if (m_mockExecutor) {
|
||||||
m_mockExecutor->scheduleByTimestamp(scheduling, timeUs, action);
|
m_mockExecutor->scheduleByTimestamp("test", scheduling, timeUs, action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
schedulingQueue.insertTask(scheduling, timeUs, action);
|
schedulingQueue.insertTask(scheduling, timeUs, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
void TestExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
||||||
if (m_mockExecutor) {
|
if (m_mockExecutor) {
|
||||||
m_mockExecutor->scheduleByTimestampNt(scheduling, timeNt, action);
|
m_mockExecutor->scheduleByTimestampNt(msg, scheduling, timeNt, action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduleByTimestamp(scheduling, NT2US(timeNt), action);
|
scheduleByTimestamp("test", scheduling, NT2US(timeNt), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestExecutor::setMockExecutor(ExecutorInterface* exec) {
|
void TestExecutor::setMockExecutor(ExecutorInterface* exec) {
|
||||||
|
|
|
@ -14,8 +14,8 @@ class TestExecutor : public ExecutorInterface {
|
||||||
public:
|
public:
|
||||||
~TestExecutor();
|
~TestExecutor();
|
||||||
|
|
||||||
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
||||||
void scheduleByTimestampNt(scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
||||||
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
||||||
void clear();
|
void clear();
|
||||||
int executeAll(efitime_t now);
|
int executeAll(efitime_t now);
|
||||||
|
|
|
@ -54,8 +54,8 @@ public:
|
||||||
|
|
||||||
class MockExecutor : public TestExecutor {
|
class MockExecutor : public TestExecutor {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD(void, scheduleByTimestamp, (scheduling_s *scheduling, efitimeus_t timeUs, action_s action), (override));
|
MOCK_METHOD(void, scheduleByTimestamp, (const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action), (override));
|
||||||
MOCK_METHOD(void, scheduleByTimestampNt, (scheduling_s *scheduling, efitime_t timeUs, action_s action), (override));
|
MOCK_METHOD(void, scheduleByTimestampNt, (const char *msg, scheduling_s *scheduling, efitime_t timeUs, action_s action), (override));
|
||||||
MOCK_METHOD(void, scheduleForLater, (scheduling_s *scheduling, int delayUs, action_s action), (override));
|
MOCK_METHOD(void, scheduleForLater, (scheduling_s *scheduling, int delayUs, action_s action), (override));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,9 @@ TEST(injectionScheduling, NormalDutyCycle) {
|
||||||
|
|
||||||
// Should schedule one normal injection:
|
// Should schedule one normal injection:
|
||||||
// rising edge now
|
// rising edge now
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(&event.signalTimerUp, nowNt + 0, _));
|
EXPECT_CALL(mockExec, scheduleByTimestampNt("test", &event.signalTimerUp, nowNt + 0, _));
|
||||||
// falling edge 10ms later
|
// falling edge 10ms later
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(&event.endOfInjectionEvent, nowNt + MS2NT(20), _));
|
EXPECT_CALL(mockExec, scheduleByTimestampNt("test", &event.endOfInjectionEvent, nowNt + MS2NT(20), _));
|
||||||
}
|
}
|
||||||
|
|
||||||
engine->rpmCalculator.oneDegreeUs = 100;
|
engine->rpmCalculator.oneDegreeUs = 100;
|
||||||
|
|
|
@ -58,7 +58,7 @@ static void scheduleTriggerEvents(TriggerWaveform *shape,
|
||||||
param->vvtBankIndex = vvtBankIndex;
|
param->vvtBankIndex = vvtBankIndex;
|
||||||
|
|
||||||
scheduling_s *sch = new scheduling_s();
|
scheduling_s *sch = new scheduling_s();
|
||||||
engine->executor.scheduleByTimestamp(sch, timeScale * 1000 * angle, { func, param });
|
engine->executor.scheduleByTimestamp("test", sch, timeScale * 1000 * angle, { func, param });
|
||||||
totalIndex++;
|
totalIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue