1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 17:55:28 +03:00

Fix outputted GPS altitude

This commit is contained in:
Sami Korhonen 2016-01-03 12:01:17 +02:00 committed by Konstantin Sharlaimov (DigitalEntity)
parent 80380c6b59
commit 8d980b2a56
6 changed files with 7 additions and 7 deletions

View file

@ -971,7 +971,7 @@ static void writeGPSFrame()
blackboxWriteUnsignedVB(gpsSol.numSat);
blackboxWriteSignedVB(gpsSol.llh.lat - gpsHistory.GPS_home[0]);
blackboxWriteSignedVB(gpsSol.llh.lon - gpsHistory.GPS_home[1]);
blackboxWriteUnsignedVB(gpsSol.llh.alt);
blackboxWriteUnsignedVB(gpsSol.llh.alt/100); // meters
blackboxWriteUnsignedVB(gpsSol.groundSpeed);
blackboxWriteUnsignedVB(gpsSol.groundCourse);

View file

@ -1104,7 +1104,7 @@ static bool processOutCommand(uint8_t cmdMSP)
serialize8(gpsSol.numSat);
serialize32(gpsSol.llh.lat);
serialize32(gpsSol.llh.lon);
serialize16(gpsSol.llh.alt);
serialize16(gpsSol.llh.alt/100); // meters
serialize16(gpsSol.groundSpeed);
serialize16(gpsSol.groundCourse);
break;

View file

@ -181,7 +181,7 @@ static void sendBaro(void)
#ifdef GPS
static void sendGpsAltitude(void)
{
uint16_t altitude = gpsSol.llh.alt;
uint16_t altitude = gpsSol.llh.alt / 100; // meters
//Send real GPS altitude only if it's reliable (there's a GPS fix)
if (!STATE(GPS_FIX)) {
altitude = 0;

View file

@ -201,7 +201,7 @@ void hottPrepareGPSResponse(HOTT_GPS_MSG_t *hottGPSMessage)
hottGPSMessage->home_distance_L = GPS_distanceToHome & 0x00FF;
hottGPSMessage->home_distance_H = GPS_distanceToHome >> 8;
uint16_t hottGpsAltitude = (gpsSol.llh.alt / 10) + HOTT_GPS_ALTITUDE_OFFSET; // 1 / 0.1f == 10, GPS_altitude of 1 == 0.1m
uint16_t hottGpsAltitude = (gpsSol.llh.alt / 100) + HOTT_GPS_ALTITUDE_OFFSET; // meters
hottGPSMessage->altitude_L = hottGpsAltitude & 0x00FF;
hottGPSMessage->altitude_H = hottGpsAltitude >> 8;

View file

@ -148,9 +148,9 @@ static void ltm_gframe(void)
ltm_serialise_8((uint8_t)(gpsSol.groundSpeed / 100));
#if defined(NAV)
ltm_alt = (sensors(SENSOR_SONAR) || sensors(SENSOR_BARO)) ? getEstimatedActualPosition(Z) : gpsSol.llh.alt * 100;
ltm_alt = (sensors(SENSOR_SONAR) || sensors(SENSOR_BARO)) ? getEstimatedActualPosition(Z) : gpsSol.llh.alt; // cm
#else
ltm_alt = gpsSol.llh.alt * 100;
ltm_alt = gpsSol.llh.alt; // cm
#endif
ltm_serialise_32(ltm_alt);
ltm_serialise_8((gpsSol.numSat << 2) | gps_fix_type);

View file

@ -458,7 +458,7 @@ void handleSmartPortTelemetry(void)
#ifdef GPS
case FSSP_DATAID_GPS_ALT :
if (sensors(SENSOR_GPS) && STATE(GPS_FIX)) {
smartPortSendPackage(id, gpsSol.llh.alt * 100); // given in 0.1m , requested in 10 = 1m (should be in mm, probably a bug in opentx, tested on 2.0.1.7)
smartPortSendPackage(id, gpsSol.llh.alt); // cm
smartPortHasRequest = 0;
}
break;