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
|
AHRSSlipSkid float32
|
||||||
AHRSTurnRate float32
|
AHRSTurnRate float32
|
||||||
AHRSGLoad float32
|
AHRSGLoad float32
|
||||||
|
AHRSGLoadMin float32
|
||||||
|
AHRSGLoadMax float32
|
||||||
AHRSLastAttitudeTime time.Time
|
AHRSLastAttitudeTime time.Time
|
||||||
AHRSStatus uint8
|
AHRSStatus uint8
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,6 +262,12 @@ func sensorAttitudeSender() {
|
||||||
mySituation.AHRSSlipSkid = float32(s.SlipSkid())
|
mySituation.AHRSSlipSkid = float32(s.SlipSkid())
|
||||||
mySituation.AHRSTurnRate = float32(s.RateOfTurn())
|
mySituation.AHRSTurnRate = float32(s.RateOfTurn())
|
||||||
mySituation.AHRSGLoad = float32(s.GLoad())
|
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
|
mySituation.AHRSLastAttitudeTime = t
|
||||||
} else {
|
} else {
|
||||||
|
@ -273,6 +279,8 @@ func sensorAttitudeSender() {
|
||||||
mySituation.AHRSSlipSkid = invalid
|
mySituation.AHRSSlipSkid = invalid
|
||||||
mySituation.AHRSTurnRate = invalid
|
mySituation.AHRSTurnRate = invalid
|
||||||
mySituation.AHRSGLoad = invalid
|
mySituation.AHRSGLoad = invalid
|
||||||
|
mySituation.AHRSGLoadMin = invalid
|
||||||
|
mySituation.AHRSGLoadMax = 0
|
||||||
mySituation.AHRSLastAttitudeTime = time.Time{}
|
mySituation.AHRSLastAttitudeTime = time.Time{}
|
||||||
}
|
}
|
||||||
mySituation.muAttitude.Unlock()
|
mySituation.muAttitude.Unlock()
|
||||||
|
@ -367,6 +375,12 @@ func CageAHRS() {
|
||||||
cage <- true
|
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() {
|
func updateAHRSStatus() {
|
||||||
var (
|
var (
|
||||||
msg uint8
|
msg uint8
|
||||||
|
|
Ładowanie…
Reference in New Issue