AP_OSD: fix disable value for terrain alt warning

This commit is contained in:
Hwurzburg 2021-04-29 07:58:21 -05:00 committed by Andrew Tridgell
parent 00b44ff6c8
commit defc81443c
2 changed files with 4 additions and 3 deletions

View File

@ -173,8 +173,8 @@ const AP_Param::GroupInfo AP_OSD::var_info[] = {
#if AP_TERRAIN_AVAILABLE
// @Param: _W_TERR
// @DisplayName: Terrain warn level
// @Description: Set level below which TER_HGT item will flash.
// @Range: 1 3000
// @Description: Set level below which TER_HGT item will flash. -1 disables.
// @Range: -1 3000
// @Units: m
// @User: Standard
AP_GROUPINFO("_W_TERR", 23, AP_OSD, warn_terr, -1),

View File

@ -1941,7 +1941,8 @@ void AP_OSD_Screen::draw_hgt_abvterr(uint8_t x, uint8_t y)
float terrain_altitude;
if (terrain != nullptr && terrain->height_above_terrain(terrain_altitude,true)) {
backend->write(x, y, terrain_altitude < osd->warn_terr, "%4d%c%c", (int)u_scale(ALTITUDE, terrain_altitude), u_icon(ALTITUDE), SYM_TERALT);
bool blink = (osd->warn_terr != -1)? (terrain_altitude < osd->warn_terr) : false; //blink if warn_terr is not disabled and alt above terrain is below warning value
backend->write(x, y, blink, "%4d%c%c", (int)u_scale(ALTITUDE, terrain_altitude), u_icon(ALTITUDE), SYM_TERALT);
} else {
backend->write(x, y, false, " ---%c%c", u_icon(ALTITUDE),SYM_TERALT);
}