AP_OSD: fixes for modified AP_ROMFS API

need to use AP_ROMFS::free()
This commit is contained in:
Andrew Tridgell 2019-10-23 20:58:01 +11:00
parent ef1aaa6db0
commit c4d78a7d8c
2 changed files with 5 additions and 5 deletions

View File

@ -161,7 +161,7 @@ bool AP_OSD_MAX7456::update_font()
char fontname[] = "font0.bin";
last_font = get_font_num();
fontname[4] = last_font + '0';
uint8_t *font_data = AP_ROMFS::find_decompress(fontname, font_size);
const uint8_t *font_data = AP_ROMFS::find_decompress(fontname, font_size);
if (font_data == nullptr || font_size != NVM_RAM_SIZE * 256) {
return false;
}
@ -173,7 +173,7 @@ bool AP_OSD_MAX7456::update_font()
//update char inside max7456 NVM
if (!update_font_char(chr, chr_font_data)) {
hal.console->printf("AP_OSD: error during font char update\n");
free(font_data);
AP_ROMFS::free(font_data);
return false;
}
updated_chars++;
@ -183,7 +183,7 @@ bool AP_OSD_MAX7456::update_font()
hal.console->printf("AP_OSD: updated %d symbols.\n", updated_chars);
}
hal.console->printf("AP_OSD: osd font is up to date.\n");
free(font_data);
AP_ROMFS::free(font_data);
return true;
}

View File

@ -47,7 +47,7 @@ void AP_OSD_SITL::load_font(void)
char fontname[] = "font0.bin";
last_font = get_font_num();
fontname[4] = last_font + '0';
uint8_t *font_data = AP_ROMFS::find_decompress(fontname, font_size);
const uint8_t *font_data = AP_ROMFS::find_decompress(fontname, font_size);
if (font_data == nullptr && last_font != 0) {
last_font = 0;
fontname[4] = last_font + '0';
@ -97,7 +97,7 @@ void AP_OSD_SITL::load_font(void)
}
font[i].update(pixels);
}
free(font_data);
AP_ROMFS::free(font_data);
}
void AP_OSD_SITL::write(uint8_t x, uint8_t y, const char* text)