From 2888da438e082454655061bcf748f728140e5cdf Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 19 Oct 2007 14:01:01 +0300 Subject: [PATCH] Speek a simple "distance to destination xy" thingy --- src/map.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/map.c b/src/map.c index 1ea1b5c..35d4cc1 100644 --- a/src/map.c +++ b/src/map.c @@ -1012,19 +1012,31 @@ if (!s && !mp && !sp) { gtk_label_set_label(GTK_LABEL(info_banner.location), buffer); } +#define KM10KNOTS 5.39956803 + static void map_update_destination(gdouble lat, gdouble lon) { gdouble dh=0.0; gdouble dt; -gchar buffer[32]; +static gdouble prev_dt=99999.0; +gchar buffer[64]; if (_dest.valid) { dt=calculate_distance(lat, lon, _dest.lat, _dest.lon); dh=calculate_course(lat, lon, _dest.lat, _dest.lon); snprintf(buffer, sizeof(buffer), "%.02f %s (%0.02f)", dt * UNITS_CONVERT[_units], UNITS_TEXT[_units], dh); gtk_label_set_label(GTK_LABEL(info_banner.distance), buffer); + if (dtprev_dt+KM10KNOTS) { + prev_dt=dt; + } + g_printf("%f (Prev:%f)\n", prev_dt, dt); } else { + prev_dt=99999.0; gtk_label_set_label(GTK_LABEL(info_banner.distance), ""); } gtk_compass_set_dest_heading(_gps_compass, _dest.valid, (gfloat)dh); -- 2.39.5