mirror of https://github.com/FOME-Tech/fome-fw.git
auto-sync
This commit is contained in:
parent
332bd7a9cc
commit
9b8af9e9f1
|
@ -11,7 +11,12 @@
|
||||||
#include "test_engine.h"
|
#include "test_engine.h"
|
||||||
|
|
||||||
void setTestEngineConfiguration(engine_configuration_s *engineConfiguration) {
|
void setTestEngineConfiguration(engine_configuration_s *engineConfiguration) {
|
||||||
engineConfiguration->triggerConfig.triggerType = TT_TOOTHED_WHEEL_60_2;
|
// engineConfiguration->triggerConfig.triggerType = TT_TOOTHED_WHEEL;
|
||||||
|
|
||||||
|
trigger_config_s *triggerConfig = &engineConfiguration->triggerConfig;
|
||||||
|
triggerConfig->customIsSynchronizationNeeded = false;
|
||||||
|
triggerConfig->customTotalToothCount = 60;
|
||||||
|
triggerConfig->customSkippedToothCount = 0;
|
||||||
|
|
||||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,23 @@ static Executor instance;
|
||||||
|
|
||||||
extern schfunc_t globalTimerCallback;
|
extern schfunc_t globalTimerCallback;
|
||||||
|
|
||||||
|
static int timerIsLate = 0;
|
||||||
|
/**
|
||||||
|
* these fields are global in order to facilitate debugging
|
||||||
|
*/
|
||||||
|
static uint64_t nextEventTimeNt = 0;
|
||||||
|
static uint64_t hwAlarmTime = 0;
|
||||||
|
static uint64_t callbackTime = 0;
|
||||||
|
|
||||||
static void executorCallback(void *arg) {
|
static void executorCallback(void *arg) {
|
||||||
(void)arg;
|
(void)arg;
|
||||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#2y");
|
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#2y");
|
||||||
|
|
||||||
|
// callbackTime = getTimeNowNt();
|
||||||
|
// if((callbackTime > nextEventTimeNt) && (callbackTime - nextEventTimeNt > US2NT(5000))) {
|
||||||
|
// timerIsLate++;
|
||||||
|
// }
|
||||||
|
|
||||||
instance.onTimerCallback();
|
instance.onTimerCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,12 +127,12 @@ void Executor::doExecute() {
|
||||||
/**
|
/**
|
||||||
* Let's set up the timer for the next execution
|
* Let's set up the timer for the next execution
|
||||||
*/
|
*/
|
||||||
uint64_t nextEventTimeNt = queue.getNextEventTime(nowNt);
|
nextEventTimeNt = queue.getNextEventTime(nowNt);
|
||||||
efiAssertVoid(nextEventTimeNt > nowNt, "setTimer constraint");
|
efiAssertVoid(nextEventTimeNt > nowNt, "setTimer constraint");
|
||||||
if (nextEventTimeNt == EMPTY_QUEUE)
|
if (nextEventTimeNt == EMPTY_QUEUE)
|
||||||
return; // no pending events in the queue
|
return; // no pending events in the queue
|
||||||
uint64_t delayUs = NT2US(nextEventTimeNt - nowNt);
|
hwAlarmTime = NT2US(nextEventTimeNt - nowNt);
|
||||||
setHardwareUsTimer(delayUs == 0 ? 1 : delayUs);
|
setHardwareUsTimer(hwAlarmTime == 0 ? 1 : hwAlarmTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue