- remove old output param m_frequency from knockController

- need some memory for f407
This commit is contained in:
3er0.1ive 2024-10-22 11:25:47 +03:00 committed by Andrey
parent c88ca9446f
commit 74908a9b54
6 changed files with 8 additions and 10 deletions

View File

@ -44,7 +44,7 @@ int getCylinderKnockBank(uint8_t cylinderNumber) {
}
}
void KnockControllerBase::onKnockSenseCompleted(uint8_t cylinderNumber, float dbv, float frequency, efitick_t lastKnockTime) {
void KnockControllerBase::onKnockSenseCompleted(uint8_t cylinderNumber, float dbv, efitick_t lastKnockTime) {
bool isKnock = dbv > m_knockThreshold;
// Per-cylinder peak detector
@ -53,7 +53,6 @@ void KnockControllerBase::onKnockSenseCompleted(uint8_t cylinderNumber, float db
// All-cylinders peak detector
m_knockLevel = allCylinderPeakDetector.detect(dbv, lastKnockTime);
m_knockFrequency = frequency;
if (isKnock) {
m_knockCount++;

View File

@ -7,7 +7,6 @@ struct_no_prefix knock_controller_s
uint32_t m_knockCount;@@GAUGE_NAME_KNOCK_COUNTER@@;"",1, 0, 0, 0, 0
float m_maximumRetard;Knock: Max retard
uint32_t m_knockFrequency;@@GAUGE_NAME_KNOCK_FREQ@@;"Hz", 1, 0, 0, 0, 2
uint32_t[16 iterate] m_knockSpectrum;Knock: SpectrumData;"compressed data",1, 0, 0, 0, 0
uint16_t m_knockSpectrumChannelCyl;Knock: ChannelAndCylNumber;"compressed N + N", 1, 0, 0, 0, 0
uint16_t m_knockFrequencyStart;Knock: Start Freq;"Hz", 1, 0, 0, 0, 0

View File

@ -24,7 +24,7 @@ public:
void onFastCallback() override;
// onKnockSenseCompleted is the callback from the knock sense driver to report a sensed knock level
void onKnockSenseCompleted(uint8_t cylinderNumber, float dbv, float frequency, efitick_t lastKnockTime);
void onKnockSenseCompleted(uint8_t cylinderNumber, float dbv, efitick_t lastKnockTime);
float getKnockRetard() const;
uint32_t getKnockCount() const;

View File

@ -232,7 +232,7 @@ static void processLastKnockEvent() {
// clamp to reasonable range
db = clampF(-100, db, 100);
engine->module<KnockController>()->onKnockSenseCompleted(currentCylinderNumber, db, 0/* looks like we have a defect mainFreq*/, lastKnockTime);
engine->module<KnockController>()->onKnockSenseCompleted(currentCylinderNumber, db, lastKnockTime);
}
void KnockThread::ThreadTask() {

View File

@ -507,7 +507,7 @@ static msg_t hipThread(void *arg) {
/* Check for correct cylinder/input */
if (correctCylinder) {
// TODO: convert knock level to dBv
engine->module<KnockController>()->onKnockSenseCompleted(instance.cylinderNumber, knockVolts, 0, instance.knockSampleTimestamp);
engine->module<KnockController>()->onKnockSenseCompleted(instance.cylinderNumber, knockVolts, instance.knockSampleTimestamp);
#if EFI_HIP_9011_DEBUG
/* debug */

View File

@ -33,20 +33,20 @@ TEST(Knock, Retards) {
// Send some weak knocks, should yield no response
for (size_t i = 0; i < 10; i++) {
dut.onKnockSenseCompleted(0, 10, 0, 0);
dut.onKnockSenseCompleted(0, 10, 0);
}
EXPECT_FLOAT_EQ(dut.getKnockRetard(), 0);
// Send a strong knock!
dut.onKnockSenseCompleted(0, 30, 0, 0);
dut.onKnockSenseCompleted(0, 30, 0);
// Should retard 10% of the distance between current timing and "maximum"
EXPECT_FLOAT_EQ(dut.getKnockRetard(), 2);
// Send tons of strong knocks, make sure we don't go over the configured limit
for (size_t i = 0; i < 100; i++) {
dut.onKnockSenseCompleted(0, 30, 0, 0);
dut.onKnockSenseCompleted(0, 30, 0);
}
EXPECT_FLOAT_EQ(dut.getKnockRetard(), 8);
@ -64,7 +64,7 @@ TEST(Knock, Reapply) {
engineConfiguration->knockRetardReapplyRate = 1;
// Send a strong knock!
dut.onKnockSenseCompleted(0, 30, 0, 0);
dut.onKnockSenseCompleted(0, 30, 0);
// Should retard 10% of the distance between current timing and "maximum"
EXPECT_FLOAT_EQ(dut.getKnockRetard(), 2);