auto-sync

This commit is contained in:
rusEfi 2015-04-17 00:04:52 -04:00
parent 6c1c1acd65
commit 96bbd2741a
3 changed files with 14 additions and 7 deletions

View File

@ -57,9 +57,6 @@ Executor::Executor() {
queue.setLateDelay(US2NT(100)); queue.setLateDelay(US2NT(100));
} }
#define lock() lockAnyContext()
#define unlock() unlockAnyContext()
void Executor::scheduleByTime(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void Executor::scheduleByTime(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback,
void *param) { void *param) {
// if (delayUs < 0) { // if (delayUs < 0) {
@ -72,12 +69,12 @@ void Executor::scheduleByTime(scheduling_s *scheduling, efitimeus_t timeUs, schf
// } // }
if (!reentrantFlag) { if (!reentrantFlag) {
// this would guard the queue and disable interrupts // this would guard the queue and disable interrupts
lock(); lockAnyContext();
} }
queue.insertTask(scheduling, US2NT(timeUs), callback, param); queue.insertTask(scheduling, US2NT(timeUs), callback, param);
if (!reentrantFlag) { if (!reentrantFlag) {
doExecute(); doExecute();
unlock(); unlockAnyContext();
} }
} }
@ -87,9 +84,9 @@ void Executor::schedule(scheduling_s *scheduling, uint64_t nowUs, int delayUs, s
} }
void Executor::onTimerCallback() { void Executor::onTimerCallback() {
lock(); lockAnyContext();
doExecute(); doExecute();
unlock(); unlockAnyContext();
} }
/* /*

View File

@ -223,6 +223,8 @@ extern PwmConfig triggerSignal;
extern uint32_t maxLockTime; extern uint32_t maxLockTime;
extern uint32_t maxEventQueueTime; extern uint32_t maxEventQueueTime;
extern uint32_t hipLastExecutionCount;
extern uint32_t hwSetTimerTime;
void triggerInfo(Engine *engine) { void triggerInfo(Engine *engine) {
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) #if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
@ -302,6 +304,9 @@ void triggerInfo(Engine *engine) {
scheduleMsg(logger, "maxLockTime=%d / maxTriggerReentraint=%d", maxLockTime, maxTriggerReentraint); scheduleMsg(logger, "maxLockTime=%d / maxTriggerReentraint=%d", maxLockTime, maxTriggerReentraint);
scheduleMsg(logger, "maxEventQueueTime=%d", maxEventQueueTime); scheduleMsg(logger, "maxEventQueueTime=%d", maxEventQueueTime);
scheduleMsg(logger, "hipLastExecutionCount=%d", hipLastExecutionCount);
scheduleMsg(logger, "hwSetTimerTime %d", hwSetTimerTime);
scheduleMsg(logger, "totalTriggerHandlerMaxTime=%d", triggerMaxDuration); scheduleMsg(logger, "totalTriggerHandlerMaxTime=%d", triggerMaxDuration);
triggerMaxDuration = 0; triggerMaxDuration = 0;

View File

@ -42,6 +42,10 @@ static OutputPin hipCs;
extern pin_output_mode_e DEFAULT_OUTPUT; extern pin_output_mode_e DEFAULT_OUTPUT;
extern uint32_t lastExecutionCount;
uint32_t hipLastExecutionCount;
/** /**
* band index is only send to HIP chip on startup * band index is only send to HIP chip on startup
*/ */
@ -174,6 +178,7 @@ static void intHoldCallback(trigger_event_e ckpEventType, uint32_t index DECLARE
// todo: schedule this based on closest trigger event, same as ignition works // todo: schedule this based on closest trigger event, same as ignition works
scheduleByAngle(rpm, &startTimer[structIndex], engineConfiguration->knockDetectionWindowStart, scheduleByAngle(rpm, &startTimer[structIndex], engineConfiguration->knockDetectionWindowStart,
(schfunc_t) &startIntegration, NULL, &engine->rpmCalculator); (schfunc_t) &startIntegration, NULL, &engine->rpmCalculator);
hipLastExecutionCount = lastExecutionCount;
scheduleByAngle(rpm, &endTimer[structIndex], engineConfiguration->knockDetectionWindowEnd, scheduleByAngle(rpm, &endTimer[structIndex], engineConfiguration->knockDetectionWindowEnd,
(schfunc_t) &endIntegration, (schfunc_t) &endIntegration,
NULL, &engine->rpmCalculator); NULL, &engine->rpmCalculator);