Skip to content

Commit

Permalink
[modules] air_data: cut at zero instead of fabs
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Oct 12, 2014
1 parent e8a641b commit c2a8c12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sw/airborne/modules/air_data/air_data.c
Expand Up @@ -109,7 +109,8 @@ static void pressure_diff_cb(uint8_t __attribute__((unused)) sender_id, const fl
{
air_data.differential = *pressure;
if (air_data.calc_airspeed) {
air_data.airspeed = sqrtf(fabs(air_data.differential) * air_data.airspeed_scale);
/* lower bound of differential pressure at zero, no flying backwards guys */
air_data.airspeed = sqrtf(Max(air_data.differential, 0) * air_data.airspeed_scale);
stateSetAirspeed_f(&air_data.airspeed);
}
}
Expand Down

0 comments on commit c2a8c12

Please sign in to comment.