gps_simulate_move(Gps *gps)
{
static gdouble slat=0, slon=0;
+gdouble plat, plon;
g_assert(gps);
if (g_random_double()<0.5) {
slat=g_random_double_range(-0.0003, 0.0003);
slon=g_random_double_range(-0.0003, 0.0003);
}
+plat=gps->data.lat;
+plon=gps->data.lon;
gps->data.lat+=slat;
gps->data.lon+=slon;
BOUND(gps->data.lat, -80.0, 80.0);
g_debug("Sim: %f %f\n", gps->data.lat, gps->data.lon);
gps->data.speed=1+g_random_double_range(0.1, 10.0);
-gps->data.heading+=g_random_double_range(-4.0, 4.0);
-BOUND(gps->data.heading, 0, 359);
+gps->data.heading=calculate_course(plat, plon, gps->data.lat, gps->data.lon);
gps->data.time=time(NULL);
gps_data_integerize(&gps->data);
track_add(&gps->data, FALSE);