[ gpsdrive ] Miles per hour
Paul Martin
pm at debian.org
Mon Jan 5 06:43:40 AKST 2009
On Mon, Jan 05, 2009 at 10:00:16AM -0500, R. G. Newbury wrote:
> Paul Martin wrote:
>> One little bug in the new code that uses libgps... it always returns speeds
>> in kph even when you're set to use miles. I had a little surprise yesterday
>> when I first used it in for real since the changes.
>
> It really needs a setting for the unit conversion and conversions from
> gps metres per second to:
>
> direct metres per second
> kilometres per hour
> miles per hour
> nautical miles per hour
> feet per second
kph, mph and knots (nautical mph) are already supported by gpsdrive. The
milesconv variable contains the current conversion ratio from kph to the
unit in use. It's done here in src/settings.c:
static gint
setdistmode_cb (GtkWidget *widget)
{
gint selection;
selection = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
switch (selection)
{
case DIST_MILES:
milesconv = KM2MILES;
local_config.distmode = DIST_MILES;
break;
case DIST_METRIC:
milesconv = 1.0;
local_config.distmode = DIST_METRIC;
break;
case DIST_NAUTIC:
milesconv = KM2NAUTIC;
local_config.distmode = DIST_NAUTIC;
break;
}
current.needtosave = TRUE;
if (mydebug >10)
fprintf (stderr, "Setting distance format to %d %%.\n",
local_config.distmode);
return TRUE;
}
--
Paul Martin <pm at debian.org>
More information about the GPSdrive
mailing list