mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_OSD: added font switching at runtime for SITL
This commit is contained in:
parent
64fae25882
commit
52a8198311
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user