AP_Airspeed: add inflight airspeed cal rc switch
This commit is contained in:
parent
8c2688605e
commit
615b8add8c
@ -48,6 +48,11 @@ public:
|
||||
|
||||
void init(void);
|
||||
|
||||
#if AP_AIRSPEED_AUTOCAL_ENABLE
|
||||
// inflight ratio calibration
|
||||
void set_calibration_enabled(bool enable) {calibration_enabled = enable;}
|
||||
#endif //AP_AIRSPEED_AUTOCAL_ENABLE
|
||||
|
||||
// read the analog source and update airspeed
|
||||
void update(bool log);
|
||||
|
||||
@ -230,6 +235,8 @@ private:
|
||||
} failures;
|
||||
} state[AIRSPEED_MAX_SENSORS];
|
||||
|
||||
bool calibration_enabled = false;
|
||||
|
||||
// current primary sensor
|
||||
uint8_t primary;
|
||||
uint8_t num_sensors;
|
||||
|
@ -115,7 +115,7 @@ float Airspeed_Calibration::update(float airspeed, const Vector3f &vg, int16_t m
|
||||
void AP_Airspeed::update_calibration(uint8_t i, const Vector3f &vground, int16_t max_airspeed_allowed_during_cal)
|
||||
{
|
||||
#if AP_AIRSPEED_AUTOCAL_ENABLE
|
||||
if (!param[i].autocal) {
|
||||
if (!param[i].autocal && !calibration_enabled) {
|
||||
// auto-calibration not enabled
|
||||
return;
|
||||
}
|
||||
@ -146,6 +146,7 @@ void AP_Airspeed::update_calibration(uint8_t i, const Vector3f &vground, int16_t
|
||||
param[i].ratio.save();
|
||||
state[i].last_saved_ratio = param[i].ratio;
|
||||
state[i].counter = 0;
|
||||
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Airspeed %u ratio reset: %f", i , static_cast<double> (param[i].ratio));
|
||||
}
|
||||
} else {
|
||||
state[i].counter++;
|
||||
|
Loading…
Reference in New Issue
Block a user