27#ifndef NO_RPM_EVENTS_TIMEOUT_SECS
28#define NO_RPM_EVENTS_TIMEOUT_SECS 2
69#if EFI_SHAFT_POSITION_INPUT
90#if EFI_SHAFT_POSITION_INPUT
104#if EFI_SHAFT_POSITION_INPUT
128 bool noRpmEventsForTooLong =
lastTdcTimer.getElapsedSeconds(nowNt) > NO_RPM_EVENTS_TIMEOUT_SECS;
135 if (noRpmEventsForTooLong || noTriggerEventsForTooLong) {
183#if EFI_ENGINE_CONTROL
228 efiPrintf(
"engine stopped");
261 uint32_t trgEventIndex, efitick_t nowNt) {
267 if (trgEventIndex == 0) {
268 if (HAVE_CAM_INPUT()) {
277 if (hadRpmRecently) {
285 if (!alwaysInstantRpm) {
286 if (periodSeconds == 0) {
292 float rpm = 60 * mult / periodSeconds;
295 rpmState->
rpmRate = rpmDelta / (mult * periodSeconds);
297 rpmState->
setRpmValue(rpm > UNREALISTIC_RPM ? NOISY_RPM : rpm);
314 int signal = 1000 * ckpSignalType + trgEventIndex;
324 trgEventIndex, nowNt);
327 if (alwaysInstantRpm) {
332 efiPrintf(
"** RPM: idx=%d sig=%d iRPM=%d", trgEventIndex, ckpSignalType,
instantRpm);
364 uint32_t trgEventIndex, efitick_t nowNt) {
365 bool isTriggerSynchronizationPoint = trgEventIndex == 0;
366 if (isTriggerSynchronizationPoint &&
getTriggerCentral()->isEngineSnifferEnabled) {
376 int revIndex2 = getRevolutionCounter() % 2;
379 if (isValidRpm(rpm)) {
380 angle_t tdcPosition = tdcPosition();
TriggerCentral triggerCentral
FuelSchedule injectionEvents
void periodicFastCallback()
scheduling_s tdcScheduler[2]
SingleTimerExecutor scheduler
RpmCalculator rpmCalculator
virtual operation_mode_e getOperationMode() const =0
sensor_chart_e sensorChartMode
size_t spinningEventIndex
void setLastEventTimeForInstantRpm(efitick_t nowNt)
float getInstantRpm() const
void movePreSynchTimestamps()
void updateInstantRpm(uint32_t current_index, TriggerWaveform const &triggerShape, TriggerFormDetails *triggerFormDetails, uint32_t index, efitick_t nowNt)
float getSecondsSinceEngineStart(efitick_t nowNt) const
bool isSpinningUp() const
bool isStopped() const override
float getRpmAcceleration() const
uint32_t getRevolutionCounterM(void) const
bool checkIfSpinning(efitick_t nowNt) const
void setRpmValue(float value)
void setSpinningUp(efitick_t nowNt)
float getCachedRpm() const
uint32_t revolutionCounterSinceBoot
bool isCranking() const override
uint32_t getRevolutionCounterSinceStart(void) const
uint32_t revolutionCounterSinceStart
spinning_state_e getState() const
void assignRpmValue(float value)
operation_mode_e getOperationMode() const override
static float getOrZero(SensorType type)
void schedule(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override
Schedule an action to be executed in the future.
Base class for sensors that compute a value on one thread, and want to make it available to consumers...
void setValidValue(float value, efitick_t timestamp)
InstantRpmCalculator instantRpm
PrimaryTriggerDecoder triggerState
bool engineMovedRecently(efitick_t nowNt) const
TriggerWaveform triggerShape
TriggerFormDetails triggerFormDetails
TriggerNoiseFilter noiseFilter
expected< float > getCurrentEnginePhase(efitick_t nowNt) const
void validateCamVvtCounters()
bool getShaftSynchronized()
current_cycle_state_s currentCycle
void resetAccumSignalData()
efitick_t sumTickAndFloat(efitick_t ticks, float extra)
LimpManager * getLimpManager()
TriggerCentral * getTriggerCentral()
EngineRotationState * getEngineRotationState()
EngineState * getEngineState()
static Engine *const engine
static constexpr engine_configuration_s * engineConfiguration
void addEngineSnifferTdcEvent(int rpm)
rusEfi console wave sniffer
static bool doesTriggerImplyOperationMode(trigger_type_e type)
static void onTdcCallback(void *)
void tdcMarkCallback(uint32_t trgEventIndex, efitick_t nowNt)
operation_mode_e lookupOperationMode()
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex, efitick_t nowNt)
Shaft position callback used by RPM calculation logic.
efitick_t scheduleByAngle(scheduling_s *timer, efitick_t nowNt, angle_t angle, action_s action)
operation_mode_e lookupOperationMode()
@ FOUR_STROKE_CRANK_SENSOR
void scAddData(float angle, float value)
instantRpm("sync: instant RPM", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 320, 1.0, 0.0, 0.0, "rpm")
cranking_parameters_s cranking
injection_mode_e crankingInjectionMode
bool isFasterEngineSpinUpEnabled
injection_mode_e injectionMode
void LogTriggerTopDeadCenter(efitick_t timestamp)
void wrapAngle(angle_t &angle, const char *msg, ObdCode code)
angle_t getEngineCycle(operation_mode_e operationMode)