Fixes #3047:
* negative altitude on top bar was displayed wrong (same bug affected vertical speed) * add ability to select an altitude sensor with ft unit for top bar * display actual sensor unit for top bar altitude
This commit is contained in:
@@ -164,12 +164,8 @@ enum SensorFields {
|
||||
|
||||
bool isSensorUnit(int sensor, uint8_t unit)
|
||||
{
|
||||
if (sensor == 0)
|
||||
return true;
|
||||
|
||||
sensor -= 1;
|
||||
|
||||
return g_model.telemetrySensors[sensor].unit == unit;
|
||||
if (sensor <= 0 || sensor > MAX_SENSORS ) return true;
|
||||
return g_model.telemetrySensors[--sensor].unit == unit;
|
||||
}
|
||||
|
||||
bool isCellsSensor(int sensor)
|
||||
@@ -184,7 +180,7 @@ bool isGPSSensor(int sensor)
|
||||
|
||||
bool isAltSensor(int sensor)
|
||||
{
|
||||
return isSensorUnit(sensor, UNIT_DIST);
|
||||
return isSensorUnit(sensor, UNIT_DIST) || isSensorUnit(sensor, UNIT_FEET);
|
||||
}
|
||||
|
||||
bool isVoltsSensor(int sensor)
|
||||
|
||||
@@ -254,7 +254,7 @@ void displayTopBar()
|
||||
if (altitudeItem.isAvailable()) {
|
||||
LCD_ICON(altitude_icon_x, BAR_Y, ICON_ALTITUDE);
|
||||
int32_t value = altitudeItem.value / g_model.telemetrySensors[item].getPrecDivisor();
|
||||
putsValueWithUnit(altitude_icon_x+2*FW-1, BAR_Y+1, value, UNIT_METERS, LEFT);
|
||||
putsValueWithUnit(altitude_icon_x+2*FW-1, BAR_Y+1, value, g_model.telemetrySensors[item].unit, LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user