glidernet / diy-tracker

Do-it-Yourself OGN Tracker software
GNU General Public License v3.0
27 stars 18 forks source link

Wait longer for valid GPS signal before switching baud rate #9

Closed kedder closed 6 years ago

kedder commented 6 years ago

GPS task seems to tune out from the right baud rate from time to time and start autobaud procedure even if it found the right baud rate before. On my device it is able to hold the correct baud rate just for several seconds.

I'm observing the following behavior without this patch: device outputs the GPS NMEA to console and then suddenly switches the GPS baud rate.

...
$GPRMC,201147.00,V,,,,,,,130118,,,N*76
$GPGGA,201147.00,,,,,0,00,99.99,,,,,,*67
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$POGNB,47.0,+22.4,102000.0,1.0,-56.0,-59.3,+0.06,*75
$PGRMZ,-56.0,m,3*10
$POGNR,0,0,,-111.0,40,+22,+44.0,3.22*41
$POGNB,47.5,+22.4,102000.0,1.0,-56.0,-59.3,-0.06,*76
$PGRMZ,-56.0,m,3*10
TaskGPS: switch to 115200bps
...

I think this happens because GPS data rate is 1Hz - which is exactly equals to timeout of autobaud procedure. So even slight delay causes device to look for data on different baud rate. This bumps timeout to 2 seconds, which makes problem go away on my device.