[Gpredict-svn] SF.net SVN: gpredict:[733] branches/gpsd_testing/src
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <aa...@us...> - 2011-01-08 19:51:26
|
Revision: 733 http://gpredict.svn.sourceforge.net/gpredict/?rev=733&view=rev Author: aa1vs Date: 2011-01-08 19:51:20 +0000 (Sat, 08 Jan 2011) Log Message: ----------- Fix segfault when gpsd not connected. Make gtk-polar-view update pass if qth has moved significantly. Add qth_small_t element to pass to check if pass data is old. Modified Paths: -------------- branches/gpsd_testing/src/gtk-polar-view.c branches/gpsd_testing/src/predict-tools.c branches/gpsd_testing/src/predict-tools.h branches/gpsd_testing/src/qth-data.c Modified: branches/gpsd_testing/src/gtk-polar-view.c =================================================================== --- branches/gpsd_testing/src/gtk-polar-view.c 2011-01-08 18:26:24 UTC (rev 732) +++ branches/gpsd_testing/src/gtk-polar-view.c 2011-01-08 19:51:20 UTC (rev 733) @@ -846,6 +846,7 @@ /* free pass info */ free_pass (obj->pass); + obj->pass=NULL; /* if this was the selected satellite we need to clear the info text @@ -914,8 +915,38 @@ g_free (text); } + if (obj->pass) { + if (qth_small_dist(polv->qth,(obj->pass->qth_comp))>1.0){ + root = goo_canvas_get_root_item_model (GOO_CANVAS (polv->canvas)); + /* remove sky track */ + if (obj->showtrack) { + idx = goo_canvas_item_model_find_child (root, obj->track); + if (idx != -1) + goo_canvas_item_model_remove_child (root, idx); + + for (i = 0; i < TRACK_TICK_NUM; i++) { + idx = goo_canvas_item_model_find_child (root, obj->trtick[i]); + if (idx != -1) + goo_canvas_item_model_remove_child (root, idx); + } + } + + /* free pass info */ + free_pass (obj->pass); + obj->pass=NULL; + + /*compute new pass */ + obj->pass = get_current_pass (sat, polv->qth, now); + /* Finally, create the sky track if necessary */ + if (obj->showtrack) + create_track (polv, obj, sat); + + } + } g_free (losstr); g_free (catnum); // FIXME: why free here, what about else? + + } else { /* add sat to canvas */ Modified: branches/gpsd_testing/src/predict-tools.c =================================================================== --- branches/gpsd_testing/src/predict-tools.c 2011-01-08 18:26:24 UTC (rev 732) +++ branches/gpsd_testing/src/predict-tools.c 2011-01-08 19:51:20 UTC (rev 733) @@ -595,6 +595,9 @@ iter++; } } + + /*copy qth data into the pass for later comparisons*/ + qth_small_save(qth,&(pass->qth_comp)); return pass; } @@ -1012,6 +1015,9 @@ pass->tca = tca; } + + /*copy qth data into the pass for later comparisons*/ + qth_small_save(qth,&(pass->qth_comp)); return pass; } Modified: branches/gpsd_testing/src/predict-tools.h =================================================================== --- branches/gpsd_testing/src/predict-tools.h 2011-01-08 18:26:24 UTC (rev 732) +++ branches/gpsd_testing/src/predict-tools.h 2011-01-08 19:51:20 UTC (rev 733) @@ -49,6 +49,7 @@ gdouble maxel_az; /*!< Azimuth at maximum elevation */ gchar vis[4]; /*!< Visibility string, e.g. VSE, -S-, V-- */ GSList *details; /*!< List of pass_detail_t entries */ + qth_small_t qth_comp; /*!< Short version of qth at time computed */ } pass_t; Modified: branches/gpsd_testing/src/qth-data.c =================================================================== --- branches/gpsd_testing/src/qth-data.c 2011-01-08 18:26:24 UTC (rev 732) +++ branches/gpsd_testing/src/qth-data.c 2011-01-08 19:51:20 UTC (rev 733) @@ -472,18 +472,20 @@ break; case QTH_GPSD_TYPE: #if HAS_LIBGPS - /* open the connection to gpsd and start the stream */ - //qth->gps_data=gps_open(server,port); + /* open the connection to gpsd and start the stream */ + //qth->gps_data=gps_open(server,port); qth->gps_data=g_try_new0(struct gps_data_t,1); if (gps_open_r(server,port,qth->gps_data)==-1) { - printf("Could not open gps\n"); - return FALSE; - } else { - (void)gps_stream(qth->gps_data, WATCH_ENABLE, NULL); - } + free(qth->gps_data); + qth->gps_data=NULL; + printf("Could not open gps\n"); + return FALSE; + } else { + (void)gps_stream(qth->gps_data, WATCH_ENABLE, NULL); + } #else - return FALSE; + return FALSE; #endif break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |