kopia lustrzana https://github.com/cyoung/stratux
synced gps type enumeration in javascript and go code
rodzic
e6d1586a9f
commit
fd5f64a816
|
@ -92,24 +92,31 @@ const (
|
|||
GPS_TYPE_GARMIN = 0x06
|
||||
*/
|
||||
|
||||
GPS_TYPE_UBX10 = 0x20 // 0x0A and 0x10 allready in use below
|
||||
GPS_TYPE_UBX9 = 0x09
|
||||
GPS_TYPE_UBX8 = 0x08
|
||||
GPS_TYPE_UBX7 = 0x07
|
||||
GPS_TYPE_UBX6 = 0x06
|
||||
GPS_TYPE_UBX_GEN = 0x05
|
||||
GPS_TYPE_PROLIFIC = 0x02
|
||||
GPS_TYPE_UART = 0x01
|
||||
GPS_TYPE_SERIAL = 0x0A
|
||||
GPS_TYPE_OGNTRACKER = 0x03
|
||||
GPS_TYPE_GXAIRCOM = 0x0F
|
||||
GPS_TYPE_SOFTRF_DONGLE = 0x0B
|
||||
GPS_TYPE_NETWORK = 0x0C
|
||||
// for historical reasons lower nibbe contains gps type, upper nibble containsprotocol type.
|
||||
// Additionally this enumeration has a javascript duplicte in web/plates/js/status.js, they have to be kept in sync manually
|
||||
// This is somewhat ugly but difficult to change without breaking backward compatibility
|
||||
|
||||
GPS_TYPE_UNKNOWN = 0xFF
|
||||
// lower nibble gps type (dont forget to use only numbers form 0 to 15)
|
||||
|
||||
GPS_TYPE_ANY = 1 // Any generic GPS - no reconfiguring applied
|
||||
GPS_TYPE_PROLIFIC = 2
|
||||
GPS_TYPE_OGNTRACKER = 3
|
||||
GPS_TYPE_UBX_GEN = 4
|
||||
GPS_TYPE_UBX10 = 5
|
||||
//GPS_TYPE_UBX6 = 6
|
||||
GPS_TYPE_UBX6or7 = 7
|
||||
GPS_TYPE_UBX8 = 8
|
||||
GPS_TYPE_UBX9 = 9
|
||||
GPS_TYPE_SERIAL = 10 // 0x0A
|
||||
GPS_TYPE_SOFTRF_DONGLE = 11 // 0x0B
|
||||
GPS_TYPE_NETWORK = 12 // 0x0C
|
||||
GPS_TYPE_GXAIRCOM = 15 // 0x0F
|
||||
|
||||
|
||||
// upper nibble is used for the protocol
|
||||
GPS_PROTOCOL_NMEA = 0x10
|
||||
// other GPS types to be defined as needed
|
||||
|
||||
|
||||
|
||||
)
|
||||
|
||||
var STRATUX_WWW_DIR = STRATUX_HOME + "www/"
|
||||
|
|
34
main/gps.go
34
main/gps.go
|
@ -7,7 +7,6 @@
|
|||
gps.go: GPS functions, GPS init, AHRS status messages, other external sensor monitoring.
|
||||
*/
|
||||
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -229,7 +228,7 @@ func initGPSSerial() bool {
|
|||
switch chip {
|
||||
case "ublox6":
|
||||
case "ublox7":
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_UBX7
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_UBX6or7
|
||||
logDbg("GPS - configuring chip as ublox6 or ublox7")
|
||||
break;
|
||||
case "ublox8":
|
||||
|
@ -249,8 +248,8 @@ func initGPSSerial() bool {
|
|||
logDbg("GPS - configuring chip as generic ublox chip")
|
||||
break;
|
||||
default:
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_UNKNOWN
|
||||
logDbg("GPS - configuring gps chip as unknown -> no further configuration, use gps as it is")
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_ANY
|
||||
logDbg("GPS - configuring gps chip as other -> no further configuration, use gps as it is")
|
||||
}
|
||||
device = globalSettings.GpsManualDevice
|
||||
targetBaudRate = globalSettings.GpsManualTargetBaud
|
||||
|
@ -266,10 +265,10 @@ func initGPSSerial() bool {
|
|||
gpsTimeOffsetPpsMs = 80 * time.Millisecond // Ublox 8 seems to have higher delay
|
||||
} else if _, err := os.Stat("/dev/ublox7"); err == nil { // u-blox 7 (VK-172, VK-162 Rev 2, GPYes, RY725AI over USB).
|
||||
device = "/dev/ublox7"
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_UBX7
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_UBX6or7
|
||||
} else if _, err := os.Stat("/dev/ublox6"); err == nil { // u-blox 6 (VK-162 Rev 1).
|
||||
device = "/dev/ublox6"
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_UBX6
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_UBX6or7
|
||||
} else if _, err := os.Stat("/dev/prolific0"); err == nil { // Assume it's a BU-353-S4 SIRF IV.
|
||||
//TODO: Check a "serialout" flag and/or deal with multiple prolific devices.
|
||||
isSirfIV = true
|
||||
|
@ -287,9 +286,14 @@ func initGPSSerial() bool {
|
|||
device = "/dev/softrf_dongle"
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_SOFTRF_DONGLE
|
||||
baudrates[0] = 115200
|
||||
} else if _, err := os.Stat("/dev/ttyAMA0"); err == nil { // ttyAMA0 is PL011 UART (GPIO pins 8 and 10) on all RPi.
|
||||
} else if _, err := os.Stat("/dev/ttyAMA0"); err == nil {
|
||||
// ttyAMA0 is PL011 UART (GPIO pins 8 and 10) on all RPi.
|
||||
// assume that any GPS connected to serial GPIO is ublox8 (RY835/6AI)
|
||||
device = "/dev/ttyAMA0"
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_UART
|
||||
logDbg("GPS WARN - found a serial device at: %s", device)
|
||||
logDbg("GPS WARN - assuming this an generic u-blox device: %s", device)
|
||||
logDbg("GPS WARN - it is recommended to configure this device in /boot/stratux.conf")
|
||||
globalStatus.GPS_detected_type = GPS_TYPE_UBX_GEN
|
||||
baudrates = []int{115200, 38400, 9600}
|
||||
} else {
|
||||
logDbg("GPS - no gps device found.\n")
|
||||
|
@ -330,12 +334,10 @@ func initGPSSerial() bool {
|
|||
log.Printf("Finished writing SiRF GPS config to %s. Opening port to test connection.\n", device)
|
||||
}
|
||||
} else if (
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX6 ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX7 ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX8 ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX9 ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX10 ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UART ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX6or7 ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX8 ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX9 ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX10 ||
|
||||
globalStatus.GPS_detected_type == GPS_TYPE_UBX_GEN ) {
|
||||
|
||||
|
||||
|
@ -358,11 +360,11 @@ func initGPSSerial() bool {
|
|||
logDbg("GPS - ublox 9 detected\n")
|
||||
// ublox 9
|
||||
writeUblox9ConfigCommands(p)
|
||||
} else if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { // assume that any GPS connected to serial GPIO is ublox8 (RY835/6AI)
|
||||
} else if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) {
|
||||
logDbg("GPS - ublox 8 detected\n")
|
||||
// ublox 8
|
||||
writeUblox8ConfigCommands(p)
|
||||
} else if (globalStatus.GPS_detected_type == GPS_TYPE_UBX7) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX6) {
|
||||
} else if (globalStatus.GPS_detected_type == GPS_TYPE_UBX6or7) {
|
||||
logDbg("GPS - ublox 6 or 7 detected\n")
|
||||
// ublox 6,7
|
||||
cfgGnss := []byte{0x00, 0x00, 0xFF, 0x04} // numTrkChUse=0xFF: number of tracking channels to use will be set to number of tracking channels available in hardware
|
||||
|
|
|
@ -86,8 +86,9 @@ function StatusCtrl($rootScope, $scope, $state, $http, $interval, craftService)
|
|||
var gpsHardwareCode = (status.GPS_detected_type & 0x0f);
|
||||
var tempGpsHardwareString = "Not installed";
|
||||
switch(gpsHardwareCode) {
|
||||
// Keep in mind that this must be in sync with the enumeration in gps.go
|
||||
case 1:
|
||||
tempGpsHardwareString = "Serial port";
|
||||
tempGpsHardwareString = "Generic GPS device";
|
||||
break;
|
||||
case 2:
|
||||
tempGpsHardwareString = "Prolific USB-serial bridge";
|
||||
|
@ -95,20 +96,23 @@ function StatusCtrl($rootScope, $scope, $state, $http, $interval, craftService)
|
|||
case 3:
|
||||
tempGpsHardwareString = "OGN Tracker";
|
||||
break;
|
||||
case 6:
|
||||
tempGpsHardwareString = "USB u-blox 6 GPS receiver";
|
||||
case 4:
|
||||
tempGpsHardwareString = "generic u-blox device";
|
||||
break;
|
||||
case 5:
|
||||
tempGpsHardwareString = "u-blox 10 GNSS receiver";
|
||||
break;
|
||||
case 7:
|
||||
tempGpsHardwareString = "USB u-blox 7 GNSS receiver";
|
||||
tempGpsHardwareString = "u-blox 6 or 7 GNSS receiver";
|
||||
break;
|
||||
case 8:
|
||||
tempGpsHardwareString = "USB u-blox 8 GNSS receiver";
|
||||
tempGpsHardwareString = "u-blox 8 GNSS receiver";
|
||||
break;
|
||||
case 9:
|
||||
tempGpsHardwareString = "USB u-blox 9 GNSS receiver";
|
||||
tempGpsHardwareString = "u-blox 9 GNSS receiver";
|
||||
break;
|
||||
case 10:
|
||||
tempGpsHardwareString = "USB Serial IN";
|
||||
tempGpsHardwareString = "USB/Serial IN";
|
||||
break;
|
||||
case 11:
|
||||
tempGpsHardwareString = "SoftRF Dongle";
|
||||
|
|
Ładowanie…
Reference in New Issue