AP_OSD: use compressed font file
This commit is contained in:
parent
c3db5c3da2
commit
aa205d0537
@ -155,7 +155,7 @@ bool AP_OSD_MAX7456::update_font()
|
|||||||
{
|
{
|
||||||
uint32_t font_size;
|
uint32_t font_size;
|
||||||
uint8_t updated_chars = 0;
|
uint8_t updated_chars = 0;
|
||||||
const uint8_t *font_data = AP_ROMFS::find_file("osd_font.bin", font_size);
|
uint8_t *font_data = AP_ROMFS::find_decompress("osd_font.bin", font_size);
|
||||||
if (font_data == nullptr || font_size != NVM_RAM_SIZE * 256) {
|
if (font_data == nullptr || font_size != NVM_RAM_SIZE * 256) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -167,6 +167,7 @@ bool AP_OSD_MAX7456::update_font()
|
|||||||
//update char inside max7456 NVM
|
//update char inside max7456 NVM
|
||||||
if (!update_font_char(chr, chr_font_data)) {
|
if (!update_font_char(chr, chr_font_data)) {
|
||||||
hal.console->printf("AP_OSD: error during font char update\n");
|
hal.console->printf("AP_OSD: error during font char update\n");
|
||||||
|
free(font_data);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
updated_chars++;
|
updated_chars++;
|
||||||
@ -176,6 +177,7 @@ bool AP_OSD_MAX7456::update_font()
|
|||||||
hal.console->printf("AP_OSD: updated %d symbols.\n", updated_chars);
|
hal.console->printf("AP_OSD: updated %d symbols.\n", updated_chars);
|
||||||
}
|
}
|
||||||
hal.console->printf("AP_OSD: osd font is up to date.\n");
|
hal.console->printf("AP_OSD: osd font is up to date.\n");
|
||||||
|
free(font_data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ extern const AP_HAL::HAL &hal;
|
|||||||
void AP_OSD_SITL::load_font(void)
|
void AP_OSD_SITL::load_font(void)
|
||||||
{
|
{
|
||||||
uint32_t font_size;
|
uint32_t font_size;
|
||||||
const uint8_t *font_data = AP_ROMFS::find_file("osd_font.bin", font_size);
|
uint8_t *font_data = AP_ROMFS::find_decompress("osd_font.bin", font_size);
|
||||||
if (font_data == nullptr || font_size != 54 * 256) {
|
if (font_data == nullptr || font_size != 54 * 256) {
|
||||||
AP_HAL::panic("Bad font file");
|
AP_HAL::panic("Bad font file");
|
||||||
}
|
}
|
||||||
@ -87,6 +87,7 @@ void AP_OSD_SITL::load_font(void)
|
|||||||
}
|
}
|
||||||
font[i].update(pixels);
|
font[i].update(pixels);
|
||||||
}
|
}
|
||||||
|
free(font_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AP_OSD_SITL::write(uint8_t x, uint8_t y, const char* text, uint8_t char_attr)
|
void AP_OSD_SITL::write(uint8_t x, uint8_t y, const char* text, uint8_t char_attr)
|
||||||
|
Loading…
Reference in New Issue
Block a user