diff --git a/libraries/AP_OSD/AP_OSD.h b/libraries/AP_OSD/AP_OSD.h index e3f0422953..bd8a24065d 100644 --- a/libraries/AP_OSD/AP_OSD.h +++ b/libraries/AP_OSD/AP_OSD.h @@ -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 { diff --git a/libraries/AP_OSD/AP_OSD_Screen.cpp b/libraries/AP_OSD/AP_OSD_Screen.cpp index 9e56da722d..2d474828f5 100644 --- a/libraries/AP_OSD/AP_OSD_Screen.cpp +++ b/libraries/AP_OSD/AP_OSD_Screen.cpp @@ -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);