refactoring: better place for cam validation

This commit is contained in:
Andrey 2022-09-07 23:31:44 -04:00
parent c60e0382dc
commit a3d51d8b49
2 changed files with 5 additions and 3 deletions

View File

@ -316,9 +316,6 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp, angle_
bool limitedFuel = !limitedFuelState.value;
if (trgEventIndex == 0) {
if (HAVE_CAM_INPUT()) {
engine->triggerCentral.validateCamVvtCounters();
}
if (engine->triggerCentral.checkIfTriggerConfigChanged()) {
engine->ignitionEvents.isReady = false; // we need to rebuild complete ignition schedule

View File

@ -238,6 +238,11 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
RpmCalculator *rpmState = &engine->rpmCalculator;
if (trgEventIndex == 0) {
if (HAVE_CAM_INPUT()) {
engine->triggerCentral.validateCamVvtCounters();
}
bool hadRpmRecently = rpmState->checkIfSpinning(nowNt);
float periodSeconds = engine->rpmCalculator.lastTdcTimer.getElapsedSecondsAndReset(nowNt);