only: part of knock logging

This commit is contained in:
Andrey 2023-09-25 22:19:35 -04:00
parent 7519cc854a
commit f4e2ac32d5
3 changed files with 8 additions and 13 deletions

View File

@ -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

View File

@ -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?

View File

@ -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