rusEFI
The most advanced open source ECU
|
RPM calculator.
Here we listen to position sensor events in order to figure our if engine is currently running or not. Actual getRpm() is calculated once per crankshaft revolution, based on the amount of time passed since the start of previous shaft revolution.
We also have 'instant RPM' logic separate from this 'cycle RPM' logic. Open question is why do we not use instant RPM instead of cycle RPM more often.
Definition in file rpm_calculator.cpp.
Functions | |
operation_mode_e | lookupOperationMode () |
static bool | doesTriggerImplyOperationMode (trigger_type_e type) |
void | rpmShaftPositionCallback (trigger_event_e ckpSignalType, uint32_t trgEventIndex, efitick_t nowNt) |
Shaft position callback used by RPM calculation logic. More... | |
static void | onTdcCallback (void *) |
void | tdcMarkCallback (uint32_t trgEventIndex, efitick_t nowNt) |
efitick_t | scheduleByAngle (scheduling_s *timer, efitick_t nowNt, angle_t angle, action_s action) |
|
static |
Definition at line 72 of file rpm_calculator.cpp.
Referenced by RpmCalculator::getOperationMode().
operation_mode_e lookupOperationMode | ( | ) |
Definition at line 61 of file rpm_calculator.cpp.
Referenced by RpmCalculator::getOperationMode(), and TriggerCentral::updateWaveform().
|
static |
This callback has nothing to do with actual engine control, it just sends a Top Dead Center mark to the rusEfi console digital sniffer.
Definition at line 346 of file rpm_calculator.cpp.
Referenced by tdcMarkCallback().
void rpmShaftPositionCallback | ( | trigger_event_e | ckpSignalType, |
uint32_t | trgEventIndex, | ||
efitick_t | nowNt | ||
) |
Shaft position callback used by RPM calculation logic.
This callback should always be the first of trigger callbacks because other callbacks depend of values updated here. This callback is invoked on interrupt thread.
Four stroke cycle is two crankshaft revolutions
We always do '* 2' because the event signal is already adjusted to 'per engine cycle' and each revolution of crankshaft consists of two engine cycles revolutions
Definition at line 260 of file rpm_calculator.cpp.
Referenced by TriggerCentral::handleShaftSignal().
efitick_t scheduleByAngle | ( | scheduling_s * | timer, |
efitick_t | nowNt, | ||
angle_t | angle, | ||
action_s | action | ||
) |
Schedules a callback 'angle' degree of crankshaft from now. The callback would be executed once after the duration of time which it takes the crankshaft to rotate to the specified angle.
Definition at line 395 of file rpm_calculator.cpp.
Referenced by fireSparkAndPrepareNextSchedule(), hip9011_onFireEvent(), mapAveragingTriggerCallback(), Engine::onSparkFireKnockSense(), InjectionEvent::onTriggerTooth(), HpfpController::pinTurnOn(), TriggerScheduler::scheduleEventsUntilNextTriggerTooth(), TriggerScheduler::scheduleOrQueue(), scheduleSparkEvent(), startAveraging(), tdcMarkCallback(), and turnSparkPinHighStartCharging().
void tdcMarkCallback | ( | uint32_t | trgEventIndex, |
efitick_t | nowNt | ||
) |
This trigger callback schedules the actual physical TDC callback in relation to trigger synchronization point.
Definition at line 363 of file rpm_calculator.cpp.
Referenced by TriggerCentral::handleShaftSignal().