knock reaction #202

This commit is contained in:
rusefillc 2022-04-29 12:25:33 -04:00
parent acaadb476e
commit b8c82889f3
4 changed files with 5 additions and 6 deletions

View File

@ -9,6 +9,7 @@
#include "global.h"
#include "tunerstudio_io.h"
#include "electronic_throttle_generated.h"
#include "knock_controller_generated.h"
#include "FragmentEntry.h"
typedef struct {

View File

@ -1,5 +1,5 @@
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

View File

@ -9,7 +9,7 @@ struct knock_controller_s {
* Degrees retarded: larger number = more retard
* offset 0
*/
angle_t m_requested_pump = (angle_t)0;
angle_t m_knockRetard = (angle_t)0;
};
static_assert(sizeof(knock_controller_s) == 4);

View File

@ -8,10 +8,11 @@
#pragma once
#include "peak_detect.h"
#include "knock_controller_generated.h"
int getCylinderKnockBank(uint8_t cylinderNumber);
class KnockController : public EngineModule {
class KnockController : public EngineModule, public knock_controller_s {
public:
// EngineModule implementation
void onFastCallback() override;
@ -28,9 +29,6 @@ private:
// start with threshold higher than any possible knock to avoid recording spurious knocks
float m_knockThreshold = 100;
// Degrees retarded: larger number = more retard
float m_knockRetard = 0;
uint32_t m_knockCount = 0;
using PD = PeakDetect<float, MS2NT(100)>;