kopia lustrzana https://github.com/cyoung/stratux
Use BMP180 for pressure altitude in Ownship report.
rodzic
dcbcb1bf16
commit
c322aac63d
12
ry835ai.go
12
ry835ai.go
|
@ -1,12 +1,12 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"sync"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
|
@ -213,7 +213,7 @@ func readBMP180() (float64, float64, error) { // ºCelsius, Meters
|
|||
return temp, altitude, nil
|
||||
}
|
||||
|
||||
func readMPU6050() (float64, float64, error) {//TODO: error checking.
|
||||
func readMPU6050() (float64, float64, error) { //TODO: error checking.
|
||||
pitch, roll := myMPU6050.PitchAndRoll()
|
||||
return pitch, roll, nil
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ func attitudeReaderSender() {
|
|||
}
|
||||
|
||||
// Send, if valid.
|
||||
// if isGPSGroundTrackValid()
|
||||
// if isGPSGroundTrackValid()
|
||||
s := fmt.Sprintf("XATTStratux,%d,%f,%f", mySituation.trueCourse, mySituation.pitch, mySituation.roll)
|
||||
|
||||
sendMsg([]byte(s), NETWORK_AHRS)
|
||||
|
@ -295,6 +295,10 @@ func isAHRSValid() bool {
|
|||
return time.Since(mySituation.lastAttitudeTime).Seconds() < 1 // If attitude information gets to be over 1 second old, declare invalid.
|
||||
}
|
||||
|
||||
func isTempPressValid() bool {
|
||||
return time.Since(mySituation.lastTempPressTime).Seconds < 15
|
||||
}
|
||||
|
||||
func initAHRS() error {
|
||||
if err := initI2C(); err != nil { // I2C bus.
|
||||
return err
|
||||
|
|
Ładowanie…
Reference in New Issue