Browse Source

AP_Airspeed: added HIL support

master
Andrew Tridgell 11 years ago
parent
commit
a4cd9c4bd7
  1. 4
      libraries/AP_Airspeed/AP_Airspeed.cpp
  2. 7
      libraries/AP_Airspeed/AP_Airspeed.h

4
libraries/AP_Airspeed/AP_Airspeed.cpp

@ -143,6 +143,10 @@ float AP_Airspeed::get_pressure(void) @@ -143,6 +143,10 @@ float AP_Airspeed::get_pressure(void)
if (!_enable) {
return 0;
}
if (_hil_set) {
_healthy = true;
return _hil_pressure;
}
float pressure = 0;
if (_pin == AP_AIRSPEED_I2C_PIN) {
_healthy = digital.get_differential_pressure(pressure);

7
libraries/AP_Airspeed/AP_Airspeed.h

@ -46,6 +46,7 @@ public: @@ -46,6 +46,7 @@ public:
_last_pressure(0.0f),
_EAS2TAS(1.0f),
_healthy(false),
_hil_set(false),
_last_update_ms(0),
_calibration(parms),
_last_saved_ratio(0.0f),
@ -137,6 +138,8 @@ public: @@ -137,6 +138,8 @@ public:
// return health status of sensor
bool healthy(void) const { return _healthy; }
void setHIL(float pressure) { _hil_set=true; _hil_pressure=pressure; };
// return time in ms of last update
uint32_t last_update_ms(void) const { return _last_update_ms; }
@ -160,7 +163,9 @@ private: @@ -160,7 +163,9 @@ private:
float _airspeed;
float _last_pressure;
float _EAS2TAS;
bool _healthy;
bool _healthy:1;
bool _hil_set:1;
float _hil_pressure;
uint32_t _last_update_ms;
Airspeed_Calibration _calibration;

Loading…
Cancel
Save