baro_ets: call EstimatorSetAlt only when offset already initialized

This commit is contained in:
Felix Ruess
2011-01-12 16:11:52 +01:00
parent 8a0f94c422
commit 685d0a25bd
+5 -4
View File
@@ -134,12 +134,13 @@ void baro_ets_read_event( void ) {
baro_ets_offset_tmp += baro_ets_adc;
}
// Convert raw to m/s
if (baro_ets_offset_init)
if (baro_ets_offset_init) {
baro_ets_altitude = ground_alt + BARO_ETS_SCALE * (float)(baro_ets_offset-baro_ets_adc);
else
// New value available
EstimatorSetAlt(baro_ets_altitude);
} else {
baro_ets_altitude = 0.0;
// New value available
EstimatorSetAlt(baro_ets_altitude);
}
} else {
baro_ets_altitude = 0.0;
}