1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 09:45:37 +03:00

Merge pull request #6513 from mikeller/fix_crsf_altitude

Fixed altitude display with CRSF telemetry.
This commit is contained in:
Michael Keller 2018-08-06 23:01:49 +12:00 committed by GitHub
commit efb340f4c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -182,7 +182,7 @@ void crsfFrameGps(sbuf_t *dst)
sbufWriteU16BigEndian(dst, (gpsSol.groundSpeed * 36 + 5) / 10); // gpsSol.groundSpeed is in 0.1m/s
sbufWriteU16BigEndian(dst, gpsSol.groundCourse * 10); // gpsSol.groundCourse is degrees * 10
//Send real GPS altitude only if it's reliable (there's a GPS fix)
const uint16_t altitude = (STATE(GPS_FIX) ? gpsSol.llh.alt : 0) + 1000;
const uint16_t altitude = (STATE(GPS_FIX) ? gpsSol.llh.alt / 100 : 0) + 1000;
sbufWriteU16BigEndian(dst, altitude);
sbufWriteU8(dst, gpsSol.numSat);
}

View file

@ -124,7 +124,7 @@ TEST(TelemetryCrsfTest, TestGPS)
gpsSol.llh.lat = 56 * GPS_DEGREES_DIVIDER;
gpsSol.llh.lon = 163 * GPS_DEGREES_DIVIDER;
ENABLE_STATE(GPS_FIX);
gpsSol.llh.alt = 2345; // altitude in m
gpsSol.llh.alt = 2345 * 100; // altitude in cm
gpsSol.groundSpeed = 163; // speed in 0.1m/s, 16.3 m/s = 58.68 km/h, so CRSF (km/h *10) value is 587
gpsSol.numSat = 9;
gpsSol.groundCourse = 1479; // degrees * 10