Navigation GPS
Feb 16, 2021 19:14:51 GMT 1
Post by alexfish on Feb 16, 2021 19:14:51 GMT 1
Hi All
NOTE:Thread Closed: Hug API HERE
I am in progress of making a navigation app written in bacon , as can say
from this thread will be applying various code from diffent threads HERE.
in one thead RE X11 widgets I mentioned a gps nmea parser.
I found a simple parser on Github. so here, have a simple parser
in archive are gps.h and gps.c
at present using c print functions , so yes room for improvements , but it be hot off the press.
the bacon code
use from terminal ,sample String
I be busy for rest of week , Rest of bits to follow
remember to change the path of where gps.c & gps.h are
ADDED X11/cairo testframe : will not work on PI3
Now in process of looking at original X11/cairo the works on PI3(only)
Please Note : at init stage ; there are 162 images to download and convert
before the Window shows . IE combine openstreet & openseamap marks
Hence launch from the Terminal to monitor progress
key input works , use arrow keys + PageUp/PageDown for Zoom 1 and 2
Maximize the window , will see Large red square and 2 smaller square outlines
the smallest has peep hole 1px * 1 px that should be the GPS cord's
can change 'zoom' + lat and long..
x11/cairo file updated
Sorted Mem loss + now have stable key input draw event :: IE should be no flicker
BR
Alex
NOTE:Thread Closed: Hug API HERE
I am in progress of making a navigation app written in bacon , as can say
from this thread will be applying various code from diffent threads HERE.
in one thead RE X11 widgets I mentioned a gps nmea parser.
I found a simple parser on Github. so here, have a simple parser
in archive are gps.h and gps.c
at present using c print functions , so yes room for improvements , but it be hot off the press.
the bacon code
' demo gps.bac
' TODO change path to files gps.c & gps.h
PRAGMA INCLUDE /home/pi/bacon/gps.h
PRAGMA INCLUDE /home/pi/bacon/gps.c
OPTION PARSE FALSE
SUB print_tpv_value(const char *name, const char *format, const int32_t value, const int32_t scale_factor)
printf("%s: ", name)
IF (GPS_INVALID_VALUE != value) THEN
printf(format, (double)value / scale_factor)
ELSE
puts("INVALID")
END IF
END SUB
LOCAL tpv TYPE struct gps_tpv
LOCAL result TYPE int
DECLARE str[256] TYPE char
IF (argc != 2) THEN
PRINT "Usage: PROGRAM NMEA\n"
END
END IF
/* Append CRLF to the user supplied string */
snprintf(str, sizeof(str), "%s\r\n", argv[1]);
/* Sets the data to a known state */
gps_init_tpv(&tpv)
/* Attempt to decode the user supplied string */
result = gps_decode(&tpv, str)
IF (result != GPS_OK) THEN
fprintf(stderr, "Error (%d): %s\n", result, gps_error_string(result))
END
END IF
printf("Talker ID: %s\n", tpv.talker_id)
printf("Time Stamp: %s\n", tpv.time)
print_tpv_value("Latitude", "%.6f\n", tpv.latitude, GPS_LAT_LON_FACTOR)
print_tpv_value("Longitude", "%.6f\n", tpv.longitude, GPS_LAT_LON_FACTOR)
print_tpv_value("Altitude", "%.3f\n", tpv.altitude, GPS_VALUE_FACTOR)
print_tpv_value("Track", "%.3f\n", tpv.track, GPS_VALUE_FACTOR)
print_tpv_value("Speed", "%.3f\n", tpv.speed, GPS_VALUE_FACTOR)
use from terminal ,sample String
'$GPRMC,023044,A,3907.3840,N,12102.4692,W,0.0,156.1,131102,15.3,E,A*37'
I be busy for rest of week , Rest of bits to follow
remember to change the path of where gps.c & gps.h are
ADDED X11/cairo testframe : will not work on PI3
Now in process of looking at original X11/cairo the works on PI3(only)
Please Note : at init stage ; there are 162 images to download and convert
before the Window shows . IE combine openstreet & openseamap marks
Hence launch from the Terminal to monitor progress
key input works , use arrow keys + PageUp/PageDown for Zoom 1 and 2
Maximize the window , will see Large red square and 2 smaller square outlines
the smallest has peep hole 1px * 1 px that should be the GPS cord's
can change 'zoom' + lat and long..
x11/cairo file updated
Sorted Mem loss + now have stable key input draw event :: IE should be no flicker
BR
Alex