kopia lustrzana https://github.com/cyoung/stratux
Add udev rules. Change start-up sequence (fixes race condition -- receiving UAT packets before init is complete).
rodzic
7142edb3ba
commit
2dca39c7d8
|
@ -12,6 +12,10 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a6", SYMLINK+="
|
|||
#SUBSYSTEMS=="usb", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", SYMLINK+="vk172"
|
||||
#SUBSYSTEMS=="usb", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a6", SYMLINK+="vk162"
|
||||
|
||||
# Stratux uatradio.
|
||||
# 0424:9514 (LaunchPad)
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0424", ATTRS{idProduct}=="9514", SYMLINK+="uatradio"
|
||||
|
||||
|
||||
|
||||
# pl2303 devices are indistinguishable using idVendor and idProduct.
|
||||
|
|
|
@ -1533,7 +1533,6 @@ func main() {
|
|||
crcInit() // Initialize CRC16 table.
|
||||
|
||||
sdrInit()
|
||||
initUATRadioSerial()
|
||||
pingInit()
|
||||
initTraffic()
|
||||
|
||||
|
@ -1574,6 +1573,10 @@ func main() {
|
|||
globalStatus.CPUTemp = cpuTemp
|
||||
})
|
||||
|
||||
// Start reading from serial UAT radio.
|
||||
//FIXME: Follow 978 SDR option, or make a new one.
|
||||
initUATRadioSerial()
|
||||
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
|
||||
if *replayFlag == true {
|
||||
|
|
|
@ -3,8 +3,10 @@ package main
|
|||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/uavionix/serial"
|
||||
"log"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
@ -25,7 +27,7 @@ func initUATRadioSerial() error {
|
|||
// Init for FEC routines.
|
||||
C.init_fec()
|
||||
// Initialize port at 2Mbaud.
|
||||
radioSerialConfig = &serial.Config{Name: "/dev/ttyACM0", Baud: 2000000}
|
||||
radioSerialConfig = &serial.Config{Name: "/dev/uatradio", Baud: 2000000}
|
||||
p, err := serial.OpenPort(radioSerialConfig)
|
||||
if err != nil {
|
||||
log.Printf("serial port err: %s\n", err.Error())
|
||||
|
@ -100,7 +102,7 @@ func processRadioMessage(msg []byte) {
|
|||
//rssiDump978 := int16(1000 * (10 ^ (float64(rssiAdjusted) / 20)))
|
||||
rssiDump978 := rssiRaw
|
||||
|
||||
_ := uint32(msg[1]) + (uint32(msg[2]) << 8) + (uint32(msg[3]) << 16) + (uint32(msg[4]) << 24) // Timestamp. Currently unused.
|
||||
//_ := uint32(msg[1]) + (uint32(msg[2]) << 8) + (uint32(msg[3]) << 16) + (uint32(msg[4]) << 24) // Timestamp. Currently unused.
|
||||
|
||||
msg = msg[5:]
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue