# HG changeset patch # User Jan Mulder # Date 1552330460 -3600 # Node ID ecb71521d004d69046b889367d9ae2211433e18b # Parent 05c770dc2911b120300af33aa9afbd57a61c2f98 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 diff -r 05c770dc2911 -r ecb71521d004 Discovery/Src/t3.c --- a/Discovery/Src/t3.c Mon Mar 11 19:48:57 2019 +0100 +++ b/Discovery/Src/t3.c Mon Mar 11 19:54:20 2019 +0100 @@ -52,8 +52,6 @@ GFX_DrawCfgWindow t3c1; GFX_DrawCfgWindow t3c2; -extern float depthLastCall[9]; -extern uint8_t idDepthLastCall; extern float temperatureLastCall[3]; extern uint8_t idTemperatureLastCall; @@ -210,28 +208,8 @@ stop.x = start.x = BigFontSeperationLeftRight; GFX_draw_line(tXscreen, start, stop, CLUT_Font020); - /* depth */ - float depth = 0; - float depthThisCall = unit_depth_float(stateUsed->lifeData.depth_meter); - if(is_stateUsedSetToSim()) - { - depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2] + depthLastCall[3] + depthLastCall[4] + depthLastCall[5] + depthLastCall[6] + depthLastCall[7] + depthLastCall[8]) / 10.0f; - - idDepthLastCall++; - if(idDepthLastCall >= 9) - idDepthLastCall = 0; - depthLastCall[idDepthLastCall] = depthThisCall; - } - else - { - depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2]) / 4.0f; - - idDepthLastCall++; - if(idDepthLastCall >= 3) - idDepthLastCall = 0; - depthLastCall[idDepthLastCall] = depthThisCall; - } + float depth = unit_depth_float(stateUsed->lifeData.depth_meter); if(depth <= 0.3f) depth = 0; diff -r 05c770dc2911 -r ecb71521d004 Discovery/Src/t4_tetris.c --- a/Discovery/Src/t4_tetris.c Mon Mar 11 19:48:57 2019 +0100 +++ b/Discovery/Src/t4_tetris.c Mon Mar 11 19:54:20 2019 +0100 @@ -45,12 +45,6 @@ GFX_DrawCfgWindow t4l2; GFX_DrawCfgWindow t4l3; -extern float depthLastCall[9]; -extern uint8_t idDepthLastCall; -extern float temperatureLastCall[3]; -extern uint8_t idTemperatureLastCall; - - /* Private types -------------------------------------------------------------*/ #define TEXTSIZE 16 @@ -60,11 +54,6 @@ /* Private function prototypes -----------------------------------------------*/ void t4_refresh_divemode(void); -void t4_refresh_customview(float depth); - -uint8_t t4_test_customview_warnings(void); -void t4_show_customview_warnings(void); -void t4_battery_low_customview_extra(void); /* Exported functions --------------------------------------------------------*/ @@ -150,26 +139,7 @@ // depth - float depth = 0; - float depthThisCall = unit_depth_float(stateUsed->lifeData.depth_meter); - if(is_stateUsedSetToSim()) - { - depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2] + depthLastCall[3] + depthLastCall[4] + depthLastCall[5] + depthLastCall[6] + depthLastCall[7] + depthLastCall[8]) / 10.0f; - - idDepthLastCall++; - if(idDepthLastCall >= 9) - idDepthLastCall = 0; - depthLastCall[idDepthLastCall] = depthThisCall; - } - else - { - depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2]) / 4.0f; - - idDepthLastCall++; - if(idDepthLastCall >= 3) - idDepthLastCall = 0; - depthLastCall[idDepthLastCall] = depthThisCall; - } + float depth = unit_depth_float(stateUsed->lifeData.depth_meter); if(depth <= 0.3f) depth = 0; diff -r 05c770dc2911 -r ecb71521d004 Discovery/Src/t7.c --- a/Discovery/Src/t7.c Mon Mar 11 19:48:57 2019 +0100 +++ b/Discovery/Src/t7.c Mon Mar 11 19:54:20 2019 +0100 @@ -2012,26 +2012,7 @@ } /* depth */ - float depth = 0; - float depthThisCall = unit_depth_float(stateUsed->lifeData.depth_meter); - if(is_stateUsedSetToSim()) - { - depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2] + depthLastCall[3] + depthLastCall[4] + depthLastCall[5] + depthLastCall[6] + depthLastCall[7] + depthLastCall[8]) / 10.0f; - - idDepthLastCall++; - if(idDepthLastCall >= 9) - idDepthLastCall = 0; - depthLastCall[idDepthLastCall] = depthThisCall; - } - else - { - depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2]) / 4.0f; - - idDepthLastCall++; - if(idDepthLastCall >= 3) - idDepthLastCall = 0; - depthLastCall[idDepthLastCall] = depthThisCall; - } + float depth = unit_depth_float(stateUsed->lifeData.depth_meter); if(depth <= 0.3f) depth = 0;