diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index baeba0ef..0b646e63 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -1139,9 +1139,8 @@ type status struct { UAT_OTHER_total uint32 Errors []string Logfile_Size int64 - - BMPConnected bool - IMUConnected bool + BMPConnected bool + IMUConnected bool } var globalSettings settings diff --git a/main/sensors.go b/main/sensors.go index 924bae52..f2676654 100644 --- a/main/sensors.go +++ b/main/sensors.go @@ -15,7 +15,10 @@ import ( "github.com/westphae/goflying/ahrsweb" ) -const numRetries uint8 = 5 +const ( + numRetries uint8 = 5 + invalid float32 = float32(ahrs.Invalid) +) var ( i2cbus embd.I2CBus @@ -117,6 +120,8 @@ func tempAndPressureSender() { mySituation.muBaro.Unlock() altLast = altitude } + mySituation.BaroPressureAltitude = 99999 + mySituation.BaroVerticalSpeed = 99999 } func initIMU() (ok bool) { @@ -245,29 +250,36 @@ func sensorAttitudeSender() { // Run the AHRS calcs s.Compute(m) - makeAHRSGDL90Report() // Send whether or not valid - the function will invalidate the values as appropriate - // If we have valid AHRS info, then update mySituation + mySituation.muAttitude.Lock() if s.Valid() { - mySituation.muAttitude.Lock() - roll, pitch, heading = s.RollPitchHeading() mySituation.AHRSRoll = float32(roll / ahrs.Deg) mySituation.AHRSPitch = float32(pitch / ahrs.Deg) mySituation.AHRSGyroHeading = float32(heading / ahrs.Deg) - mySituation.AHRSMagHeading = float32(s.MagHeading()) + // TODO westphae: until magnetometer calibration is performed, no mag heading + mySituation.AHRSMagHeading = invalid mySituation.AHRSSlipSkid = float32(s.SlipSkid()) mySituation.AHRSTurnRate = float32(s.RateOfTurn()) mySituation.AHRSGLoad = float32(s.GLoad()) mySituation.AHRSLastAttitudeTime = t - mySituation.muAttitude.Unlock() - - // makeFFAHRSSimReport() // simultaneous use of GDL90 and FFSIM not supported in FF 7.5.1 or later. Function definition will be kept for AHRS debugging and future workarounds. } else { s.Reset() + mySituation.AHRSRoll = invalid + mySituation.AHRSPitch = invalid + mySituation.AHRSGyroHeading = invalid + mySituation.AHRSMagHeading = invalid + mySituation.AHRSSlipSkid = invalid + mySituation.AHRSTurnRate = invalid + mySituation.AHRSGLoad = invalid + mySituation.AHRSLastAttitudeTime = time.Time{} } + mySituation.muAttitude.Unlock() + + makeAHRSGDL90Report() // Send whether or not valid - the function will invalidate the values as appropriate + // makeFFAHRSSimReport() // Simultaneous use of GDL90 and FFSIM not supported in FF 7.5.1 or later. Function definition will be kept for AHRS debugging and future workarounds. // Send to AHRS debugging server: if ahrswebListener != nil { diff --git a/web/plates/gps.html b/web/plates/gps.html index 5315db07..e649480a 100644 --- a/web/plates/gps.html +++ b/web/plates/gps.html @@ -52,7 +52,7 @@