kopia lustrzana https://github.com/cyoung/stratux
mySituation tracks min/max G Load.
rodzic
0678955b01
commit
e8273544ae
|
@ -94,6 +94,8 @@ type SituationData struct {
|
|||
AHRSSlipSkid float32
|
||||
AHRSTurnRate float32
|
||||
AHRSGLoad float32
|
||||
AHRSGLoadMin float32
|
||||
AHRSGLoadMax float32
|
||||
AHRSLastAttitudeTime time.Time
|
||||
AHRSStatus uint8
|
||||
}
|
||||
|
|
|
@ -262,6 +262,12 @@ func sensorAttitudeSender() {
|
|||
mySituation.AHRSSlipSkid = float32(s.SlipSkid())
|
||||
mySituation.AHRSTurnRate = float32(s.RateOfTurn())
|
||||
mySituation.AHRSGLoad = float32(s.GLoad())
|
||||
if mySituation.AHRSGLoad < mySituation.AHRSGLoadMin || mySituation.AHRSGLoadMin == 0 {
|
||||
mySituation.AHRSGLoadMin = mySituation.AHRSGLoad
|
||||
}
|
||||
if mySituation.AHRSGLoad > mySituation.AHRSGLoadMax {
|
||||
mySituation.AHRSGLoadMax = mySituation.AHRSGLoad
|
||||
}
|
||||
|
||||
mySituation.AHRSLastAttitudeTime = t
|
||||
} else {
|
||||
|
@ -273,6 +279,8 @@ func sensorAttitudeSender() {
|
|||
mySituation.AHRSSlipSkid = invalid
|
||||
mySituation.AHRSTurnRate = invalid
|
||||
mySituation.AHRSGLoad = invalid
|
||||
mySituation.AHRSGLoadMin = invalid
|
||||
mySituation.AHRSGLoadMax = 0
|
||||
mySituation.AHRSLastAttitudeTime = time.Time{}
|
||||
}
|
||||
mySituation.muAttitude.Unlock()
|
||||
|
@ -367,6 +375,12 @@ func CageAHRS() {
|
|||
cage <- true
|
||||
}
|
||||
|
||||
// ResetAHRSGLoad resets the min and max to the current G load value.
|
||||
func ResetAHRSGLoad() {
|
||||
mySituation.AHRSGLoadMax = mySituation.AHRSGLoad
|
||||
mySituation.AHRSGLoadMin = mySituation.AHRSGLoad
|
||||
}
|
||||
|
||||
func updateAHRSStatus() {
|
||||
var (
|
||||
msg uint8
|
||||
|
|
Ładowanie…
Reference in New Issue