knock reaction #202
This commit is contained in:
parent
acaadb476e
commit
b8c82889f3
|
@ -9,6 +9,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tunerstudio_io.h"
|
#include "tunerstudio_io.h"
|
||||||
#include "electronic_throttle_generated.h"
|
#include "electronic_throttle_generated.h"
|
||||||
|
#include "knock_controller_generated.h"
|
||||||
#include "FragmentEntry.h"
|
#include "FragmentEntry.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
struct_no_prefix knock_controller_s
|
struct_no_prefix knock_controller_s
|
||||||
|
|
||||||
angle_t m_requested_pump;Degrees retarded: larger number = more retard
|
angle_t m_knockRetard;Degrees retarded: larger number = more retard
|
||||||
|
|
||||||
end_struct
|
end_struct
|
||||||
|
|
|
@ -9,7 +9,7 @@ struct knock_controller_s {
|
||||||
* Degrees retarded: larger number = more retard
|
* Degrees retarded: larger number = more retard
|
||||||
* offset 0
|
* offset 0
|
||||||
*/
|
*/
|
||||||
angle_t m_requested_pump = (angle_t)0;
|
angle_t m_knockRetard = (angle_t)0;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(knock_controller_s) == 4);
|
static_assert(sizeof(knock_controller_s) == 4);
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "peak_detect.h"
|
#include "peak_detect.h"
|
||||||
|
#include "knock_controller_generated.h"
|
||||||
|
|
||||||
int getCylinderKnockBank(uint8_t cylinderNumber);
|
int getCylinderKnockBank(uint8_t cylinderNumber);
|
||||||
|
|
||||||
class KnockController : public EngineModule {
|
class KnockController : public EngineModule, public knock_controller_s {
|
||||||
public:
|
public:
|
||||||
// EngineModule implementation
|
// EngineModule implementation
|
||||||
void onFastCallback() override;
|
void onFastCallback() override;
|
||||||
|
@ -28,9 +29,6 @@ private:
|
||||||
// start with threshold higher than any possible knock to avoid recording spurious knocks
|
// start with threshold higher than any possible knock to avoid recording spurious knocks
|
||||||
float m_knockThreshold = 100;
|
float m_knockThreshold = 100;
|
||||||
|
|
||||||
// Degrees retarded: larger number = more retard
|
|
||||||
float m_knockRetard = 0;
|
|
||||||
|
|
||||||
uint32_t m_knockCount = 0;
|
uint32_t m_knockCount = 0;
|
||||||
|
|
||||||
using PD = PeakDetect<float, MS2NT(100)>;
|
using PD = PeakDetect<float, MS2NT(100)>;
|
||||||
|
|
Loading…
Reference in New Issue