From 77e32165289f89a40bf815b461bf8c0604bd0d47 Mon Sep 17 00:00:00 2001 From: Shiv Tyagi Date: Thu, 4 Nov 2021 00:01:18 +0530 Subject: [PATCH] AP_OSD: fix code causing errors when OSD is compiled out This fixes the code causing problem in compiling out OSD --- libraries/AP_MSP/AP_MSP_Telem_DJI.cpp | 3 +++ libraries/AP_OSD/AP_OSD.cpp | 3 ++- libraries/AP_OSD/AP_OSD.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/AP_MSP/AP_MSP_Telem_DJI.cpp b/libraries/AP_MSP/AP_MSP_Telem_DJI.cpp index c92b346fc4f76..4a23553e8bab7 100644 --- a/libraries/AP_MSP/AP_MSP_Telem_DJI.cpp +++ b/libraries/AP_MSP/AP_MSP_Telem_DJI.cpp @@ -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; diff --git a/libraries/AP_OSD/AP_OSD.cpp b/libraries/AP_OSD/AP_OSD.cpp index 7e16b8627d986..a2ca501a7f89f 100644 --- a/libraries/AP_OSD/AP_OSD.cpp +++ b/libraries/AP_OSD/AP_OSD.cpp @@ -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 }; diff --git a/libraries/AP_OSD/AP_OSD.h b/libraries/AP_OSD/AP_OSD.h index 9648490ada5cb..4d3c7ece81b63 100644 --- a/libraries/AP_OSD/AP_OSD.h +++ b/libraries/AP_OSD/AP_OSD.h @@ -380,7 +380,7 @@ class AP_OSD_ParamScreen : public AP_OSD_AbstractScreen 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