Skip to content

Commit

Permalink
Merge pull request #544 from cyoung/gpsattitude
Browse files Browse the repository at this point in the history
Promote gpsattitude to master.
  • Loading branch information
cyoung authored Dec 12, 2016
2 parents 18de467 + ef56848 commit 0107b59
Show file tree
Hide file tree
Showing 16 changed files with 583 additions and 410 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "linux-mpu9150"]
path = linux-mpu9150
url = git://github.com/cyoung/linux-mpu9150
[submodule "dump1090"]
path = dump1090
url = https://github.com/AvSquirrel/dump1090
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ endif
all:
make xdump978
make xdump1090
make xlinux-mpu9150
make xgen_gdl90

xgen_gdl90:
go get -t -d -v ./main ./test ./linux-mpu9150/mpu ./godump978 ./mpu6050 ./uatparse
go build $(BUILDINFO) -p 4 main/gen_gdl90.go main/traffic.go main/ry835ai.go main/network.go main/managementinterface.go main/sdr.go main/ping.go main/uibroadcast.go main/monotonic.go main/datalog.go main/equations.go
go get -t -d -v ./main ./test ./godump978 ./uatparse
go build $(BUILDINFO) -p 4 main/gen_gdl90.go main/traffic.go main/gps.go main/network.go main/managementinterface.go main/sdr.go main/ping.go main/uibroadcast.go main/monotonic.go main/datalog.go main/equations.go

xdump1090:
git submodule update --init
Expand All @@ -24,10 +23,6 @@ xdump978:
cd dump978 && make lib
sudo cp -f ./libdump978.so /usr/lib/libdump978.so

xlinux-mpu9150:
git submodule update --init
cd linux-mpu9150 && make -f Makefile-native-shared

.PHONY: test
test:
make -C test
Expand All @@ -53,4 +48,3 @@ clean:
rm -f gen_gdl90 libdump978.so
cd dump1090 && make clean
cd dump978 && make clean
rm -f linux-mpu9150/*.o linux-mpu9150/*.so
1 change: 0 additions & 1 deletion linux-mpu9150
Submodule linux-mpu9150 deleted from 56658f
7 changes: 7 additions & 0 deletions main/datalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ func dataLog() {
makeTable(msg{}, "messages", db)
makeTable(esmsg{}, "es_messages", db)
makeTable(Dump1090TermMessage{}, "dump1090_terminal", db)
makeTable(gpsPerfStats{}, "gps_attitude", db)
makeTable(StratuxStartup{}, "startup", db)
}

Expand Down Expand Up @@ -567,6 +568,12 @@ func logESMsg(m esmsg) {
}
}

func logGPSAttitude(gpsPerf gpsPerfStats) {
if globalSettings.ReplayLog && isDataLogReady() {
dataLogChan <- DataLogRow{tbl: "gps_attitude", data: gpsPerf}
}
}

func logDump1090TermMessage(m Dump1090TermMessage) {
if globalSettings.DEBUG && globalSettings.ReplayLog && isDataLogReady() {
dataLogChan <- DataLogRow{tbl: "dump1090_terminal", data: m}
Expand Down
28 changes: 16 additions & 12 deletions main/gen_gdl90.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ const (

LON_LAT_RESOLUTION = float32(180.0 / 8388608.0)
TRACK_RESOLUTION = float32(360.0 / 256.0)

GPS_TYPE_NMEA = 0x01
GPS_TYPE_UBX = 0x02
GPS_TYPE_SIRF = 0x03
GPS_TYPE_MEDIATEK = 0x04
GPS_TYPE_FLARM = 0x05
GPS_TYPE_GARMIN = 0x06
// other GPS types to be defined as needed

)

var usage *du.DiskUsage
Expand Down Expand Up @@ -271,7 +280,7 @@ func makeOwnshipReport() bool {
msg[12] = msg[12] | 0x09 // "Airborne" + "True Track"
}

msg[13] = byte(0x80 | (mySituation.NACp & 0x0F)) //Set NIC = 8 and use NACp from ry835ai.go.
msg[13] = byte(0x80 | (mySituation.NACp & 0x0F)) //Set NIC = 8 and use NACp from gps.go.

gdSpeed := uint16(0) // 1kt resolution.
if selfOwnshipValid && curOwnship.Speed_valid {
Expand Down Expand Up @@ -459,18 +468,14 @@ func makeStratuxStatus() []byte {
}

// Valid/Enabled: AHRS Enabled portion.
if globalSettings.AHRS_Enabled {
msg[12] = 1 << 0
}
// msg[12] = 1 << 0

// Valid/Enabled: last bit unused.

// Connected hardware: number of radios.
msg[15] = msg[15] | (byte(globalStatus.Devices) & 0x3)
// Connected hardware: RY835AI.
if globalStatus.RY835AI_connected {
msg[15] = msg[15] | (1 << 2)
}
// Connected hardware.
// RY835AI: msg[15] = msg[15] | (1 << 2)

// Number of GPS satellites locked.
msg[16] = byte(globalStatus.GPS_satellites_locked)
Expand Down Expand Up @@ -1022,7 +1027,6 @@ type settings struct {
GPS_Enabled bool
NetworkOutputs []networkConnection
SerialOutputs map[string]serialConnection
AHRS_Enabled bool
DisplayTrafficSource bool
DEBUG bool
ReplayLog bool
Expand Down Expand Up @@ -1052,7 +1056,7 @@ type status struct {
GPS_position_accuracy float32
GPS_connected bool
GPS_solution string
RY835AI_connected bool
GPS_detected_type uint
Uptime int64
UptimeClock time.Time
CPUTemp float32
Expand Down Expand Up @@ -1087,7 +1091,6 @@ func defaultSettings() {
{Conn: nil, Ip: "", Port: 4000, Capability: NETWORK_GDL90_STANDARD | NETWORK_AHRS_GDL90},
// {Conn: nil, Ip: "", Port: 49002, Capability: NETWORK_AHRS_FFSIM},
}
globalSettings.AHRS_Enabled = false
globalSettings.DEBUG = false
globalSettings.DisplayTrafficSource = false
globalSettings.ReplayLog = false //TODO: 'true' for debug builds.
Expand Down Expand Up @@ -1392,7 +1395,8 @@ func main() {
//FIXME: Only do this if data logging is enabled.
initDataLog()

initRY835AI()
// Start the GPS external sensor monitoring.
initGPS()

// Start the heartbeat message loop in the background, once per second.
go heartBeatSender()
Expand Down
Loading

0 comments on commit 0107b59

Please sign in to comment.