AP_OSD: added temperature item

This commit is contained in:
vierfuffzig 2018-07-14 20:08:06 +02:00 committed by Andrew Tridgell
parent 0da7a7cbda
commit b6bdcf594a
2 changed files with 14 additions and 0 deletions

View File

@ -100,6 +100,7 @@ private:
AP_OSD_Setting gps_longitude{true, 9, 14};
AP_OSD_Setting roll_angle{false, 0, 0};
AP_OSD_Setting pitch_angle{false, 0, 0};
AP_OSD_Setting temp{false, 0, 0};
bool check_option(uint32_t option);
@ -148,6 +149,7 @@ private:
void draw_gps_longitude(uint8_t x, uint8_t y);
void draw_roll_angle(uint8_t x, uint8_t y);
void draw_pitch_angle(uint8_t x, uint8_t y);
void draw_temp(uint8_t x, uint8_t y);
};
class AP_OSD {

View File

@ -153,6 +153,10 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @Path: AP_OSD_Setting.cpp
AP_SUBGROUPINFO(pitch_angle, "PITCH", 27, AP_OSD_Screen, AP_OSD_Setting),
// @Group: TEMP
// @Path: AP_OSD_Setting.cpp
AP_SUBGROUPINFO(temp, "TEMP", 28, AP_OSD_Screen, AP_OSD_Setting),
AP_GROUPEND
};
@ -771,6 +775,13 @@ void AP_OSD_Screen::draw_pitch_angle(uint8_t x, uint8_t y)
backend->write(x, y, false, "%c%3d%c", p, pitch, SYM_DEGR);
}
void AP_OSD_Screen::draw_temp(uint8_t x, uint8_t y)
{
AP_Baro &barometer = AP::baro();
float tmp = barometer.get_temperature();
backend->write(x, y, false, "%3d%c", (int)u_scale(TEMPERATURE, tmp), u_icon(TEMPERATURE));
}
#define DRAW_SETTING(n) if (n.enabled) draw_ ## n(n.xpos, n.ypos)
void AP_OSD_Screen::draw(void)
@ -801,6 +812,7 @@ void AP_OSD_Screen::draw(void)
DRAW_SETTING(home);
DRAW_SETTING(roll_angle);
DRAW_SETTING(pitch_angle);
DRAW_SETTING(temp);
#ifdef HAVE_AP_BLHELI_SUPPORT
DRAW_SETTING(blh_temp);