navit-project.org
http://forum.navit-project.org/

Tomtom patch avoid old recommends after leafing track.
http://forum.navit-project.org/viewtopic.php?f=17&t=572
Page 1 of 1

Author:  Gernot2 [ 20 Jul 2015, 13:42 ]
Post subject:  Tomtom patch avoid old recommends after leafing track.

Tomtom is a slow device which freeze some time after leafing the track.
/var/run/gpspipe buffer in this case old positions what lead to old and wrong messages.

This patch for the tomtom toolchain drain the buffer in this special case.

Code:
--- /home/w/navit/navit/vehicle/file/vehicle_file.c   2015-05-26 06:22:43.791459878 +0200
+++ /home/w/OpenTomSDK/applications/build/navit/navit/vehicle/file/vehicle_file.c   2015-07-19 09:59:10.865319628 +0200
@@ -70,7 +70,7 @@
    file_type_pipe = 1, file_type_device, file_type_file, file_type_socket, file_type_serial
 };
 
-static int buffer_size = 1024;
+static int buffer_size = 2048;
 
 struct gps_sat {
    int prn;
@@ -622,7 +622,7 @@
 static void
 vehicle_file_io(struct vehicle_priv *priv)
 {
-   int size, rc = 0;
+   int size, rc = 0, lagdetect=0;
    char *str, *tok;
     dbg(lvl_debug, "vehicle_file_io : enter\n");
 
@@ -656,6 +656,13 @@
       return;
    }
    priv->buffer_pos += size;
+   lagdetect=0;
+   if(priv->buffer_pos==(buffer_size-1)) {
+      if(priv->file_type == file_type_device) {
+         printf("buffer full, skip old data in fifo %d %d\n",priv->buffer_pos,size);
+         lagdetect=1;
+      }
+   }
    priv->buffer[priv->buffer_pos] = '\0';
    dbg(lvl_debug, "size=%d pos=%d buffer='%s'\n", size,
        priv->buffer_pos, priv->buffer);
@@ -680,7 +687,7 @@
           "Overflow. Most likely wrong baud rate or no nmea protocol\n");
       priv->buffer_pos = 0;
    }
-   if (rc)
+   if (rc&&(lagdetect==0))
       callback_list_call_attr_0(priv->cbl, attr_position_coord_geo);
 }
 


Gernot

Author:  sleske [ 21 Jul 2015, 08:31 ]
Post subject:  Re: Tomtom patch avoid old recommends after leafing track.

Gernot2 wrote:
Tomtom is a slow device which freeze some time after leafing the track.
/var/run/gpspipe buffer in this case old positions what lead to old and wrong messages.
This patch for the tomtom toolchain drain the buffer in this special case.


Thank you for your contribution.

Unfortunately, Navit does not have a lot of TomTom developers at present, so it might take a while for this idea to be worked on. Still, maybe someone will see it :-).

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/