comparison Discovery/Src/t3.c @ 177:458f16cda15c

Merged in janlmulder/ostc4/max-depth (pull request #3) Bugfix: make max depth move with current depth Approved-by: heinrichsweikamp <bitbucket@heinrichsweikamp.com>
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Tue, 12 Mar 2019 15:04:19 +0000
parents ecb71521d004
children 8b8074080d7b
comparison
equal deleted inserted replaced
172:c659fda83e44 177:458f16cda15c
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)