From: robertl Date: Tue, 21 Jul 2009 05:18:37 +0000 (+0000) Subject: track_recompute: don't recompute speed if we already have it. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~199^2~205 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2aad19f4341162438a4534c130b7cd1c2ac28343;p=gpsbabel.git track_recompute: don't recompute speed if we already have it. --- diff --git a/route.c b/route.c index 255129ad7..e6f8b1ff6 100644 --- a/route.c +++ b/route.c @@ -565,10 +565,15 @@ void track_recompute(const route_head *trk, computed_trkdata **trkdatap) } /* - * If we've moved as much as a meter, recompute speed. + * If we've moved as much as a meter, + * conditionally recompute speeds. */ if (timed && (dist > 1)) { - WAYPT_SET(this, speed, dist / labs(timed)); + if(!WAYPT_HAS(this, speed)) { + // Only recompute speed if the waypoint + // didn't already have a speed + WAYPT_SET(this, speed, dist / labs(timed)); + } if (this->speed > tdata->max_spd) { tdata->max_spd = this->speed; }