提交 7dcbde6a 编写于 作者: D dev

长时间测试后,解决删除已经消失的标记的问题。

上级 6bb350bf
......@@ -1319,14 +1319,13 @@ good_preamble:
/* Show the currently captured interactive data on screen. */
void interactiveShowData(void) {
struct aircraft *a = Modes.aircrafts;
struct aircraft * before_a=0,*after_a = 0;
time_t now = time(NULL);
int count = 0;
//printf("\x1b[H\x1b[2J"); /* Clear the screen */
/* printf(
"Hex Flight Altitude Speed Lat Lon Track Messages Seen %s\n"
"--------------------------------------------------------------------------------\n",
progress);
*/
static time_t lastClearTime = 0;
static const int timeKeep=60;
if (lastClearTime==0)
lastClearTime = time(0);
while(a ) {
if (a->need_display)
{
......@@ -1339,13 +1338,12 @@ void interactiveShowData(void) {
speed *= 1.852;
}
fprintf(stdout,"source=adsb;destin=geomarker;function=update_icon;icon=flight;name=%s;lat=%f;lon=%f;rotate=%d;smooth=1;scale=%f\n",
a->hexaddr, a->lat, a->lon, a->track, (altitude/30000.0+1),
(int)(now - a->seen));
a->hexaddr, a->lat, a->lon, a->track, (altitude/30000.0+1));
fprintf(stdout,"source=adsb;destin=geomarker;function=update_props;name=%s;LABEL=%s;Alt=%d;Speed=%d;lat=%f;lon=%f;track=%d;msgs=%ld;time=%d;\n",
a->hexaddr, a->flight, altitude, speed,
a->lat, a->lon, a->track, a->messages,
(int)(now - a->seen));
(int)(now));
fflush(stdout);
fprintf(stderr,"%-6s %-8s %-9d %-7d %-7.03f %-7.03f %-3d %-9ld %d sec\n",
a->hexaddr, a->flight, altitude, speed,
......@@ -1356,6 +1354,32 @@ void interactiveShowData(void) {
a = a->next;
count++;
}
if (lastClearTime + timeKeep < now)
{
lastClearTime = now;
a = Modes.aircrafts;
before_a = 0;
while (a)
{
after_a = a->next;
if (a->seen + timeKeep < now)
{
printf ("source=adsb;destin=geomarker;function=delete_marks;name0=%s;\n",a->hexaddr);
//delete node
if (before_a)
before_a->next = after_a;
else
Modes.aircrafts = after_a;
free(a);
a = after_a;
}
if (a)
{
before_a = a;
a = a->next;
}
}
}
}
/* When a new message is available, because it was decoded from the
* RTL device, file, or received in the TCP input port, or any other
......@@ -1571,7 +1595,6 @@ struct aircraft *interactiveReceiveData(struct modesMessage *mm) {
aux = Modes.aircrafts;
while(aux->next != a) aux = aux->next;
/* Now we are a node before the aircraft to remove. */
printf("function=delete_marks;name0=%s;\n",a->hexaddr);
aux->next = aux->next->next; /* removed. */
/* Add on head */
a->next = Modes.aircrafts;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册