Use BMP180 for pressure altitude in Ownship report.

pull/13/head
Christopher Young 2015-08-20 17:01:42 -04:00
rodzic dcbcb1bf16
commit c322aac63d
1 zmienionych plików z 17 dodań i 13 usunięć

Wyświetl plik

@ -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