13 switch (cylinderNumber) {
59 auto distToMinimum = baseTiming - (-20);
63 auto retardAmount = distToMinimum * retardFraction;
66 auto maximumFuelTrim = 0.3f;
70 float trimFuelAmountPercent = trimFuelPercent * trimFuelFraction;
71 float trimFuelAmount = trimFuelAmountPercent / 100.f;
75 chibios_rt::CriticalSectionLocker csl;
102 constexpr auto callbackPeriodSeconds = FAST_CALLBACK_PERIOD_MS / 1000.0f;
112 chibios_rt::CriticalSectionLocker csl;
115 if(TPSValue < engineConfiguration->knockSuppressMinTps) {
144 return interpolate2d(
167#if EFI_SOFTWARE_KNOCK
191#if EFI_SOFTWARE_KNOCK
typedef __attribute__
Ignition Mode.
RpmCalculator rpmCalculator
void onSparkFireKnockSense(uint8_t cylinderIndex, efitick_t nowNt)
angle_t timingAdvance[MAX_CYLINDER_COUNT]
float getKnockRetard() const
float getFuelTrimMultiplier() const
virtual float getMaximumRetard() const =0
uint32_t getKnockCount() const
PD allCylinderPeakDetector
void onFastCallback() override
PD peakDetectors[MAX_CYLINDER_COUNT]
void onKnockSenseCompleted(uint8_t cylinderNumber, float dbv, efitick_t lastKnockTime)
virtual float getKnockThreshold() const =0
float getKnockThreshold() const override
float getMaximumRetard() const override
TValue detect(TValue currentValue, efitick_t nowNt)
static float getOrZero(SensorType type)
static EngineAccessor engine
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
float samplingTimeSeconds
static void startKnockSampling(Engine *p_engine)
int getCylinderKnockBank(uint8_t cylinderNumber)
UNUSED(samplingTimeSeconds)
static uint8_t cylinderNumberCopy
efitick_t scheduleByAngle(scheduling_s *timer, efitick_t nowNt, angle_t angle, action_s const &action)
TPSValue("TPS", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 22, 0.01, 0.0, 0.0, "%")
void onStartKnockSampling(uint8_t cylinderNumber, float samplingSeconds, uint8_t channelIdx)
scaled_channel< uint8_t, 10, 1 > knockRetardAggression
scaled_channel< uint8_t, 1, 1 > knockFuelTrim
int16_t knockSamplingDuration
float knockDetectionWindowStart
scaled_channel< uint8_t, 10, 1 > knockFuelTrimAggression
scaled_channel< uint8_t, 10, 1 > knockRetardReapplyRate
scaled_channel< uint8_t, 10, 1 > knockFuelTrimReapplyRate
int8_t m_knockCyl[MAX_CYLINDER_COUNT]
float m_knockFuelTrimMultiplier
scaled_channel< uint8_t, 1, 100 > maxKnockRetardRpmBins[KNOCK_TABLE_SIZE]
scaled_channel< uint8_t, 4, 1 > maxKnockRetardTable[KNOCK_TABLE_SIZE][KNOCK_TABLE_SIZE]
scaled_channel< int8_t, 2, 1 > knockBaseNoise[ENGINE_NOISE_CURVE_SIZE]
uint8_t maxKnockRetardLoadBins[KNOCK_TABLE_SIZE]
uint16_t knockNoiseRpmBins[ENGINE_NOISE_CURVE_SIZE]