Browse Source

Plane: use new airspeed calibration code

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
mission-4.1.18
Andrew Tridgell 12 years ago
parent
commit
882aa68c16
  1. 16
      ArduPlane/ArduPlane.pde

16
ArduPlane/ArduPlane.pde

@ -464,6 +464,7 @@ static struct { @@ -464,6 +464,7 @@ static struct {
// Airspeed Sensors
////////////////////////////////////////////////////////////////////////////////
AP_Airspeed airspeed;
Airspeed_Calibration airspeed_calibration;
////////////////////////////////////////////////////////////////////////////////
// ACRO controller state
@ -708,6 +709,7 @@ static const AP_Scheduler::Task scheduler_tasks[] PROGMEM = { @@ -708,6 +709,7 @@ static const AP_Scheduler::Task scheduler_tasks[] PROGMEM = {
{ compass_accumulate, 1, 1500 },
{ barometer_accumulate, 1, 900 },
{ one_second_loop, 50, 3900 },
{ airspeed_ratio_update, 50, 1000 },
{ update_logging, 5, 1000 },
{ read_receiver_rssi, 5, 1000 },
{ check_long_failsafe, 15, 1000 },
@ -960,6 +962,20 @@ static void one_second_loop() @@ -960,6 +962,20 @@ static void one_second_loop()
}
}
/*
once a second update the airspeed calibration ratio
*/
static void airspeed_ratio_update(void)
{
if (!airspeed.enabled() ||
g_gps->status() < GPS::GPS_OK_FIX_3D ||
g_gps->ground_speed_cm < 400) {
return;
}
airspeed.update_calibration(g_gps->velocity_vector(), barometer.get_EAS2TAS());
}
/*
read the GPS and update position
*/

Loading…
Cancel
Save