auto-sync
This commit is contained in:
parent
9e79c4859c
commit
9cc4efd454
|
@ -127,7 +127,7 @@ void TriggerCentral::handleShaftSignal(Engine *engine, trigger_event_e signal) {
|
|||
/**
|
||||
* This invocation changes the state of triggerState
|
||||
*/
|
||||
triggerState.decodeTriggerEvent(triggerShape, &engine->engineConfiguration->triggerConfig, signal, nowUs);
|
||||
triggerState.decodeTriggerEvent(triggerShape, &engine->engineConfiguration->triggerConfig, signal, nowNt);
|
||||
|
||||
if (!triggerState.shaft_is_synchronized) {
|
||||
// we should not propagate event if we do not know where we are
|
||||
|
|
|
@ -102,7 +102,7 @@ static trigger_value_e eventType[6] = { TV_LOW, TV_HIGH, TV_LOW, TV_HIGH, TV_LOW
|
|||
* This method changes the state of trigger_state_s data structure according to the trigger event
|
||||
*/
|
||||
void TriggerState::decodeTriggerEvent(trigger_shape_s const*triggerShape, trigger_config_s const*triggerConfig,
|
||||
trigger_event_e const signal, uint64_t nowUs) {
|
||||
trigger_event_e const signal, uint64_t nowNt) {
|
||||
(void) triggerConfig; // we might want this for logging?
|
||||
efiAssertVoid(signal <= SHAFT_3RD_UP, "unexpected signal");
|
||||
|
||||
|
@ -117,16 +117,16 @@ void TriggerState::decodeTriggerEvent(trigger_shape_s const*triggerShape, trigge
|
|||
/**
|
||||
* For less important events we simply increment the index.
|
||||
*/
|
||||
nextTriggerEvent(triggerWheel, nowUs);
|
||||
nextTriggerEvent(triggerWheel, nowNt);
|
||||
if (triggerShape->gapBothDirections) {
|
||||
toothed_previous_duration = getCurrentGapDuration(nowUs);
|
||||
toothed_previous_duration = getCurrentGapDuration(nowNt);
|
||||
isFirstEvent = false;
|
||||
toothed_previous_time = nowUs;
|
||||
toothed_previous_time = nowNt;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int64_t currentDuration = getCurrentGapDuration(nowUs);
|
||||
int64_t currentDuration = getCurrentGapDuration(nowNt);
|
||||
isFirstEvent = false;
|
||||
efiAssertVoid(currentDuration >= 0, "decode: negative duration?");
|
||||
|
||||
|
@ -164,15 +164,15 @@ void TriggerState::decodeTriggerEvent(trigger_shape_s const*triggerShape, trigge
|
|||
|
||||
shaft_is_synchronized = true;
|
||||
// this call would update duty cycle values
|
||||
nextTriggerEvent(triggerWheel, nowUs);
|
||||
nextTriggerEvent(triggerWheel, nowNt);
|
||||
|
||||
nextRevolution(triggerShape->shaftPositionEventCount, nowUs);
|
||||
nextRevolution(triggerShape->shaftPositionEventCount, nowNt);
|
||||
} else {
|
||||
nextTriggerEvent(triggerWheel, nowUs);
|
||||
nextTriggerEvent(triggerWheel, nowNt);
|
||||
}
|
||||
|
||||
toothed_previous_duration = currentDuration;
|
||||
toothed_previous_time = nowUs;
|
||||
toothed_previous_time = nowNt;
|
||||
}
|
||||
|
||||
static void initializeSkippedToothTriggerShape(trigger_shape_s *s, int totalTeethCount, int skippedCount,
|
||||
|
|
|
@ -137,13 +137,13 @@ uint64_t TriggerState::getTotalEventCounter() {
|
|||
return totalEventCountBase + current_index;
|
||||
}
|
||||
|
||||
void TriggerState::nextRevolution(int triggerEventCount, uint64_t nowUs) {
|
||||
void TriggerState::nextRevolution(int triggerEventCount, uint64_t nowNt) {
|
||||
if (cycleCallback != NULL) {
|
||||
cycleCallback(this);
|
||||
}
|
||||
memcpy(prevTotalTime, totalTime, sizeof(prevTotalTime));
|
||||
prevCycleDuration = nowUs - startOfCycle;
|
||||
startOfCycle = nowUs;
|
||||
prevCycleDuration = nowNt - startOfCycle;
|
||||
startOfCycle = nowNt;
|
||||
clear();
|
||||
totalRevolutionCounter++;
|
||||
totalEventCountBase += triggerEventCount;
|
||||
|
|
Loading…
Reference in New Issue