Browse Source

AP_Airspeed: added ARSPD_OPTIONS bit for disabling voltage correction

if the MS4525 has its own LDO then we are should disable the
correction
gps-1.3.1
Andrew Tridgell 4 years ago
parent
commit
0bdd8231cf
  1. 2
      libraries/AP_Airspeed/AP_Airspeed.cpp
  2. 1
      libraries/AP_Airspeed/AP_Airspeed.h
  3. 5
      libraries/AP_Airspeed/AP_Airspeed_Backend.h
  4. 6
      libraries/AP_Airspeed/AP_Airspeed_MS4525.cpp

2
libraries/AP_Airspeed/AP_Airspeed.cpp

@ -168,7 +168,7 @@ const AP_Param::GroupInfo AP_Airspeed::var_info[] = { @@ -168,7 +168,7 @@ const AP_Param::GroupInfo AP_Airspeed::var_info[] = {
// @Param: _OPTIONS
// @DisplayName: Airspeed options bitmask
// @Description: Bitmask of options to use with airspeed. Disable and/or re-enable sensor based on the difference between airspeed and ground speed based on ARSPD_WIND_MAX threshold, if set
// @Bitmask: 0:Disable sensor, 1:Re-enable sensor
// @Bitmask: 0:Disable sensor, 1:Re-enable sensor, 2:DisableVoltageCorrection
// @User: Advanced
AP_GROUPINFO("_OPTIONS", 21, AP_Airspeed, _options, OPTIONS_DEFAULT),

1
libraries/AP_Airspeed/AP_Airspeed.h

@ -145,6 +145,7 @@ public: @@ -145,6 +145,7 @@ public:
enum OptionsMask {
ON_FAILURE_AHRS_WIND_MAX_DO_DISABLE = (1<<0), // If set then use airspeed failure check
ON_FAILURE_AHRS_WIND_MAX_RECOVERY_DO_REENABLE = (1<<1), // If set then automatically enable the airspeed sensor use when healthy again.
DISABLE_VOLTAGE_CORRECTION = (1<<2),
};
enum airspeed_type {

5
libraries/AP_Airspeed/AP_Airspeed_Backend.h

@ -55,6 +55,11 @@ protected: @@ -55,6 +55,11 @@ protected:
return instance;
}
// see if voltage correction should be disabled
bool disable_voltage_correction(void) const {
return (frontend._options.get() & AP_Airspeed::OptionsMask::DISABLE_VOLTAGE_CORRECTION) != 0;
}
AP_Airspeed::pitot_tube_order get_tube_order(void) const {
return AP_Airspeed::pitot_tube_order(frontend.param[instance].tube_order.get());
}

6
libraries/AP_Airspeed/AP_Airspeed_MS4525.cpp

@ -193,8 +193,10 @@ void AP_Airspeed_MS4525::_collect() @@ -193,8 +193,10 @@ void AP_Airspeed_MS4525::_collect()
float temp = _get_temperature(dT_raw);
float temp2 = _get_temperature(dT_raw2);
_voltage_correction(press, temp);
_voltage_correction(press2, temp2);
if (!disable_voltage_correction()) {
_voltage_correction(press, temp);
_voltage_correction(press2, temp2);
}
WITH_SEMAPHORE(sem);

Loading…
Cancel
Save