Mercurial > public > ostc4
diff Discovery/Src/t7.c @ 189:8b8074080d7b avg-temp
Bugfix: average temperature on arrival from RTE instead of display time
This commit is heavily inspired by commits 05c770dc2911 and ecb71521d004.
Reading the code, it was clear that a display time averaging process
for measured temperature was implemented as was fixed for current
depth display in the two mentioned commits. The bug for the late
averaging of the temperature is, obviously, not as prominent as the
current depth fault. The bug fixed here was nothing more than a
visual glitch when first selecting the temperature display in the
lower left corner (by default at the start of the dive, or by manually
selecting it during the dive using the left button).
So, to summarize. A small visual glitch fix, but more important,
more consistent data handling and code.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Fri, 15 Mar 2019 15:04:57 +0100 |
parents | 485c5135cf7f |
children | 255326edf00b |
line wrap: on
line diff
--- a/Discovery/Src/t7.c Fri Mar 15 12:55:58 2019 +0000 +++ b/Discovery/Src/t7.c Fri Mar 15 15:04:57 2019 +0100 @@ -74,8 +74,6 @@ /* Exported variables --------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ -float temperatureLastCall[3] = { 0,0,0}; -uint8_t idTemperatureLastCall = 0; GFX_DrawCfgScreen t7screen; GFX_DrawCfgScreen t7screenCompass; @@ -2472,8 +2470,6 @@ const SDecoinfo * pDecoinfoStandard; const SDecoinfo * pDecoinfoFuture; float fCNS; - - float temperatureThisCall; float temperature; if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) @@ -2501,14 +2497,7 @@ /* Temperature */ case 1: default: - // mean value - temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius); - temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f; - idTemperatureLastCall++; - if(idTemperatureLastCall >= 3) - idTemperatureLastCall = 0; - temperatureLastCall[idTemperatureLastCall] = temperatureThisCall; - // output + temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); headerText[2] = TXT_Temperature; textpointer = snprintf(text,TEXTSIZE,"\020\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F if(settingsGetPointer()->nonMetricalSystem == 0)