1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +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

@ -1005,7 +1005,7 @@ extern "C" {
return simulationMahDrawn;
}
int32_t getEstimatedAltitude() {
int32_t getEstimatedAltitudeCm() {
return simulationAltitude;
}

View file

@ -268,6 +268,10 @@ extern "C" {
return 67;
}
int32_t getEstimatedAltitudeCm(void) {
return 0;
}
bool feature(uint32_t) {return false;}
bool isAirmodeActive(void) {return true;}

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 * 100; // altitude in cm
gpsSol.llh.altCm = 2345 * 100; // altitude in cm / 100 + 1000m offset, so CRSF value should be 3345
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
@ -330,6 +330,10 @@ uint8_t calculateBatteryPercentageRemaining(void) {
return 67;
}
int32_t getEstimatedAltitudeCm(void) {
return gpsSol.llh.altCm; // function returns cm not m.
}
int32_t getMAhDrawn(void){
return testmAhDrawn;
}

View file

@ -180,8 +180,8 @@ uint32_t fixedMillis = 0;
baro_t baro;
uint32_t getEstimatedAltitude() { return 0; }
uint32_t getEstimatedVario() { return 0; }
int32_t getEstimatedAltitudeCm() { return 0; }
int16_t getEstimatedVario() { return 0; }
uint32_t millis(void) {
return fixedMillis;