Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
/** |
2 |
|
|
|
* @file frequency_sensor.h |
3 |
|
|
|
*/ |
4 |
|
|
|
#include "functional_sensor.h" |
5 |
|
|
|
#include <rusefi/timer.h> |
6 |
|
|
|
#include "biquad.h" |
7 |
|
|
|
|
8 |
|
|
|
class FrequencySensor : public FunctionalSensor { |
9 |
|
|
|
public: |
10 |
|
|
6 |
FrequencySensor(SensorType type, efidur_t timeoutPeriod) |
11 |
|
|
6 |
: FunctionalSensor(type, timeoutPeriod) |
12 |
|
|
6 |
{ } |
13 |
|
|
|
|
14 |
|
|
|
void initIfValid(brain_pin_e pin, SensorConverter &converter, float filterParameter); |
15 |
|
|
|
void deInit(); |
16 |
|
|
|
|
17 |
|
|
|
// sad workaround: we are not good at BiQuad configuring |
18 |
|
|
|
bool useBiQuad = true; |
19 |
|
|
|
|
20 |
|
|
|
void showInfo(const char* sensorName) const override; |
21 |
|
|
|
|
22 |
|
|
|
void onEdge(efitick_t nowNt); |
23 |
|
|
|
|
24 |
|
|
|
int eventCounter = 0; |
25 |
|
|
|
private: |
26 |
|
|
|
Timer m_edgeTimer; |
27 |
|
|
|
brain_pin_e m_pin = Gpio::Unassigned; |
28 |
|
|
|
|
29 |
|
|
|
Biquad m_filter; |
30 |
|
|
|
}; |
31 |
|
|
|
|