knock reaction #202

LiveData
This commit is contained in:
rusefillc 2022-04-29 15:23:22 -04:00
parent 243fde13fa
commit ec1a6a84db
3 changed files with 17 additions and 9 deletions

View File

@ -1,5 +1,6 @@
struct_no_prefix knock_controller_s
angle_t m_knockRetard;Degrees retarded: larger number = more retard
float m_knockThreshold
uint32_t m_knockCount
end_struct

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle/knock_controller.txt Fri Apr 29 16:01:47 UTC 2022
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle\knock_controller.txt Fri Apr 29 15:13:26 EDT 2022
// by class com.rusefi.output.CHeaderConsumer
// begin
#pragma once
@ -10,8 +10,16 @@ struct knock_controller_s {
* offset 0
*/
angle_t m_knockRetard = (angle_t)0;
/**
* offset 4
*/
float m_knockThreshold = (float)0;
/**
* offset 8
*/
uint32_t m_knockCount = (uint32_t)0;
};
static_assert(sizeof(knock_controller_s) == 4);
static_assert(sizeof(knock_controller_s) == 12);
// end
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle/knock_controller.txt Fri Apr 29 16:01:47 UTC 2022
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/engine_cycle\knock_controller.txt Fri Apr 29 15:13:26 EDT 2022

View File

@ -14,6 +14,10 @@ int getCylinderKnockBank(uint8_t cylinderNumber);
class KnockController : public EngineModule, public knock_controller_s {
public:
KnockController() {
// start with threshold higher than any possible knock to avoid recording spurious knocks
m_knockThreshold = 100;
}
// EngineModule implementation
void onFastCallback() override;
@ -26,11 +30,6 @@ public:
virtual float getKnockThreshold() const;
private:
// start with threshold higher than any possible knock to avoid recording spurious knocks
float m_knockThreshold = 100;
uint32_t m_knockCount = 0;
using PD = PeakDetect<float, MS2NT(100)>;
PD peakDetectors[12];
PD allCylinderPeakDetector;