- if (time_change > 0)
- baro_speed = (prev_state.baro_speed * 3 + (height_change / time_change)) / 4.0;
- else
- baro_speed = prev_state.baro_speed;
+ if (data.speed != AltosRecord.MISSING)
+ baro_speed = data.speed;
+ else {
+ if (time_change > 0)
+ baro_speed = (prev_state.baro_speed * 3 + (height_change / time_change)) / 4.0;
+ else
+ baro_speed = prev_state.baro_speed;
+ }