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:
parent
1d48fdafc9
commit
e56535f4f3
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue