wiki:plugin_gps

Version 4 (modified by michu at neophob com, 12 years ago) (diff)

--

GPS plugin

example config

Here is my (michu / neophob.com) gps widget config:

#define SHOW_ALTITUDE           0x000000001
#define SHOW_SPEED              0x000000010
#define SHOW_COURSE             0x000000100
#define SHOW_SATELLITES         0x000001000
#define SHOW_QUALITY            0x000010000
#define SHOW_STATUS             0x000100000
#define SHOW_TIME_UTC           0x001000000
#define SHOW_DATE               0x010000000

#define DISPLAY_NO_PREFIX       0x000000001
#define DISPLAY_SPEED_IN_KNOTS  0x000000010

Widget gps-test1 {
    class  'Text'
    expression gps::parse('0x0000111','0')
    width  20
    update tack
    align  'C'
}

Widget gps-test2 {
    class  'Text'
    expression gps::parse('0x10001000','0x01')
    width  20
    update tack
    align  'C'
}

Widget gps-test3 {
    class  'Text'
    prefix 'GPS/'
    expression gps::parse('0x011111111','0')
    width  20
    update tack
    align  'M'
    speed 250
}

This looks like this when using ncurses as output:

# ./lcd4linux -F -vv -q
┌────────────────────┐
│                    │
│GPS/lt:545 spd:1 dir│
│alt:545 spd:1 dir:N │ << 3 values
│     8 191194       │ << here is the prefix disbled (2nd parameter)
└────────────────────┘

Functions

gps::parse(OPTION-PARAM, DISPLAY-PARAM)return gps information based on your parameter

OPTION Parameter:
#define SHOW_ALTITUDE 0x000000001
#define SHOW_SPEED 0x000000010
#define SHOW_COURSE 0x000000100
#define SHOW_SATELLITES 0x000001000
#define SHOW_QUALITY 0x000010000
#define SHOW_STATUS 0x000100000
#define SHOW_TIME_UTC 0x001000000
#define SHOW_DATE 0x010000000


DISPLAY Parameter:
#define DISPLAY_NO_PREFIX 0x000000001
#define DISPLAY_SPEED_IN_KNOTS 0x000000010

Examples:
              - gps::parse('0x011','0') will display the altitude and speed -> alt:500 spd:43
              - gps::parse('0x01100','0') will display the course and the numbers of satellites -> dir:NO sat:3
              - gps::parse('0x01','0x01') will display the speed without prefix -> 50
              - gps::parse('0x01','0x01') will display the speed in knots without prefix -> 27

Additional info

This plugin tries to connect per default to the gps device at /dev/usb/tts/1. If your GPS device is connected to another device you can use the environment variable GPS_PORT.
For example export GPS_PORT=/dev/tty/2

There is also an emulator mode, so you dont need a physical GPS device, instead plugin_gps.c uses a nmea string. This is usefull for testing.

Dev

You need libnmeap to compile this plugin, src: http://www.dmh2000.com/nmea/nmeap.shtml.
If you want more information about this plugin or a openwrt binary visit http://www.neophob.com/.
Cheers Michu