rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
PeakDetect< TValue, TTimeoutPeriod > Class Template Reference

#include <peak_detect.h>

Collaboration diagram for PeakDetect< TValue, TTimeoutPeriod >:
Collaboration graph
[legend]

Public Member Functions

TValue detect (TValue currentValue, efitick_t nowNt)
 

Private Attributes

TValue m_peak = std::numeric_limits<TValue>::min()
 
efitick_t m_lastPeakTime = std::numeric_limits<efitick_t>::min()
 

Detailed Description

template<typename TValue, efidur_t TTimeoutPeriod>
class PeakDetect< TValue, TTimeoutPeriod >

Stores the recent peak value, preventing loss of intermittent peaks in a signal.

Definition at line 9 of file peak_detect.h.

Member Function Documentation

◆ detect()

template<typename TValue , efidur_t TTimeoutPeriod>
TValue PeakDetect< TValue, TTimeoutPeriod >::detect ( TValue  currentValue,
efitick_t  nowNt 
)
inline

Definition at line 11 of file peak_detect.h.

11 {
12 if ((nowNt > m_lastPeakTime + TTimeoutPeriod) || // if timed out
13 (currentValue > m_peak)) { // or current is higher than the previous peak
14 // store new peak and time
15 m_peak = currentValue;
16 m_lastPeakTime = nowNt;
17 }
18
19 return m_peak;
20 }
efitick_t m_lastPeakTime
Definition peak_detect.h:24
TValue m_peak
Definition peak_detect.h:23

Referenced by KnockControllerBase::onKnockSenseCompleted().

Here is the caller graph for this function:

Field Documentation

◆ m_lastPeakTime

template<typename TValue , efidur_t TTimeoutPeriod>
efitick_t PeakDetect< TValue, TTimeoutPeriod >::m_lastPeakTime = std::numeric_limits<efitick_t>::min()
private

Definition at line 24 of file peak_detect.h.

Referenced by PeakDetect< TValue, TTimeoutPeriod >::detect().

◆ m_peak

template<typename TValue , efidur_t TTimeoutPeriod>
TValue PeakDetect< TValue, TTimeoutPeriod >::m_peak = std::numeric_limits<TValue>::min()
private

Definition at line 23 of file peak_detect.h.

Referenced by PeakDetect< TValue, TTimeoutPeriod >::detect().


The documentation for this class was generated from the following file: