kopia lustrzana https://github.com/cyoung/stratux
commit
36f5ccff7b
|
@ -903,7 +903,7 @@ func updateMessageStats() {
|
|||
|
||||
func updateStatus() {
|
||||
if mySituation.GPSFixQuality == 2 {
|
||||
globalStatus.GPS_solution = "GPS + SBAS (WAAS)"
|
||||
globalStatus.GPS_solution = "GPS + SBAS (WAAS / EGNOS)"
|
||||
} else if mySituation.GPSFixQuality == 1 {
|
||||
globalStatus.GPS_solution = "3D GPS"
|
||||
} else if mySituation.GPSFixQuality == 6 {
|
||||
|
|
85
main/gps.go
85
main/gps.go
|
@ -263,32 +263,9 @@ func initGPSSerial() bool {
|
|||
log.Printf("Finished writing SiRF GPS config to %s. Opening port to test connection.\n", device)
|
||||
}
|
||||
} else {
|
||||
|
||||
// Byte order for UBX configuration is little endian.
|
||||
|
||||
/*
|
||||
Set navigation settings.
|
||||
nav := make([]byte, 36)
|
||||
nav[0] = 0x05 // Set dyn and fixMode only.
|
||||
nav[1] = 0x00
|
||||
dyn.
|
||||
nav[2] = 0x07 // "Airborne with >2g Acceleration".
|
||||
nav[3] = 0x02 // 3D only.
|
||||
|
||||
p.Write(makeUBXCFG(0x06, 0x24, 36, nav))
|
||||
|
||||
// Turn off "time pulse" (usually drives an LED).
|
||||
tp5 := make([]byte, 32)
|
||||
tp5[4] = 0x32
|
||||
tp5[8] = 0x40
|
||||
tp5[9] = 0x42
|
||||
tp5[10] = 0x0F
|
||||
tp5[12] = 0x40
|
||||
tp5[13] = 0x42
|
||||
tp5[14] = 0x0F
|
||||
tp5[28] = 0xE7
|
||||
p.Write(makeUBXCFG(0x06, 0x31, 32, tp5))
|
||||
*/
|
||||
|
||||
// GNSS configuration CFG-GNSS for ublox 7 and higher, p. 125 (v8)
|
||||
|
||||
// Notes: ublox8 is multi-GNSS capable (simultaneous decoding of GPS and GLONASS, or
|
||||
|
@ -302,18 +279,26 @@ func initGPSSerial() bool {
|
|||
p.Write(makeUBXCFG(0x06, 0x09, 13, []byte{0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x17}))
|
||||
time.Sleep(100* time.Millisecond) // pause and wait for the GPS to finish configuring itself before closing / reopening the port
|
||||
|
||||
if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX9) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { // assume that any GPS connected to serial GPIO is ublox8 (RY835/6AI)
|
||||
// UBX-CFG-NMEA (change NMEA protocol version to 4.1)
|
||||
p.Write(makeUBXCFG(0x06, 0x17, 20, []byte{0x00, 0x41, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}))
|
||||
|
||||
if globalStatus.GPS_detected_type == GPS_TYPE_UBX9 {
|
||||
if globalSettings.DEBUG {
|
||||
log.Printf("UBX8/9/unknown device detected on USB, or GPS serial connection in use. Attempting GLONASS and Galelio configuration.\n")
|
||||
log.Printf("ublox 9 detected\n")
|
||||
}
|
||||
// ublox 9: use default GNSS configuration
|
||||
} 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)
|
||||
if globalSettings.DEBUG {
|
||||
log.Printf("ublox 8 detected\n")
|
||||
}
|
||||
// ublox 8
|
||||
cfgGnss := []byte{0x00, 0x20, 0x20, 0x06}
|
||||
gps := []byte{0x00, 0x08, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01} // enable GPS with 8-16 tracking channels
|
||||
sbas := []byte{0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x01, 0x01} // disable SBAS
|
||||
// sbas := []byte{0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x01, 0x01} // enable SBAS with 2-3 tracking channels
|
||||
beidou := []byte{0x03, 0x04, 0x10, 0x00, 0x00, 0x00, 0x01, 0x01} // this disables BEIDOU
|
||||
qzss := []byte{0x05, 0x01, 0x03, 0x00, 0x00, 0x00, 0x01, 0x01} // this disables QZSS
|
||||
glonass := []byte{0x06, 0x08, 0x0E, 0x00, 0x01, 0x00, 0x01, 0x01} // enable GLONASS with 8-14 tracking channels
|
||||
galileo := []byte{0x02, 0x04, 0x0A, 0x00, 0x01, 0x00, 0x01, 0x01} // enable Galileo with 4-10 tracking channels, ublox 8 does only support up to 10
|
||||
gps := []byte{0x00, 0x08, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01} // enable GPS with 8-16 tracking channels
|
||||
sbas := []byte{0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x01, 0x01} // disable SBAS
|
||||
beidou := []byte{0x03, 0x04, 0x10, 0x00, 0x00, 0x00, 0x01, 0x01} // disable BEIDOU
|
||||
qzss := []byte{0x05, 0x01, 0x03, 0x00, 0x00, 0x00, 0x01, 0x01} // disable QZSS
|
||||
glonass := []byte{0x06, 0x08, 0x0E, 0x00, 0x01, 0x00, 0x01, 0x01} // enable GLONASS with 8-14 tracking channels
|
||||
galileo := []byte{0x02, 0x04, 0x0A, 0x00, 0x01, 0x00, 0x01, 0x01} // enable Galileo with 4-10 tracking channels, ublox 8 does only support up to 10
|
||||
cfgGnss = append(cfgGnss, gps...)
|
||||
cfgGnss = append(cfgGnss, sbas...)
|
||||
cfgGnss = append(cfgGnss, beidou...)
|
||||
|
@ -322,15 +307,18 @@ func initGPSSerial() bool {
|
|||
cfgGnss = append(cfgGnss, galileo...)
|
||||
p.Write(makeUBXCFG(0x06, 0x3E, uint16(len(cfgGnss)), cfgGnss))
|
||||
p.Write(makeUBXCFG(0x06, 0x16, 8, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // SBAS off
|
||||
// p.Write(makeUBXCFG(0x06, 0x16, 8, []byte{0x01, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00})) // SBAS on & Auto Mode
|
||||
} else { // ublox 6,7
|
||||
} else if (globalStatus.GPS_detected_type == GPS_TYPE_UBX7) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX6) {
|
||||
if globalSettings.DEBUG {
|
||||
log.Printf("ublox 6 or 7 detected\n")
|
||||
}
|
||||
// ublox 6,7
|
||||
cfgGnss := []byte{0x00, 0x20, 0x20, 0x06}
|
||||
gps := []byte{0x00, 0x08, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01} // enable GPS with 8-16 tracking channels
|
||||
sbas := []byte{0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x01, 0x01} // enable SBAS with 2-3 tracking channels
|
||||
beidou := []byte{0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x01} // this disables BEIDOU
|
||||
qzss := []byte{0x05, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x01} // this disables QZSS
|
||||
glonass := []byte{0x06, 0x04, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x01} // this disables GLONASS
|
||||
galileo := []byte{0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x01, 0x01} // this disables Galileo
|
||||
gps := []byte{0x00, 0x08, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01} // enable GPS with 8-16 tracking channels
|
||||
sbas := []byte{0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x01, 0x01} // enable SBAS with 2-3 tracking channels
|
||||
beidou := []byte{0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x01} // disable BEIDOU
|
||||
qzss := []byte{0x05, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x01} // disable QZSS
|
||||
glonass := []byte{0x06, 0x04, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x01} // disable GLONASS
|
||||
galileo := []byte{0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x01, 0x01} // disable Galileo
|
||||
cfgGnss = append(cfgGnss, gps...)
|
||||
cfgGnss = append(cfgGnss, sbas...)
|
||||
cfgGnss = append(cfgGnss, beidou...)
|
||||
|
@ -353,13 +341,6 @@ func initGPSSerial() bool {
|
|||
// UBX-CFG-NAV5 |mask1...| dyn
|
||||
p.Write(makeUBXCFG(0x06, 0x24, 36, []byte{0x01, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Dynamic platform model: airborne with <1g acceleration
|
||||
|
||||
// UBX-CFG-NAVX5 |version.| |mask1...| |mask2...............| |reserved| minSV maxSV
|
||||
// p.Write(makeUBXCFG(0x06, 0x23, 40, []byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // minSVs=3, maxSVs=72
|
||||
|
||||
// UBX-CFG-TP5 U1 U1 | U1[2] | | I2 | | I2 | | U4 | | U4 | | U4 | | U4 | | I4 | | X4 |
|
||||
// p.Write(makeUBXCFG(0x06, 0x31, 32, []byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x19, 0x99, 0x99, 0x9A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6F}))
|
||||
// p.Write(makeUBXCFG(0x06, 0x31, 32, []byte{0x01, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x19, 0x99, 0x99, 0x9A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6F}))
|
||||
|
||||
// UBX-CFG-MSG (NMEA Standard Messages) msg msg Ports 1-6 (only GGA enabled)
|
||||
// Class ID DDC UART1 UART2 USB I2C Res
|
||||
p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x00, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x00})) // GGA - Global positioning system fix data, enabled every 10th message
|
||||
|
@ -383,10 +364,6 @@ func initGPSSerial() bool {
|
|||
p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF1, 0x03, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x00})) // Ublox - Satellite Status, enabled every 10th message
|
||||
p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF1, 0x04, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x00})) // Ublox - Time of Day and Clock Information, enabled every 10th message
|
||||
|
||||
// todo:
|
||||
// p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF1, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Ublox - Set NMEA message output rate
|
||||
// p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF1, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Ublox - Set Protocols and Baudrate
|
||||
|
||||
// Reconfigure serial port.
|
||||
cfg := make([]byte, 20)
|
||||
cfg[0] = 0x01 // portID.
|
||||
|
@ -1167,7 +1144,7 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
|||
svStr = fmt.Sprintf("G%d", sv)
|
||||
} else if sv <= 64 {
|
||||
svType = SAT_TYPE_BEIDOU
|
||||
svStr = fmt.Sprintf("B%d", sv) // tbd: conversion
|
||||
svStr = fmt.Sprintf("B%d", sv-32)
|
||||
} else if sv <= 96 {
|
||||
svType = SAT_TYPE_GLONASS
|
||||
svStr = fmt.Sprintf("R%d", sv-64)
|
||||
|
@ -1176,7 +1153,7 @@ func processNMEALine(l string) (sentenceUsed bool) {
|
|||
svStr = fmt.Sprintf("S%d", sv)
|
||||
} else if sv <= 163 {
|
||||
svType = SAT_TYPE_BEIDOU
|
||||
svStr = fmt.Sprintf("B%d", sv) // tbd: conversion
|
||||
svStr = fmt.Sprintf("B%d", sv-126)
|
||||
} else if sv <= 193 {
|
||||
svType = SAT_TYPE_QZSS
|
||||
svStr = fmt.Sprintf("Q%d", sv-192)
|
||||
|
|
|
@ -162,8 +162,8 @@ func sensorAttitudeSender() {
|
|||
// Set sensor gyro calibrations
|
||||
if c, d := &globalSettings.C, &globalSettings.D; d[0]*d[0]+d[1]*d[1]+d[2]*d[2] > 0 {
|
||||
s.SetCalibrations(c, d)
|
||||
log.Printf("AHRS Info: IMU Calibrations read from settings: accel %6f %6f %6f; gyro %6f %6f %6f\n",
|
||||
c[0], c[1], c[2], d[0], d[1], d[2])
|
||||
// log.Printf("AHRS Info: IMU Calibrations read from settings: accel %6f %6f %6f; gyro %6f %6f %6f\n",
|
||||
// c[0], c[1], c[2], d[0], d[1], d[2])
|
||||
} else {
|
||||
// Do an initial calibration
|
||||
select { // Don't block if cal isn't receiving: only need one calibration in the queue at a time.
|
||||
|
|
|
@ -85,6 +85,9 @@ function StatusCtrl($rootScope, $scope, $state, $http, $interval) {
|
|||
case 8:
|
||||
tempGpsHardwareString = "USB u-blox 8 GNSS receiver";
|
||||
break;
|
||||
case 9:
|
||||
tempGpsHardwareString = "USB u-blox 9 GNSS receiver";
|
||||
break;
|
||||
default:
|
||||
tempGpsHardwareString = "Not installed";
|
||||
}
|
||||
|
@ -134,7 +137,7 @@ function StatusCtrl($rootScope, $scope, $state, $http, $interval) {
|
|||
/* boardtemp is celcius to tenths */
|
||||
$scope.CPUTemp = String(boardtemp.toFixed(1) + '°C / ' + ((boardtemp * 9 / 5) + 32.0).toFixed(1) + '°F');
|
||||
$scope.CPUTempMin = String(status.CPUTempMin.toFixed(1)) + '°C';
|
||||
$scope.CPUTempMax = String(status.CPUTempMax.toFixed(1)) + '°C';
|
||||
$scope.CPUTempMax = String(status.CPUTempMax.toFixed(1)) + '°C';
|
||||
} else {
|
||||
// $('#CPUTemp').text('unavailable');
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue