1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 01:05:27 +03:00

GPS altitude: cleanup all occurancies to assume source is in cm per lsb resolution

Harmonized (and partly corrected) all occurancies of gpsSol.llh.alt and getEstimatedAltitude() to handle altiude sourced in cm resolution.
This was introduced by GSP_RESCUE/RTH.
Introduced a naming convention that include the unit into the variable/function names:
gpsSol.llh.alt -> gpsSol.llh.alt_cm
getEstimatedAltitude() -> getEstimatedAltitude_cm()
This commit is contained in:
AirBreak69 2018-06-24 12:52:22 +02:00 committed by mikeller
parent bbdd717505
commit 0e52e21524
23 changed files with 105 additions and 105 deletions

View file

@ -284,9 +284,9 @@ static char osdGetTemperatureSymbolForSelectedUnit(void)
}
#endif
static void osdFormatAltitudeString(char * buff, int altitude)
static void osdFormatAltitudeString(char * buff, int32_t altitudeCm)
{
const int alt = osdGetMetersToSelectedUnit(altitude) / 10;
const int alt = osdGetMetersToSelectedUnit(altitudeCm) / 10;
tfp_sprintf(buff, "%5d %c", alt, osdGetMetersToSelectedUnitSymbol());
buff[5] = buff[4];
@ -564,7 +564,7 @@ static bool osdDrawSingleElement(uint8_t item)
break;
case OSD_ALTITUDE:
osdFormatAltitudeString(buff, getEstimatedAltitude());
osdFormatAltitudeString(buff, getEstimatedAltitudeCm());
break;
case OSD_ITEM_TIMER_1:
@ -1140,7 +1140,7 @@ void osdUpdateAlarms(void)
{
// This is overdone?
int32_t alt = osdGetMetersToSelectedUnit(getEstimatedAltitude()) / 100;
int32_t alt = osdGetMetersToSelectedUnit(getEstimatedAltitudeCm()) / 100;
if (getRssiPercent() < osdConfig()->rssi_alarm) {
SET_BLINK(OSD_RSSI_VALUE);
@ -1273,9 +1273,9 @@ static void osdUpdateStats(void)
stats.min_rssi = value;
}
int altitude = getEstimatedAltitude();
if (stats.max_altitude < altitude) {
stats.max_altitude = altitude;
int32_t altitudeCm = getEstimatedAltitudeCm();
if (stats.max_altitude < altitudeCm) {
stats.max_altitude = altitudeCm;
}
if (stats.max_g_force < osdGForce) {