1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Fix builds on targets that do not have sonar support.

This commit is contained in:
Dominic Clifton 2014-07-22 21:25:03 +01:00
parent 1d48fdafc9
commit e56535f4f3

View file

@ -425,7 +425,10 @@ void calculateEstimatedAltitude(uint32_t currentTime)
static int32_t baroAlt_offset = 0;
float sonarTransition;
#ifdef SONAR
int16_t tiltAngle;
#endif
dTime = currentTime - previousTime;
@ -442,8 +445,10 @@ void calculateEstimatedAltitude(uint32_t currentTime)
BaroAlt = baroCalculateAltitude();
#ifdef SONAR
tiltAngle = calculateTiltAngle(&inclination);
sonarAlt = sonarCalculateAltitude(sonarAlt, tiltAngle);
#endif
if (sonarAlt > 0 && sonarAlt < 200) {
baroAlt_offset = BaroAlt - sonarAlt;