diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index cb11ac290..e7c7c2ff6 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -1316,11 +1316,16 @@ func defaultSettings() { {Conn: nil, Ip: "", Port: 49002, Capability: NETWORK_POSITION_FFSIM | NETWORK_AHRS_FFSIM}, } globalSettings.BleOutputs = []bleConnection{ - { + { // SoftRF style service Capability: NETWORK_FLARM_NMEA, - UUIDService: "FFE0", // SoftRF style service, + UUIDService: "FFE0", UUIDGatt: "FFE1", }, + { // "standard" nRF UART/Serial emulation + Capability: NETWORK_FLARM_NMEA, + UUIDService: "6E400001-B5A3-F393-E0A9-E50E24DCCA9E", + UUIDGatt: "6E400003-B5A3-F393-E0A9-E50E24DCCA9E", + }, } globalSettings.DEBUG = false globalSettings.DisplayTrafficSource = false diff --git a/main/gps.go b/main/gps.go index 29f3781ca..624f56e90 100644 --- a/main/gps.go +++ b/main/gps.go @@ -308,13 +308,13 @@ func initGPSSerial() bool { device = "/dev/softrf_dongle" globalStatus.GPS_detected_type = GPS_TYPE_SOFTRF_DONGLE baudrates[0] = 115200 - } else if _, err := os.Stat("/dev/ttyS0"); err == nil { + } else if _, err := os.Stat("/dev/serial0"); err == nil { // ttyS0 is PL011 UART (GPIO pins 8 and 10) on all RPi. // assume that any GPS connected to serial GPIO is ublox - device = "/dev/ttyS0" + device = "/dev/serial0" globalStatus.GPS_detected_type = GPS_TYPE_UBX_GEN baudrates = []int{115200, 38400, 9600} - logInf("GPS - device detected at serial port /dev/ttyS0, assuming this is an ublox device, configuring as generic ublox:") + logInf("GPS - device detected at serial port /dev/serial0, assuming this is an ublox device, configuring as generic ublox:") logChipConfig("", "generic ublox", device, targetBaudRate, "") logInf("GPS - consider to configure this device manually in /boot/firmware/stratux.conf for optimal performance") } else { diff --git a/main/network.go b/main/network.go index 79f8f0537..142cee143 100644 --- a/main/network.go +++ b/main/network.go @@ -366,7 +366,7 @@ func refreshConnectedClients() { } func parseBleUuid(uuidStr string) (uuid bluetooth.UUID) { - if len(uuid) == 4 { + if len(uuidStr) == 4 { // Assume hex 16 bit var val uint64 val, _ = strconv.ParseUint(uuidStr, 16, 16) @@ -400,7 +400,8 @@ func initBluetooth() { addSingleSystemErrorf("BLE", "BLE Advertising failed to start: %s", err.Error()) } // TODO: not working if we have multiple GATTs in one service - for _, conn := range globalSettings.BleOutputs { + for i := range globalSettings.BleOutputs { + conn := &globalSettings.BleOutputs[i] err := bleAdapter.AddService(&bluetooth.Service{ UUID: parseBleUuid(conn.UUIDService), Characteristics: []bluetooth.CharacteristicConfig { @@ -421,8 +422,8 @@ func initBluetooth() { continue } netMutex.Lock() - clientConnections[conn.GetConnectionKey()] = &conn - go connectionWriter(&conn) + clientConnections[conn.GetConnectionKey()] = conn + go connectionWriter(conn) netMutex.Unlock() } }