From 9534851a6601c9e5b7a523e86805d52702381ed4 Mon Sep 17 00:00:00 2001 From: rusefillc <48498823+rusefillc@users.noreply.github.com> Date: Mon, 29 May 2023 16:11:55 -0400 Subject: [PATCH] livedata: temp is now packed int16 (#250) Co-authored-by: Andrey Gusakov --- firmware/ini/wideband_dual.ini | 4 ++-- firmware/ini/wideband_f1.ini | 2 +- firmware/livedata.cpp | 2 +- firmware/livedata.h | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/firmware/ini/wideband_dual.ini b/firmware/ini/wideband_dual.ini index 1245d57..a8a239d 100644 --- a/firmware/ini/wideband_dual.ini +++ b/firmware/ini/wideband_dual.ini @@ -96,7 +96,7 @@ VBatt = scalar, F32, 0, "V", 1, 0 ; AFR0 AFR0_lambda = scalar, F32, 32, "", 1, 0 AFR0_afr = scalar, F32, 32, "", 14.7, 0 -AFR0_temp = scalar, F32, 36, "C", 1, 0 +AFR0_temp = scalar, U16, 36, "C", 0.1, 0 AFR0_NernstDc = scalar, U16, 40, "V", 0.001, 0 AFR0_NernstAc = scalar, U16, 42, "V", 0.001, 0 AFR0_PumpITarget = scalar, F32, 44, "mA", 1, 0 @@ -110,7 +110,7 @@ AFR0_heater = scalar, U08, 61, "", 1, 0 ; AFR1 AFR1_lambda = scalar, F32, 64, "", 1, 0 AFR1_afr = scalar, F32, 64, "", 14.7, 0 -AFR1_temp = scalar, F32, 68, "C", 1, 0 +AFR1_temp = scalar, U16, 68, "C", 0.1, 0 AFR1_NernstDc = scalar, U16, 72, "V", 0.001, 0 AFR1_NernstAc = scalar, U16, 74, "V", 0.001, 0 AFR1_PumpITarget = scalar, F32, 76, "mA", 1, 0 diff --git a/firmware/ini/wideband_f1.ini b/firmware/ini/wideband_f1.ini index 9a5c23e..df038a8 100644 --- a/firmware/ini/wideband_f1.ini +++ b/firmware/ini/wideband_f1.ini @@ -89,7 +89,7 @@ VBatt = scalar, F32, 0, "V", 1, 0 ; AFR0 AFR0_lambda = scalar, F32, 32, "", 1, 0 AFR0_afr = scalar, F32, 32, "", 14.7, 0 -AFR0_temp = scalar, F32, 36, "C", 1, 0 +AFR0_temp = scalar, U16, 36, "C", 0.1, 0 AFR0_NernstDc = scalar, U16, 40, "V", 0.001, 0 AFR0_NernstAc = scalar, U16, 42, "V", 0.001, 0 AFR0_PumpITarget = scalar, F32, 44, "mA", 1, 0 diff --git a/firmware/livedata.cpp b/firmware/livedata.cpp index 00cead6..d00f919 100644 --- a/firmware/livedata.cpp +++ b/firmware/livedata.cpp @@ -21,7 +21,7 @@ void SamplingUpdateLiveData() volatile struct livedata_afr_s *data = &livedata_afr[ch]; data->lambda = GetLambda(ch); - data->temperature = GetSensorTemperature(ch); + data->temperature = GetSensorTemperature(ch) * 10; data->nernstDc = GetNernstDc(ch) * 1000; data->nernstAc = GetNernstAc(ch) * 1000; data->pumpCurrentTarget = GetPumpCurrent(ch); diff --git a/firmware/livedata.h b/firmware/livedata.h index a2d7f37..3a03b07 100644 --- a/firmware/livedata.h +++ b/firmware/livedata.h @@ -22,7 +22,8 @@ struct livedata_afr_s { struct { // lambda also displayed by TS as AFR, same data with different scale factor float lambda; - float temperature; + uint16_t temperature; + uint16_t padding; uint16_t nernstDc; uint16_t nernstAc; float pumpCurrentTarget;