diff --git a/firmware/controllers/engine_cycle/knock_controller.cpp b/firmware/controllers/engine_cycle/knock_controller.cpp index aa9df359be..ab766aaa44 100644 --- a/firmware/controllers/engine_cycle/knock_controller.cpp +++ b/firmware/controllers/engine_cycle/knock_controller.cpp @@ -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++; diff --git a/firmware/controllers/engine_cycle/knock_controller.txt b/firmware/controllers/engine_cycle/knock_controller.txt index 6cab883e19..e1a6145675 100644 --- a/firmware/controllers/engine_cycle/knock_controller.txt +++ b/firmware/controllers/engine_cycle/knock_controller.txt @@ -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 diff --git a/firmware/controllers/engine_cycle/knock_logic.h b/firmware/controllers/engine_cycle/knock_logic.h index e6f9750ee6..f1eedfb869 100644 --- a/firmware/controllers/engine_cycle/knock_logic.h +++ b/firmware/controllers/engine_cycle/knock_logic.h @@ -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; diff --git a/firmware/controllers/sensors/impl/software_knock.cpp b/firmware/controllers/sensors/impl/software_knock.cpp index e109fd5319..6b509f0999 100644 --- a/firmware/controllers/sensors/impl/software_knock.cpp +++ b/firmware/controllers/sensors/impl/software_knock.cpp @@ -232,7 +232,7 @@ static void processLastKnockEvent() { // clamp to reasonable range db = clampF(-100, db, 100); - engine->module()->onKnockSenseCompleted(currentCylinderNumber, db, 0/* looks like we have a defect mainFreq*/, lastKnockTime); + engine->module()->onKnockSenseCompleted(currentCylinderNumber, db, lastKnockTime); } void KnockThread::ThreadTask() { diff --git a/firmware/hw_layer/sensors/hip9011.cpp b/firmware/hw_layer/sensors/hip9011.cpp index d3894ba8dd..065ed1e4b9 100644 --- a/firmware/hw_layer/sensors/hip9011.cpp +++ b/firmware/hw_layer/sensors/hip9011.cpp @@ -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()->onKnockSenseCompleted(instance.cylinderNumber, knockVolts, 0, instance.knockSampleTimestamp); + engine->module()->onKnockSenseCompleted(instance.cylinderNumber, knockVolts, instance.knockSampleTimestamp); #if EFI_HIP_9011_DEBUG /* debug */ diff --git a/unit_tests/tests/test_knock.cpp b/unit_tests/tests/test_knock.cpp index db6fb3efdc..bc222bc2eb 100644 --- a/unit_tests/tests/test_knock.cpp +++ b/unit_tests/tests/test_knock.cpp @@ -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);