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:
commit
efb340f4c6
2 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue