1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 01:05:27 +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; static int32_t baroAlt_offset = 0;
float sonarTransition; float sonarTransition;
#ifdef SONAR
int16_t tiltAngle; int16_t tiltAngle;
#endif
dTime = currentTime - previousTime; dTime = currentTime - previousTime;
@ -442,8 +445,10 @@ void calculateEstimatedAltitude(uint32_t currentTime)
BaroAlt = baroCalculateAltitude(); BaroAlt = baroCalculateAltitude();
#ifdef SONAR
tiltAngle = calculateTiltAngle(&inclination); tiltAngle = calculateTiltAngle(&inclination);
sonarAlt = sonarCalculateAltitude(sonarAlt, tiltAngle); sonarAlt = sonarCalculateAltitude(sonarAlt, tiltAngle);
#endif
if (sonarAlt > 0 && sonarAlt < 200) { if (sonarAlt > 0 && sonarAlt < 200) {
baroAlt_offset = BaroAlt - sonarAlt; baroAlt_offset = BaroAlt - sonarAlt;