comparison Discovery/Src/t7.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 d36596281501
comparison
equal deleted inserted replaced
172:c659fda83e44 177:458f16cda15c
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)