kopia lustrzana https://github.com/cyoung/stratux
Change calcGPSValidity() to isGPSGroundTrackValid(). Replace existing isGPSGroundTrackValid() function.
rodzic
9839e88e71
commit
c0a79700b8
10
main/gps.go
10
main/gps.go
|
@ -1994,7 +1994,7 @@ If false, 'GPSFixQuality` is set to 0 ("No fix"), as is the number of satellites
|
|||
|
||||
func isGPSValid() bool {
|
||||
isValid := false
|
||||
if (stratuxClock.Since(mySituation.GPSLastFixLocalTime) < 15*time.Second) && globalStatus.GPS_connected && mySituation.GPSFixQuality > 0 {
|
||||
if (stratuxClock.Since(mySituation.GPSLastFixLocalTime) < 3*time.Second) && globalStatus.GPS_connected && mySituation.GPSFixQuality > 0 {
|
||||
isValid = true
|
||||
} else {
|
||||
mySituation.GPSFixQuality = 0
|
||||
|
@ -2006,8 +2006,14 @@ func isGPSValid() bool {
|
|||
return isValid
|
||||
}
|
||||
|
||||
/*
|
||||
isGPSGroundTrackValid returns true only if a valid ground track was obtained in the last 3 seconds,
|
||||
and if NACp >= 9.
|
||||
*/
|
||||
|
||||
func isGPSGroundTrackValid() bool {
|
||||
return stratuxClock.Since(mySituation.GPSLastGroundTrackTime) < 15*time.Second
|
||||
return isGPSValid() &&
|
||||
(mySituation.GPSHorizontalAccuracy >= 30)
|
||||
}
|
||||
|
||||
func isGPSClockValid() bool {
|
||||
|
|
|
@ -236,7 +236,7 @@ func sensorAttitudeSender() {
|
|||
}
|
||||
|
||||
m.TW = float64(mySituation.GPSLastGroundTrackTime.UnixNano()/1000) / 1e6
|
||||
m.WValid = calcGPSValidity()
|
||||
m.WValid = isGPSGroundTrackValid()
|
||||
if m.WValid {
|
||||
m.W1 = mySituation.GPSGroundSpeed * math.Sin(float64(mySituation.GPSTrueCourse)*ahrs.Deg)
|
||||
m.W2 = mySituation.GPSGroundSpeed * math.Cos(float64(mySituation.GPSTrueCourse)*ahrs.Deg)
|
||||
|
@ -329,11 +329,6 @@ func updateExtraLogging() {
|
|||
logMap["BaroVerticalSpeed"] = float64(mySituation.BaroVerticalSpeed)
|
||||
}
|
||||
|
||||
func calcGPSValidity() bool {
|
||||
return (stratuxClock.Time.Sub(mySituation.GPSLastGroundTrackTime) < 3000*time.Millisecond) &&
|
||||
(mySituation.GPSNACp >= 9)
|
||||
}
|
||||
|
||||
func makeSensorRotationMatrix(g [3]float64) (rotmat *[3][3]float64) {
|
||||
f := globalSettings.IMUMapping
|
||||
if globalSettings.IMUMapping[0] == 0 { // if unset, default to some standard orientation
|
||||
|
@ -419,8 +414,8 @@ func updateAHRSStatus() {
|
|||
<-ticker.C
|
||||
msg = 0
|
||||
|
||||
// GPS valid
|
||||
if calcGPSValidity() {
|
||||
// GPS ground track valid?
|
||||
if isGPSGroundTrackValid() {
|
||||
msg++
|
||||
}
|
||||
// IMU is being used
|
||||
|
|
Ładowanie…
Reference in New Issue