comparison Discovery/Src/t7.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 d36596281501
comparison
equal deleted inserted replaced
173:05c770dc2911 174:ecb71521d004
2010 nextstopDepthMeter = 0; 2010 nextstopDepthMeter = 0;
2011 nextstopLengthSeconds = 0; 2011 nextstopLengthSeconds = 0;
2012 } 2012 }
2013 2013
2014 /* depth */ 2014 /* depth */
2015 float depth = 0; 2015 float depth = unit_depth_float(stateUsed->lifeData.depth_meter);
2016 float depthThisCall = unit_depth_float(stateUsed->lifeData.depth_meter);
2017 if(is_stateUsedSetToSim())
2018 {
2019 depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2] + depthLastCall[3] + depthLastCall[4] + depthLastCall[5] + depthLastCall[6] + depthLastCall[7] + depthLastCall[8]) / 10.0f;
2020
2021 idDepthLastCall++;
2022 if(idDepthLastCall >= 9)
2023 idDepthLastCall = 0;
2024 depthLastCall[idDepthLastCall] = depthThisCall;
2025 }
2026 else
2027 {
2028 depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2]) / 4.0f;
2029
2030 idDepthLastCall++;
2031 if(idDepthLastCall >= 3)
2032 idDepthLastCall = 0;
2033 depthLastCall[idDepthLastCall] = depthThisCall;
2034 }
2035 2016
2036 if(depth <= 0.3f) 2017 if(depth <= 0.3f)
2037 depth = 0; 2018 depth = 0;
2038 2019
2039 if(settingsGetPointer()->nonMetricalSystem) 2020 if(settingsGetPointer()->nonMetricalSystem)