From c0609b0da21db5d3dd4e08217e59d546ba0e5fc9 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 23 Jun 2023 14:45:50 -0700 Subject: [PATCH] remove GetInternalBatteryVoltage helper --- firmware/livedata.cpp | 2 +- firmware/sampling.cpp | 6 ------ firmware/sampling.h | 2 -- firmware/uart.cpp | 2 +- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/firmware/livedata.cpp b/firmware/livedata.cpp index 6d96ece..7a0c4e7 100644 --- a/firmware/livedata.cpp +++ b/firmware/livedata.cpp @@ -36,7 +36,7 @@ void SamplingUpdateLiveData() data->heaterState = (uint8_t)GetHeaterState(ch); } - livedata_common.vbatt = GetInternalBatteryVoltage(0); + livedata_common.vbatt = GetSampler(0).GetInternalBatteryVoltage(); } template<> diff --git a/firmware/sampling.cpp b/firmware/sampling.cpp index ca8a579..0ae1892 100644 --- a/firmware/sampling.cpp +++ b/firmware/sampling.cpp @@ -173,9 +173,3 @@ void StartSampling() adcStart(&ADCD1, nullptr); chThdCreateStatic(waSamplingThread, sizeof(waSamplingThread), NORMALPRIO + 5, SamplingThread, nullptr); } - -// TODO: remove these helpers -float GetInternalBatteryVoltage(int ch) -{ - return samplers[ch].GetInternalBatteryVoltage(); -} diff --git a/firmware/sampling.h b/firmware/sampling.h index ff237dc..6da8a4f 100644 --- a/firmware/sampling.h +++ b/firmware/sampling.h @@ -14,5 +14,3 @@ struct ISampler const ISampler& GetSampler(int ch); void StartSampling(); - -float GetInternalBatteryVoltage(int ch); diff --git a/firmware/uart.cpp b/firmware/uart.cpp index 071b521..4e779cd 100644 --- a/firmware/uart.cpp +++ b/firmware/uart.cpp @@ -39,7 +39,7 @@ static void UartThread(void*) float lambda = GetLambda(ch); int lambdaIntPart = lambda; int lambdaThousandths = (lambda - lambdaIntPart) * 1000; - int batteryVoltageMv = GetInternalBatteryVoltage(ch) * 1000; + int batteryVoltageMv = GetSampler(ch).GetInternalBatteryVoltage() * 1000; int duty = GetHeaterDuty(ch) * 100; size_t writeCount = chsnprintf(printBuffer, 200,