kopia lustrzana https://github.com/cyoung/stratux
Add goflying submodule. Change imports.
rodzic
cab2a81c26
commit
3db11bd09d
|
@ -1,3 +1,6 @@
|
||||||
[submodule "dump1090"]
|
[submodule "dump1090"]
|
||||||
path = dump1090
|
path = dump1090
|
||||||
url = https://github.com/AvSquirrel/dump1090
|
url = https://github.com/AvSquirrel/dump1090
|
||||||
|
[submodule "goflying"]
|
||||||
|
path = goflying
|
||||||
|
url = https://github.com/westphae/goflying
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -13,8 +13,6 @@ all:
|
||||||
|
|
||||||
xgen_gdl90:
|
xgen_gdl90:
|
||||||
go get -t -d -v ./main ./test ./godump978 ./uatparse ./sensors
|
go get -t -d -v ./main ./test ./godump978 ./uatparse ./sensors
|
||||||
go get -u github.com/westphae/goflying/ahrs
|
|
||||||
go get -u github.com/westphae/goflying/ahrsweb
|
|
||||||
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
|
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:
|
fancontrol:
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit ba2ef8b155f74b3e7108b98b5ddbc92826b0cec3
|
|
@ -9,15 +9,15 @@ import (
|
||||||
|
|
||||||
"../sensors"
|
"../sensors"
|
||||||
|
|
||||||
|
"../goflying/ahrs"
|
||||||
|
"../goflying/ahrsweb"
|
||||||
"github.com/kidoman/embd"
|
"github.com/kidoman/embd"
|
||||||
_ "github.com/kidoman/embd/host/all"
|
_ "github.com/kidoman/embd/host/all"
|
||||||
"github.com/westphae/goflying/ahrs"
|
|
||||||
"github.com/westphae/goflying/ahrsweb"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
numRetries uint8 = 5
|
numRetries uint8 = 5
|
||||||
invalid float32 = float32(ahrs.Invalid)
|
invalid float32 = float32(ahrs.Invalid)
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -142,15 +142,15 @@ func initIMU() (ok bool) {
|
||||||
|
|
||||||
func sensorAttitudeSender() {
|
func sensorAttitudeSender() {
|
||||||
var (
|
var (
|
||||||
roll, pitch, heading float64
|
roll, pitch, heading float64
|
||||||
t time.Time
|
t time.Time
|
||||||
s ahrs.AHRSProvider
|
s ahrs.AHRSProvider
|
||||||
m *ahrs.Measurement
|
m *ahrs.Measurement
|
||||||
a, b, c, d, mm [3]float64 // IMU measurements: accel, gyro, accel bias, gyro bias, magnetometer
|
a, b, c, d, mm [3]float64 // IMU measurements: accel, gyro, accel bias, gyro bias, magnetometer
|
||||||
ff [3][3]float64 // Sensor orientation matrix
|
ff [3][3]float64 // Sensor orientation matrix
|
||||||
cc float64
|
cc float64
|
||||||
mpuError, magError error
|
mpuError, magError error
|
||||||
failnum uint8
|
failnum uint8
|
||||||
)
|
)
|
||||||
log.Println("AHRS Info: initializing new Simple AHRS")
|
log.Println("AHRS Info: initializing new Simple AHRS")
|
||||||
s = ahrs.InitializeSimple()
|
s = ahrs.InitializeSimple()
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"../goflying/bmp280"
|
||||||
"github.com/kidoman/embd"
|
"github.com/kidoman/embd"
|
||||||
"github.com/westphae/goflying/bmp280"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -5,19 +5,19 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/westphae/goflying/mpu9250"
|
"../goflying/mpu9250"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
gyroRange = 250 // gyroRange is the default range to use for the Gyro.
|
gyroRange = 250 // gyroRange is the default range to use for the Gyro.
|
||||||
accelRange = 4 // accelRange is the default range to use for the Accel.
|
accelRange = 4 // accelRange is the default range to use for the Accel.
|
||||||
updateFreq = 50 // updateFreq is the rate at which to update the sensor values.
|
updateFreq = 50 // updateFreq is the rate at which to update the sensor values.
|
||||||
)
|
)
|
||||||
|
|
||||||
// MPU9250 represents an InvenSense MPU9250 attached to the I2C bus and satisfies
|
// MPU9250 represents an InvenSense MPU9250 attached to the I2C bus and satisfies
|
||||||
// the IMUReader interface.
|
// the IMUReader interface.
|
||||||
type MPU9250 struct {
|
type MPU9250 struct {
|
||||||
mpu *mpu9250.MPU9250
|
mpu *mpu9250.MPU9250
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMPU9250 returns an instance of the MPU9250 IMUReader, connected to an
|
// NewMPU9250 returns an instance of the MPU9250 IMUReader, connected to an
|
||||||
|
@ -52,11 +52,11 @@ func NewMPU9250() (*MPU9250, error) {
|
||||||
func (m *MPU9250) Read() (T int64, G1, G2, G3, A1, A2, A3, M1, M2, M3 float64, GAError, MAGError error) {
|
func (m *MPU9250) Read() (T int64, G1, G2, G3, A1, A2, A3, M1, M2, M3 float64, GAError, MAGError error) {
|
||||||
var (
|
var (
|
||||||
data *mpu9250.MPUData
|
data *mpu9250.MPUData
|
||||||
i int8
|
i int8
|
||||||
)
|
)
|
||||||
data = new(mpu9250.MPUData)
|
data = new(mpu9250.MPUData)
|
||||||
|
|
||||||
for data.N==0 && i < 5 {
|
for data.N == 0 && i < 5 {
|
||||||
data = <-m.mpu.CAvg
|
data = <-m.mpu.CAvg
|
||||||
T = data.T.UnixNano()
|
T = data.T.UnixNano()
|
||||||
G1 = data.G1
|
G1 = data.G1
|
||||||
|
|
Ładowanie…
Reference in New Issue