Skip to content

Commit

Permalink
Merge pull request #641 from cyoung/ahrs_dev
Browse files Browse the repository at this point in the history
AHRS for v1.4r1.
  • Loading branch information
cyoung committed Jul 17, 2017
2 parents 68ceffd + 0d83394 commit 67058e7
Show file tree
Hide file tree
Showing 68 changed files with 3,795 additions and 5,534 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dump978/uat2json
dump978/uat2text
gen_gdl90
libdump978.so
fancontrol

*.mp4

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "dump1090"]
path = dump1090
url = https://github.com/AvSquirrel/dump1090
[submodule "goflying"]
path = goflying
url = https://github.com/westphae/goflying
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ all:
make xdump978 xdump1090 xgen_gdl90 $(PLATFORMDEPENDENT)

xgen_gdl90:
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 main/cputemp.go
go get -t -d -v ./main ./test ./godump978 ./uatparse ./sensors
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 main/sensors.go main/cputemp.go

fancontrol:
go get -t -d -v ./main
Expand Down
3 changes: 3 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ deployment:
branch: master
commands:
- yes | ssh -i ~/.ssh/id_updates.stratux.me stratux-updates@updates.stratux.me "touch queue/`git log -n 1 --pretty=%H`"
branch: ahrs_dev
commands:
- yes | ssh -i ~/.ssh/id_updates.stratux.me stratux-updates@updates.stratux.me "touch queue/`git log -n 1 --pretty=%H`"
1 change: 1 addition & 0 deletions goflying
Submodule goflying added at a9f328
32 changes: 24 additions & 8 deletions main/equations.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ func degreesHdg(angle float64) float64 {
return angle * 180.0 / math.Pi
}

// roundToInt16 cheaply rounds a float64 to an int16, rather than truncating
func roundToInt16(in float64) (out int16) {
if in >= 0 {
out = int16(in + 0.5)
} else {
out = int16(in - 0.5)
}
return
}

/*
Distance functions based on rectangular coordinate systems
Simple calculations and "good enough" on small scale (± 1° of lat / lon)
Expand Down Expand Up @@ -323,17 +333,23 @@ func distance(lat1, lon1, lat2, lon2 float64) (dist, bearing float64) {
return
}

// CalcAltitude determines the pressure altitude (feet) from the atmospheric pressure (hPa)
func CalcAltitude(press float64) (altitude float64) {
altitude = 145366.45 * (1.0 - math.Pow(press/1013.25, 0.190284))
return
}

// golang only defines min/max for float64. Really.
func iMin(x, y int) int {
if x < y {
return x
}
return y
if x < y {
return x
}
return y
}

func iMax(x, y int) int {
if x > y {
return x
}
return y
if x > y {
return x
}
return y
}

0 comments on commit 67058e7

Please sign in to comment.