diff --git a/firmware/console/binary/output_channels.txt b/firmware/console/binary/output_channels.txt index a00c21deab..89a71c1c44 100644 --- a/firmware/console/binary/output_channels.txt +++ b/firmware/console/binary/output_channels.txt @@ -190,8 +190,6 @@ int16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2 int16_t autoscale rawPpsSecondary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3 - int8_t[12 iterate] knock;Knock: Cyl;"dBv",1, 0, 0, 0, 0 - int16_t autoscale idlePositionSensor;@@GAUGE_NAME_IDLE_POSITION@@;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2 uint16_t autoscale AFRValue;@@GAUGE_NAME_AFR@@;"AFR",{1/@@PACK_MULT_AFR@@}, 0, 0, 0, 2 diff --git a/firmware/controllers/engine_cycle/knock_controller.cpp b/firmware/controllers/engine_cycle/knock_controller.cpp index 9d83f6ff62..22c577d6ab 100644 --- a/firmware/controllers/engine_cycle/knock_controller.cpp +++ b/firmware/controllers/engine_cycle/knock_controller.cpp @@ -54,22 +54,17 @@ int getCylinderKnockBank(uint8_t cylinderNumber) { bool KnockControllerBase::onKnockSenseCompleted(uint8_t cylinderNumber, float dbv, efitick_t lastKnockTime) { bool isKnock = dbv > m_knockThreshold; -#if EFI_TUNER_STUDIO - // Pass through per-cylinder peak detector + // Per-cylinder peak detector float cylPeak = peakDetectors[cylinderNumber].detect(dbv, lastKnockTime); - engine->outputChannels.knock[cylinderNumber] = roundf(cylPeak); + m_knockCyl[cylinderNumber] = roundf(cylPeak); - // Pass through all-cylinders peak detector + // All-cylinders peak detector m_knockLevel = allCylinderPeakDetector.detect(dbv, lastKnockTime); - // If this was a knock, count it! - if (isKnock) { - m_knockCount++; - } -#endif // EFI_TUNER_STUDIO - // TODO: retard timing, then put it back! if (isKnock) { + m_knockCount++; + auto baseTiming = engine->engineState.timingAdvance[cylinderNumber]; // TODO: 20 configurable? Better explanation why 20? diff --git a/firmware/controllers/engine_cycle/knock_controller.txt b/firmware/controllers/engine_cycle/knock_controller.txt index 4900ead96c..4581270251 100644 --- a/firmware/controllers/engine_cycle/knock_controller.txt +++ b/firmware/controllers/engine_cycle/knock_controller.txt @@ -1,7 +1,9 @@ struct_no_prefix knock_controller_s float m_knockLevel;@@GAUGE_NAME_KNOCK_LEVEL@@;"Volts", 1, 0, 0, 0, 2 + int8_t[12 iterate] m_knockCyl;Knock: Cyl;"dBv",1, 0, 0, 0, 0 + angle_t m_knockRetard;@@GAUGE_NAME_KNOCK_RETARD@@;"deg",1,0,0,0,1 float m_knockThreshold;Knock: Threshold uint32_t m_knockCount;@@GAUGE_NAME_KNOCK_COUNTER@@;"",1, 0, 0, 0, 0 - float m_maximumRetard + float m_maximumRetard;Knock: Max retard end_struct