From aa3c1ed19ffadbf57ac8c188ce953ee4dab40d3d Mon Sep 17 00:00:00 2001 From: VirusPilot <43483458+VirusPilot@users.noreply.github.com> Date: Sat, 22 Jun 2019 14:08:17 +0200 Subject: [PATCH 1/8] ublox 9 - some inital edits --- main/gps.go | 106 ++++++++++++++++++++++------------------ web/plates/js/status.js | 3 ++ 2 files changed, 61 insertions(+), 48 deletions(-) diff --git a/main/gps.go b/main/gps.go index df6afbe1..1d5d7834 100755 --- a/main/gps.go +++ b/main/gps.go @@ -298,14 +298,18 @@ func initGPSSerial() bool { // gpsattitude too much -- without WAAS corrections, the algorithm could get jumpy at higher // sampling rates. - // load default configuration | clearMask | | saveMask | | loadMask | deviceMask - 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 + // ublox 6,7,8 + if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX7) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX6) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { + // load default configuration | clearMask | | saveMask | | loadMask | deviceMask + 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) - if globalSettings.DEBUG { - log.Printf("UBX8/9/unknown device detected on USB, or GPS serial connection in use. Attempting GLONASS and Galelio configuration.\n") - } + // ublox 6,7,8,9 + if globalStatus.GPS_detected_type == GPS_TYPE_UBX9 { + // ublox 9 tbd: GNSS configuration + } else if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { + // 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 @@ -323,7 +327,8 @@ func initGPSSerial() bool { 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) { + // 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 @@ -341,51 +346,56 @@ func initGPSSerial() bool { p.Write(makeUBXCFG(0x06, 0x16, 8, []byte{0x01, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00})) // SBAS on & Auto Mode } - // UBX-CFG-PMS - p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Full Power Mode - // p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Balanced Power Mode + if globalStatus.GPS_detected_type == GPS_TYPE_UBX9 { + // ublox 9 tbd: RATE, NAV5, NMEA Standard & PUBX MSG configuration + } else if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX7) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX6) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { + // ublox 6,7,8 + // UBX-CFG-PMS + p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Full Power Mode + // p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Balanced Power Mode - // UBX-CFG-RATE (payload bytes: little endian!) - // p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x0A, 0x00, 0x01, 0x00})) // 100ms & 10 cycles -> 1Hz - // p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x05, 0x00, 0x01, 0x00})) // 100ms & 5 cycles -> 2Hz - p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x01, 0x00, 0x01, 0x00})) // 100ms & 1 cycle -> 10Hz + // UBX-CFG-RATE (payload bytes: little endian!) + // p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x0A, 0x00, 0x01, 0x00})) // 100ms & 10 cycles -> 1Hz + // p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x05, 0x00, 0x01, 0x00})) // 100ms & 5 cycles -> 2Hz + p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x01, 0x00, 0x01, 0x00})) // 100ms & 1 cycle -> 10Hz - // 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-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-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-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 - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GLL - Latitude and longitude, with time of position fix and status - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GSA - GNSS DOP and Active Satellites - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GSV - GNSS Satellites in View - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // RMC - Recommended Minimum data - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // VGT - Course over ground and Ground speed - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GRS - GNSS Range Residuals - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GST - GNSS Pseudo Range Error Statistics - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // ZDA - Time and Date - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GBS - GNSS Satellite Fault Detection - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // DTM - Datum Reference - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GNS - GNSS fix data - // p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // ??? - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // VLW - Dual ground/water distance + // 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 + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GLL - Latitude and longitude, with time of position fix and status + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GSA - GNSS DOP and Active Satellites + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GSV - GNSS Satellites in View + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // RMC - Recommended Minimum data + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // VGT - Course over ground and Ground speed + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GRS - GNSS Range Residuals + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GST - GNSS Pseudo Range Error Statistics + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // ZDA - Time and Date + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GBS - GNSS Satellite Fault Detection + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // DTM - Datum Reference + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GNS - GNSS fix data + // p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // ??? + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // VLW - Dual ground/water distance - // UBX-CFG-MSG (NMEA PUBX Messages) msg msg Ports 1-6 - // Class ID DDC UART1 UART2 USB I2C Res - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF1, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00})) // Ublox - Lat/Long Position Data, enabled every message - 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 + // UBX-CFG-MSG (NMEA PUBX Messages) msg msg Ports 1-6 + // Class ID DDC UART1 UART2 USB I2C Res + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF1, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00})) // Ublox - Lat/Long Position Data, enabled every message + 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 + // 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) @@ -1167,7 +1177,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 +1186,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) diff --git a/web/plates/js/status.js b/web/plates/js/status.js index 43729e9c..6c130bb3 100644 --- a/web/plates/js/status.js +++ b/web/plates/js/status.js @@ -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"; } From 2135bf1cdf1cfa6602dfc30a0f34f12f7dbd8dcf Mon Sep 17 00:00:00 2001 From: VirusPilot <43483458+VirusPilot@users.noreply.github.com> Date: Sun, 23 Jun 2019 14:38:04 +0200 Subject: [PATCH 2/8] disable "AHRS Info: IMU Calibrations read from settings" log output to prevent from logfile overflow in case of no installed AHRS module --- main/sensors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/sensors.go b/main/sensors.go index 171c226f..0a2aa83a 100644 --- a/main/sensors.go +++ b/main/sensors.go @@ -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. From 9210dd3472adf4d802aa54716a0b127672c1873c Mon Sep 17 00:00:00 2001 From: VirusPilot <43483458+VirusPilot@users.noreply.github.com> Date: Sun, 23 Jun 2019 14:39:55 +0200 Subject: [PATCH 3/8] change GPS solutions info from "GPS + SBAS (WAAS)" to "GPS + SBAS (WAAS / EGNOS)" --- main/gen_gdl90.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index c83e049f..1e559149 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -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 { From 7a22db9d725f1353f400dd20b422b80491420c97 Mon Sep 17 00:00:00 2001 From: VirusPilot <43483458+VirusPilot@users.noreply.github.com> Date: Sun, 23 Jun 2019 19:55:34 +0200 Subject: [PATCH 4/8] Revert "ublox 9 - some inital edits" This reverts commit aa3c1ed19ffadbf57ac8c188ce953ee4dab40d3d. --- main/gps.go | 106 ++++++++++++++++++---------------------- web/plates/js/status.js | 3 -- 2 files changed, 48 insertions(+), 61 deletions(-) diff --git a/main/gps.go b/main/gps.go index 1d5d7834..df6afbe1 100755 --- a/main/gps.go +++ b/main/gps.go @@ -298,18 +298,14 @@ func initGPSSerial() bool { // gpsattitude too much -- without WAAS corrections, the algorithm could get jumpy at higher // sampling rates. - // ublox 6,7,8 - if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX7) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX6) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { - // load default configuration | clearMask | | saveMask | | loadMask | deviceMask - 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 - } + // load default configuration | clearMask | | saveMask | | loadMask | deviceMask + 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 - // ublox 6,7,8,9 - if globalStatus.GPS_detected_type == GPS_TYPE_UBX9 { - // ublox 9 tbd: GNSS configuration - } else if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { - // ublox 8 + 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) + if globalSettings.DEBUG { + log.Printf("UBX8/9/unknown device detected on USB, or GPS serial connection in use. Attempting GLONASS and Galelio configuration.\n") + } 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 @@ -327,8 +323,7 @@ func initGPSSerial() bool { 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 if (globalStatus.GPS_detected_type == GPS_TYPE_UBX7) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX6) { - // ublox 6,7 + } else { // 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 @@ -346,56 +341,51 @@ func initGPSSerial() bool { p.Write(makeUBXCFG(0x06, 0x16, 8, []byte{0x01, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00})) // SBAS on & Auto Mode } - if globalStatus.GPS_detected_type == GPS_TYPE_UBX9 { - // ublox 9 tbd: RATE, NAV5, NMEA Standard & PUBX MSG configuration - } else if (globalStatus.GPS_detected_type == GPS_TYPE_UBX8) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX7) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX6) || (globalStatus.GPS_detected_type == GPS_TYPE_UART) { - // ublox 6,7,8 - // UBX-CFG-PMS - p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Full Power Mode - // p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Balanced Power Mode + // UBX-CFG-PMS + p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Full Power Mode + // p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Balanced Power Mode - // UBX-CFG-RATE (payload bytes: little endian!) - // p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x0A, 0x00, 0x01, 0x00})) // 100ms & 10 cycles -> 1Hz - // p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x05, 0x00, 0x01, 0x00})) // 100ms & 5 cycles -> 2Hz - p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x01, 0x00, 0x01, 0x00})) // 100ms & 1 cycle -> 10Hz + // UBX-CFG-RATE (payload bytes: little endian!) + // p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x0A, 0x00, 0x01, 0x00})) // 100ms & 10 cycles -> 1Hz + // p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x05, 0x00, 0x01, 0x00})) // 100ms & 5 cycles -> 2Hz + p.Write(makeUBXCFG(0x06, 0x08, 6, []byte{0x64, 0x00, 0x01, 0x00, 0x01, 0x00})) // 100ms & 1 cycle -> 10Hz - // 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-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-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-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 - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GLL - Latitude and longitude, with time of position fix and status - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GSA - GNSS DOP and Active Satellites - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GSV - GNSS Satellites in View - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // RMC - Recommended Minimum data - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // VGT - Course over ground and Ground speed - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GRS - GNSS Range Residuals - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GST - GNSS Pseudo Range Error Statistics - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // ZDA - Time and Date - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GBS - GNSS Satellite Fault Detection - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // DTM - Datum Reference - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GNS - GNSS fix data - // p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // ??? - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // VLW - Dual ground/water distance + // 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 + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GLL - Latitude and longitude, with time of position fix and status + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GSA - GNSS DOP and Active Satellites + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GSV - GNSS Satellites in View + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // RMC - Recommended Minimum data + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // VGT - Course over ground and Ground speed + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GRS - GNSS Range Residuals + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GST - GNSS Pseudo Range Error Statistics + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // ZDA - Time and Date + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GBS - GNSS Satellite Fault Detection + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // DTM - Datum Reference + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // GNS - GNSS fix data + // p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // ??? + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // VLW - Dual ground/water distance - // UBX-CFG-MSG (NMEA PUBX Messages) msg msg Ports 1-6 - // Class ID DDC UART1 UART2 USB I2C Res - p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF1, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00})) // Ublox - Lat/Long Position Data, enabled every message - 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 + // UBX-CFG-MSG (NMEA PUBX Messages) msg msg Ports 1-6 + // Class ID DDC UART1 UART2 USB I2C Res + p.Write(makeUBXCFG(0x06, 0x01, 8, []byte{0xF1, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00})) // Ublox - Lat/Long Position Data, enabled every message + 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 - } + // 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) @@ -1177,7 +1167,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-32) + svStr = fmt.Sprintf("B%d", sv) // tbd: conversion } else if sv <= 96 { svType = SAT_TYPE_GLONASS svStr = fmt.Sprintf("R%d", sv-64) @@ -1186,7 +1176,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-126) + svStr = fmt.Sprintf("B%d", sv) // tbd: conversion } else if sv <= 193 { svType = SAT_TYPE_QZSS svStr = fmt.Sprintf("Q%d", sv-192) diff --git a/web/plates/js/status.js b/web/plates/js/status.js index 6c130bb3..43729e9c 100644 --- a/web/plates/js/status.js +++ b/web/plates/js/status.js @@ -85,9 +85,6 @@ 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"; } From f1ddf910fdc1868ddcd9e2cc27f0ba8e0aa28826 Mon Sep 17 00:00:00 2001 From: VirusPilot <43483458+VirusPilot@users.noreply.github.com> Date: Sun, 23 Jun 2019 19:58:48 +0200 Subject: [PATCH 5/8] Beidou svStr conversion done --- main/gps.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/gps.go b/main/gps.go index df6afbe1..dae44279 100755 --- a/main/gps.go +++ b/main/gps.go @@ -1167,7 +1167,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 +1176,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) From cc4b931009c9c955759a5e88c74138851979f5f6 Mon Sep 17 00:00:00 2001 From: VirusPilot <43483458+VirusPilot@users.noreply.github.com> Date: Sun, 23 Jun 2019 20:01:02 +0200 Subject: [PATCH 6/8] add ublox 9 info on status website --- web/plates/js/status.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/plates/js/status.js b/web/plates/js/status.js index 43729e9c..7f66071c 100644 --- a/web/plates/js/status.js +++ b/web/plates/js/status.js @@ -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'); } From 2a65adaaa764eb7631fabfbefebcbde207fefb3a Mon Sep 17 00:00:00 2001 From: VirusPilot <43483458+VirusPilot@users.noreply.github.com> Date: Sun, 23 Jun 2019 21:30:34 +0200 Subject: [PATCH 7/8] ublox 9: use UBX-CFG, except for GNSS CFG use ublox 9 default settings --- main/gps.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/gps.go b/main/gps.go index dae44279..4d3552a9 100755 --- a/main/gps.go +++ b/main/gps.go @@ -302,9 +302,9 @@ 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) + 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("UBX8/9/unknown device detected on USB, or GPS serial connection in use. Attempting GLONASS and Galelio configuration.\n") + log.Printf("ublox 8 or unknown device detected on USB, or GPS serial connection in use. Attempting GLONASS and Galelio configuration.\n") } cfgGnss := []byte{0x00, 0x20, 0x20, 0x06} gps := []byte{0x00, 0x08, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01} // enable GPS with 8-16 tracking channels @@ -323,7 +323,7 @@ func initGPSSerial() bool { 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) { // 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 From 5f4dc68fd96f094edc6e6d668f54dcde0d75e444 Mon Sep 17 00:00:00 2001 From: VirusPilot <43483458+VirusPilot@users.noreply.github.com> Date: Thu, 27 Jun 2019 14:38:39 +0200 Subject: [PATCH 8/8] add CFG-NMEA, change NMEA protocol version to 4.1, clean-up config code --- main/gps.go | 81 +++++++++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 52 deletions(-) diff --git a/main/gps.go b/main/gps.go index 4d3552a9..3f3d895a 100755 --- a/main/gps.go +++ b/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_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("ublox 8 or 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 if (globalStatus.GPS_detected_type == GPS_TYPE_UBX7) || (globalStatus.GPS_detected_type == GPS_TYPE_UBX6) { // 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.