From edda861246e164214fc3c4e997c803f6348cd065 Mon Sep 17 00:00:00 2001 From: Andrey Gusakov Date: Wed, 10 Jul 2024 23:55:01 +0300 Subject: [PATCH] hip9011: fixe debug --- firmware/hw_layer/sensors/hip9011.cpp | 5 +++-- firmware/hw_layer/sensors/hip9011_logic.cpp | 4 ++++ firmware/hw_layer/sensors/hip9011_logic.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/firmware/hw_layer/sensors/hip9011.cpp b/firmware/hw_layer/sensors/hip9011.cpp index 95ba0b7b2d..b09614995b 100644 --- a/firmware/hw_layer/sensors/hip9011.cpp +++ b/firmware/hw_layer/sensors/hip9011.cpp @@ -626,8 +626,9 @@ static void showHipInfo() { instance.getBand(PASS_HIP_PARAMS), instance.bandIdx); - efiPrintf(" Integrator idx 0x%x", - instance.intergratorIdx); + efiPrintf(" Integrator %d uS idx 0x%x RPM %d", + instance.getIntegrationTimeByIndex(instance.intergratorIdx), + instance.intergratorIdx, instance.rpmLookup[INT_LOOKUP_SIZE - 1 - instance.intergratorIdx]); efiPrintf(" Gain %.2f idx 0x%x", engineConfiguration->hip9011Gain, diff --git a/firmware/hw_layer/sensors/hip9011_logic.cpp b/firmware/hw_layer/sensors/hip9011_logic.cpp index ba5b4e8bef..8a684ce53f 100644 --- a/firmware/hw_layer/sensors/hip9011_logic.cpp +++ b/firmware/hw_layer/sensors/hip9011_logic.cpp @@ -137,6 +137,10 @@ int HIP9011::getIntegrationIndexByRpm(float rpm) { return i == -1 ? INT_LOOKUP_SIZE - 1 : INT_LOOKUP_SIZE - i - 1; } +int HIP9011::getIntegrationTimeByIndex(int index) { + return integratorValues[index & 0x1f]; +} + void HIP9011::setAngleWindowWidth(DEFINE_HIP_PARAMS) { float new_angleWindowWidth = GET_CONFIG_VALUE(knockSamplingDuration); if (new_angleWindowWidth < 0) { diff --git a/firmware/hw_layer/sensors/hip9011_logic.h b/firmware/hw_layer/sensors/hip9011_logic.h index ac88cdf5fb..eb5927d30e 100644 --- a/firmware/hw_layer/sensors/hip9011_logic.h +++ b/firmware/hw_layer/sensors/hip9011_logic.h @@ -92,6 +92,7 @@ public: int readValueAndHandleChannel(DEFINE_HIP_PARAMS); float getBand(DEFINE_HIP_PARAMS); int getIntegrationIndexByRpm(float rpm); + int getIntegrationTimeByIndex(int index); int getBandIndex(DEFINE_HIP_PARAMS); int getGainIndex(DEFINE_HIP_PARAMS);