AP_OSD: fix code causing errors when OSD is compiled out

This fixes the code causing problem in compiling out OSD
This commit is contained in:
Shiv Tyagi 2021-11-04 00:01:18 +05:30 committed by Andrew Tridgell
parent ff3c4b8bda
commit 4b7b5a4d90
3 changed files with 6 additions and 2 deletions

View File

@ -97,13 +97,16 @@ MSPCommandResult AP_MSP_Telem_DJI::msp_process_out_esc_sensor_data(sbuf_t *dst)
if (!displaying_stats_screen()) {
telem.get_highest_motor_temperature(highest_temperature);
} else {
#if OSD_ENABLED
AP_OSD *osd = AP::osd();
if (osd == nullptr) {
return MSP_RESULT_ERROR;
}
WITH_SEMAPHORE(osd->get_semaphore());
highest_temperature = osd->get_stats_info().max_esc_temp;
#endif
}
const struct PACKED {
uint8_t temp;
uint16_t rpm;

View File

@ -217,12 +217,13 @@ const AP_Param::GroupInfo AP_OSD::var_info[] = {
AP_SUBGROUPINFO(param_screen[1], "6_", 22, AP_OSD, AP_OSD_ParamScreen),
#endif
#if OSD_ENABLED
// additional tables to go beyond 63 limit
AP_SUBGROUPINFO2(screen[0], "1_", 27, AP_OSD, AP_OSD_Screen),
AP_SUBGROUPINFO2(screen[1], "2_", 28, AP_OSD, AP_OSD_Screen),
AP_SUBGROUPINFO2(screen[2], "3_", 29, AP_OSD, AP_OSD_Screen),
AP_SUBGROUPINFO2(screen[3], "4_", 30, AP_OSD, AP_OSD_Screen),
#endif
AP_GROUPEND
};

View File

@ -380,7 +380,7 @@ public:
static const uint8_t NUM_PARAMS = 9;
static const uint8_t SAVE_PARAM = NUM_PARAMS + 1;
#if HAL_WITH_OSD_BITMAP || HAL_WITH_MSP_DISPLAYPORT
#if OSD_ENABLED && (HAL_WITH_OSD_BITMAP || HAL_WITH_MSP_DISPLAYPORT)
void draw(void) override;
#endif
#if HAL_GCS_ENABLED