Skip to content

Commit

Permalink
AP_OSD: Add VTX temperature
Browse files Browse the repository at this point in the history
Make VTX temperature visible through OSD.
  • Loading branch information
menschel committed Nov 12, 2024
1 parent 2e6453d commit 51cbadf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
2 changes: 2 additions & 0 deletions libraries/AP_OSD/AP_OSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class AP_OSD_Screen : public AP_OSD_AbstractScreen
AP_OSD_Setting clk;
AP_OSD_Setting callsign;
AP_OSD_Setting vtx_power;
AP_OSD_Setting vtx_temp;
AP_OSD_Setting hgt_abvterr{false, 23, 7};
AP_OSD_Setting fence{false, 14, 9};
AP_OSD_Setting rngf;
Expand Down Expand Up @@ -331,6 +332,7 @@ class AP_OSD_Screen : public AP_OSD_AbstractScreen
void draw_callsign(uint8_t x, uint8_t y);
void draw_current2(uint8_t x, uint8_t y);
void draw_vtx_power(uint8_t x, uint8_t y);
void draw_vtx_temp(uint8_t x, uint8_t y);
void draw_hgt_abvterr(uint8_t x, uint8_t y);
#if AP_FENCE_ENABLED
void draw_fence(uint8_t x, uint8_t y);
Expand Down
42 changes: 35 additions & 7 deletions libraries/AP_OSD/AP_OSD_Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,23 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @Description: Vertical position on screen
// @Range: 0 21
AP_SUBGROUPINFO(vtx_power, "VTX_PWR", 55, AP_OSD_Screen, AP_OSD_Setting),


// @Param: VTX_TEMP_EN
// @DisplayName: VTX_TEMP_EN
// @Description: Displays TEMP Power
// @Values: 0:Disabled,1:Enabled

// @Param: VTX_TEMP_X
// @DisplayName: VTX_TEMP_X
// @Description: Horizontal position on screen
// @Range: 0 59

// @Param: VTX_TEMP_Y
// @DisplayName: VTX_TEMP_Y
// @Description: Vertical position on screen
// @Range: 0 21
AP_SUBGROUPINFO(vtx_temp, "VTX_TEMP", 56, AP_OSD_Screen, AP_OSD_Setting),
#endif // AP_VIDEOTX_ENABLED

#if AP_TERRAIN_AVAILABLE
Expand All @@ -944,7 +961,7 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @DisplayName: TER_HGT_Y
// @Description: Vertical position on screen
// @Range: 0 21
AP_SUBGROUPINFO(hgt_abvterr, "TER_HGT", 56, AP_OSD_Screen, AP_OSD_Setting),
AP_SUBGROUPINFO(hgt_abvterr, "TER_HGT", 57, AP_OSD_Screen, AP_OSD_Setting),
#endif

// @Param: AVGCELLV_EN
Expand All @@ -961,7 +978,7 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @DisplayName: AVGCELLV_Y
// @Description: Vertical position on screen
// @Range: 0 21
AP_SUBGROUPINFO(avgcellvolt, "AVGCELLV", 57, AP_OSD_Screen, AP_OSD_Setting),
AP_SUBGROUPINFO(avgcellvolt, "AVGCELLV", 58, AP_OSD_Screen, AP_OSD_Setting),

// @Param: RESTVOLT_EN
// @DisplayName: RESTVOLT_EN
Expand All @@ -977,7 +994,7 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @DisplayName: RESTVOLT_Y
// @Description: Vertical position on screen
// @Range: 0 21
AP_SUBGROUPINFO(restvolt, "RESTVOLT", 58, AP_OSD_Screen, AP_OSD_Setting),
AP_SUBGROUPINFO(restvolt, "RESTVOLT", 59, AP_OSD_Screen, AP_OSD_Setting),

// @Param: FENCE_EN
// @DisplayName: FENCE_EN
Expand All @@ -993,7 +1010,7 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @DisplayName: FENCE_Y
// @Description: Vertical position on screen
// @Range: 0 21
AP_SUBGROUPINFO(fence, "FENCE", 59, AP_OSD_Screen, AP_OSD_Setting),
AP_SUBGROUPINFO(fence, "FENCE", 60, AP_OSD_Screen, AP_OSD_Setting),

// @Param: RNGF_EN
// @DisplayName: RNGF_EN
Expand All @@ -1009,7 +1026,7 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @DisplayName: RNGF_Y
// @Description: Vertical position on screen
// @Range: 0 21
AP_SUBGROUPINFO(rngf, "RNGF", 60, AP_OSD_Screen, AP_OSD_Setting),
AP_SUBGROUPINFO(rngf, "RNGF", 61, AP_OSD_Screen, AP_OSD_Setting),

// @Param: ACRVOLT_EN
// @DisplayName: ACRVOLT_EN
Expand All @@ -1025,7 +1042,7 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @DisplayName: ACRVOLT_Y
// @Description: Vertical position on screen
// @Range: 0 21
AP_SUBGROUPINFO(avgcellrestvolt, "ACRVOLT", 61, AP_OSD_Screen, AP_OSD_Setting),
AP_SUBGROUPINFO(avgcellrestvolt, "ACRVOLT", 62, AP_OSD_Screen, AP_OSD_Setting),

#if AP_RPM_ENABLED
// @Param: RPM_EN
Expand All @@ -1042,7 +1059,7 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @DisplayName: RPM_Y
// @Description: Vertical position on screen
// @Range: 0 15
AP_SUBGROUPINFO(rrpm, "RPM", 62, AP_OSD_Screen, AP_OSD_Setting),
AP_SUBGROUPINFO(rrpm, "RPM", 63, AP_OSD_Screen, AP_OSD_Setting),
#endif

AP_GROUPEND
Expand Down Expand Up @@ -2502,6 +2519,16 @@ void AP_OSD_Screen::draw_vtx_power(uint8_t x, uint8_t y)
}
backend->write(x, y, !vtx->is_configuration_finished(), "%4hu%c", powr, SYMBOL(SYM_MW));
}

void AP_OSD_Screen::draw_vtx_temp(uint8_t x, uint8_t y)
{
AP_VideoTX *vtx = AP_VideoTX::get_singleton();
if (!vtx) {
return;
}
uint16_t vtx_temperature = vtx->get_temperature();
backend->write(x, y, false, "%3d%c", (int)u_scale(TEMPERATURE, vtx_temperature), u_icon(TEMPERATURE));
}
#endif // AP_VIDEOTX_ENABLED

#if AP_TERRAIN_AVAILABLE
Expand Down Expand Up @@ -2622,6 +2649,7 @@ void AP_OSD_Screen::draw(void)
#endif
#if AP_VIDEOTX_ENABLED
DRAW_SETTING(vtx_power);
DRAW_SETTING(vtx_temp);
#endif

#if HAL_WITH_ESC_TELEM
Expand Down

0 comments on commit 51cbadf

Please sign in to comment.