rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
knock_logic.h
Go to the documentation of this file.
1/*
2 * @file knock_logic.h
3 *
4 * @date Apr 04, 2021
5 * @author Andrey Gusakov
6 */
7
8#pragma once
9
10#include "peak_detect.h"
12
13int getCylinderKnockBank(uint8_t cylinderNumber);
14
15#define bore2frequency(bore) (900 / (CONST_PI * (bore) / 2))
16
18public:
20 // start with threshold higher than any possible knock to avoid recording spurious knocks
21 m_knockThreshold = 100;
22 }
23 // EngineModule implementation
24 void onFastCallback() override;
25
26 // onKnockSenseCompleted is the callback from the knock sense driver to report a sensed knock level
27 void onKnockSenseCompleted(uint8_t cylinderNumber, float dbv, efitick_t lastKnockTime);
28
29 float getFuelTrimMultiplier() const;
30 float getKnockRetard() const;
31 uint32_t getKnockCount() const;
32
33 virtual float getKnockThreshold() const = 0;
34 virtual float getMaximumRetard() const = 0;
35
36private:
37 using PD = PeakDetect<float, MS2NT(50)>;
38 PD peakDetectors[MAX_CYLINDER_COUNT];
40};
41
43public:
44 float getKnockThreshold() const override;
45 float getMaximumRetard() const override;
46};
float getKnockRetard() const
float getFuelTrimMultiplier() const
virtual float getMaximumRetard() const =0
uint32_t getKnockCount() const
void onFastCallback() override
PD peakDetectors[MAX_CYLINDER_COUNT]
Definition knock_logic.h:38
void onKnockSenseCompleted(uint8_t cylinderNumber, float dbv, efitick_t lastKnockTime)
virtual float getKnockThreshold() const =0
float getKnockThreshold() const override
float getMaximumRetard() const override
int getCylinderKnockBank(uint8_t cylinderNumber)