1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

Compensate 10x altitude resolution before transferring via MSP

GPS_RESCUE and subsequent changes increased gpsSol.llh.alt from 0.1m per lsb UNIT16 to 0.01m per lsb INT32.
The transfer of altitude data via MSP had to be corrected by factor 10 rescalings to be backwards compatible.
This commit is contained in:
AirBreak69 2018-06-14 01:31:24 +02:00 committed by GitHub
parent 719d50e8fb
commit ecc89d1ba1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1033,7 +1033,7 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
sbufWriteU8(dst, gpsSol.numSat);
sbufWriteU32(dst, gpsSol.llh.lat);
sbufWriteU32(dst, gpsSol.llh.lon);
sbufWriteU16(dst, MIN(gpsSol.llh.alt,65535));
sbufWriteU16(dst, MIN(gpsSol.llh.alt / 10, 65535));
sbufWriteU16(dst, gpsSol.groundSpeed);
sbufWriteU16(dst, gpsSol.groundCourse);
sbufWriteU32(dst, gpsSol.llh.alt);
@ -1900,7 +1900,7 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
gpsSol.numSat = sbufReadU8(src);
gpsSol.llh.lat = sbufReadU32(src);
gpsSol.llh.lon = sbufReadU32(src);
gpsSol.llh.alt = sbufReadU16(src);
gpsSol.llh.alt = sbufReadU16(src) * 10;
gpsSol.groundSpeed = sbufReadU16(src);
if (sbufBytesRemaining(src) >= 4) {
gpsSol.llh.alt = sbufReadU32(src);