diff --git a/libraries/AP_OSD/AP_OSD.cpp b/libraries/AP_OSD/AP_OSD.cpp index 34ee67df2be06..a14e17eafb7a9 100644 --- a/libraries/AP_OSD/AP_OSD.cpp +++ b/libraries/AP_OSD/AP_OSD.cpp @@ -409,19 +409,41 @@ void AP_OSD::osd_thread() void AP_OSD::update_osd() { - for (uint8_t instance = 0; instance < _backend_count; instance++) { - _backends[instance]->clear(); - - if (!_disable) { - get_screen(current_screen).set_backend(_backends[instance]); - // skip drawing for MSP OSD backends to save some resources - if (_backends[instance]->get_backend_type() != OSD_MSP) { - get_screen(current_screen).draw(); - } - } - - _backends[instance]->flush(); - } +#if AP_OSD_SCREEN_CONCURRENTLY_ENABLED + if (rc_channel == 0 + && get_screen(0).enabled && get_screen(1).enabled + && osd_type.get()!=OSD_NONE && osd_type2.get()!=OSD_NONE) { + for (uint8_t instance = 0; instance < _backend_count; instance++) { + _backends[instance]->clear(); + + if (!_disable) { + get_screen(current_screen+instance).set_backend(_backends[instance]); + // skip drawing for MSP OSD backends to save some resources + if (_backends[instance]->get_backend_type() != OSD_MSP) { + get_screen(current_screen+instance).draw(); + } + } + + _backends[instance]->flush(); + } + } else { +#endif /* AP_OSD_SCREEN_CONCURRENTLY_ENABLED */ + for (uint8_t instance = 0; instance < _backend_count; instance++) { + _backends[instance]->clear(); + + if (!_disable) { + get_screen(current_screen).set_backend(_backends[instance]); + // skip drawing for MSP OSD backends to save some resources + if (_backends[instance]->get_backend_type() != OSD_MSP) { + get_screen(current_screen).draw(); + } + } + + _backends[instance]->flush(); + } +#if AP_OSD_SCREEN_CONCURRENTLY_ENABLED + } +#endif /* AP_OSD_SCREEN_CONCURRENTLY_ENABLED */ } //update maximums and totals diff --git a/libraries/AP_OSD/AP_OSD_config.h b/libraries/AP_OSD/AP_OSD_config.h index f7302dd63e465..cfe987a5d56b8 100644 --- a/libraries/AP_OSD/AP_OSD_config.h +++ b/libraries/AP_OSD/AP_OSD_config.h @@ -26,3 +26,8 @@ #ifndef AP_OSD_LINK_STATS_EXTENSIONS_ENABLED #define AP_OSD_LINK_STATS_EXTENSIONS_ENABLED 0 // Disabled by default to save flash, enable via custom build server #endif + +#ifndef AP_OSD_SCREEN_CONCURRENTLY_ENABLED +#define AP_OSD_SCREEN_CONCURRENTLY_ENABLED 0 // Disabled by default to save flash, enable via custom build server +#endif +