diff --git a/libraries/AP_OSD/AP_OSD_SITL.cpp b/libraries/AP_OSD/AP_OSD_SITL.cpp index 9a5feef513..ace2a70b2b 100644 --- a/libraries/AP_OSD/AP_OSD_SITL.cpp +++ b/libraries/AP_OSD/AP_OSD_SITL.cpp @@ -43,7 +43,8 @@ void AP_OSD_SITL::load_font(void) { uint32_t font_size; char fontname[] = "font0.bin"; - fontname[4] = get_font_num() + '0'; + last_font = get_font_num(); + fontname[4] = last_font + '0'; uint8_t *font_data = AP_ROMFS::find_decompress(fontname, font_size); if (font_data == nullptr || font_size != 54 * 256) { AP_HAL::panic("Bad font file"); @@ -173,6 +174,9 @@ void AP_OSD_SITL::update_thread(void) blink = (blink+1) % 4; w->display(); + if (last_font != get_font_num()) { + load_font(); + } usleep(10000); } } diff --git a/libraries/AP_OSD/AP_OSD_SITL.h b/libraries/AP_OSD/AP_OSD_SITL.h index 2117bf4db5..ff47e17f81 100644 --- a/libraries/AP_OSD/AP_OSD_SITL.h +++ b/libraries/AP_OSD/AP_OSD_SITL.h @@ -49,6 +49,7 @@ private: sf::RenderWindow *w; sf::Texture font[256]; + uint8_t last_font; // setup to match MAX7456 layout static const uint8_t char_width = 12;