comparison Discovery/Src/t3.c @ 174:ecb71521d004 max-depth

Bugfix: make max depth move with current depth (part 2) Step 2 of the fix as introduced in the previous commit. Now we have a smart averaging depth import from the RTE, we do not need to average close to display time. So, simply kick out this logic here. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Mon, 11 Mar 2019 19:54:20 +0100
parents 255eedad4155
children 8b8074080d7b
comparison
equal deleted inserted replaced
173:05c770dc2911 174:ecb71521d004
50 GFX_DrawCfgWindow t3l1; 50 GFX_DrawCfgWindow t3l1;
51 GFX_DrawCfgWindow t3r1; 51 GFX_DrawCfgWindow t3r1;
52 GFX_DrawCfgWindow t3c1; 52 GFX_DrawCfgWindow t3c1;
53 GFX_DrawCfgWindow t3c2; 53 GFX_DrawCfgWindow t3c2;
54 54
55 extern float depthLastCall[9];
56 extern uint8_t idDepthLastCall;
57 extern float temperatureLastCall[3]; 55 extern float temperatureLastCall[3];
58 extern uint8_t idTemperatureLastCall; 56 extern uint8_t idTemperatureLastCall;
59 57
60 uint8_t t3_selection_customview = 0; 58 uint8_t t3_selection_customview = 0;
61 59
208 stop.y = 479; 206 stop.y = 479;
209 207
210 stop.x = start.x = BigFontSeperationLeftRight; 208 stop.x = start.x = BigFontSeperationLeftRight;
211 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); 209 GFX_draw_line(tXscreen, start, stop, CLUT_Font020);
212 210
213
214 /* depth */ 211 /* depth */
215 float depth = 0; 212 float depth = unit_depth_float(stateUsed->lifeData.depth_meter);
216 float depthThisCall = unit_depth_float(stateUsed->lifeData.depth_meter);
217 if(is_stateUsedSetToSim())
218 {
219 depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2] + depthLastCall[3] + depthLastCall[4] + depthLastCall[5] + depthLastCall[6] + depthLastCall[7] + depthLastCall[8]) / 10.0f;
220
221 idDepthLastCall++;
222 if(idDepthLastCall >= 9)
223 idDepthLastCall = 0;
224 depthLastCall[idDepthLastCall] = depthThisCall;
225 }
226 else
227 {
228 depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2]) / 4.0f;
229
230 idDepthLastCall++;
231 if(idDepthLastCall >= 3)
232 idDepthLastCall = 0;
233 depthLastCall[idDepthLastCall] = depthThisCall;
234 }
235 213
236 if(depth <= 0.3f) 214 if(depth <= 0.3f)
237 depth = 0; 215 depth = 0;
238 216
239 if(settingsGetPointer()->nonMetricalSystem) 217 if(settingsGetPointer()->nonMetricalSystem)