AP_Airspeed: added ARSPD_SKIP_CAL parameter
allows airspeed calibration to be skipped for easier startup
This commit is contained in:
parent
fa5bab2682
commit
258542b939
@ -115,6 +115,13 @@ const AP_Param::GroupInfo AP_Airspeed::var_info[] PROGMEM = {
|
||||
// @User: Advanced
|
||||
AP_GROUPINFO("TUBE_ORDER", 6, AP_Airspeed, _tube_order, 2),
|
||||
|
||||
// @Param: SKIP_CAL
|
||||
// @DisplayName: Skip airspeed calibration on startup
|
||||
// @Description: This parameter allows you to skip airspeed offset calibration on startup, instead using the offset from the last calibration. This may be desirable if the offset variance between flights for your sensor is low and you want to avoid having to cover the pitot tube on each boot.
|
||||
// @Values: 0:Disable,1:Enable
|
||||
// @User: Advanced
|
||||
AP_GROUPINFO("SKIP_CAL", 7, AP_Airspeed, _skip_cal, 0),
|
||||
|
||||
AP_GROUPEND
|
||||
};
|
||||
|
||||
@ -170,13 +177,16 @@ bool AP_Airspeed::get_temperature(float &temperature)
|
||||
|
||||
// calibrate the airspeed. This must be called at least once before
|
||||
// the get_airspeed() interface can be used
|
||||
void AP_Airspeed::calibrate()
|
||||
void AP_Airspeed::calibrate(bool in_startup)
|
||||
{
|
||||
float sum = 0;
|
||||
uint8_t count = 0;
|
||||
if (!_enable) {
|
||||
return;
|
||||
}
|
||||
if (in_startup && _skip_cal) {
|
||||
return;
|
||||
}
|
||||
// discard first reading
|
||||
get_pressure();
|
||||
for (uint8_t i = 0; i < 10; i++) {
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
|
||||
// calibrate the airspeed. This must be called on startup if the
|
||||
// altitude/climb_rate/acceleration interfaces are ever used
|
||||
void calibrate();
|
||||
void calibrate(bool in_startup);
|
||||
|
||||
// return the current airspeed in m/s
|
||||
float get_airspeed(void) const {
|
||||
@ -170,6 +170,7 @@ private:
|
||||
AP_Int8 _pin;
|
||||
AP_Int8 _autocal;
|
||||
AP_Int8 _tube_order;
|
||||
AP_Int8 _skip_cal;
|
||||
float _raw_airspeed;
|
||||
float _airspeed;
|
||||
float _last_pressure;
|
||||
|
@ -65,7 +65,7 @@ void setup()
|
||||
AP_Param::set_object_value(&airspeed, airspeed.var_info, "_PIN", 65);
|
||||
|
||||
airspeed.init();
|
||||
airspeed.calibrate();
|
||||
airspeed.calibrate(false);
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
|
Loading…
Reference in New Issue
Block a user