AP_OSD: fallback to font 0 on load failure

this will allow us to reduce the number of fonts we include as
standard without breaking existing setups
This commit is contained in:
Andrew Tridgell 2020-11-13 11:48:49 +11:00
parent a2d86eac6d
commit 3a0e494085

View File

@ -71,6 +71,12 @@ FileData *AP_OSD_Backend::load_font_data(uint8_t font_num)
}
if (fd == nullptr) {
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "OSD: Failed to load font %u", font_num);
if (font_num != 0) {
// fallback to font0.bin. This allows us to reduce the
// number of fonts we include in flash without breaking
// user setups
return load_font_data(0);
}
}
return fd;
}