fix(bw212): SD card image viewer may show corrupted image (#7416)
This commit is contained in:
@@ -191,6 +191,15 @@ uint8_t * lcdLoadBitmap(uint8_t * bmp, const char * filename, uint16_t width, ui
|
|||||||
|
|
||||||
uint8_t modelBitmap[MODEL_BITMAP_SIZE] __DMA;
|
uint8_t modelBitmap[MODEL_BITMAP_SIZE] __DMA;
|
||||||
|
|
||||||
|
void loadLogoBitmap(uint8_t* bitmap)
|
||||||
|
{
|
||||||
|
RleBitmap pic(logo_taranis, 0);
|
||||||
|
*bitmap++ = pic.getWidth();
|
||||||
|
*bitmap++ = pic.getRawRows();
|
||||||
|
for(int i=0; i < MODEL_BITMAP_SIZE-2; i++)
|
||||||
|
*bitmap++ = pic.getNext();
|
||||||
|
}
|
||||||
|
|
||||||
bool loadModelBitmap(char * name, uint8_t * bitmap)
|
bool loadModelBitmap(char * name, uint8_t * bitmap)
|
||||||
{
|
{
|
||||||
uint8_t len = zlen(name, LEN_BITMAP_NAME);
|
uint8_t len = zlen(name, LEN_BITMAP_NAME);
|
||||||
@@ -204,10 +213,6 @@ bool loadModelBitmap(char * name, uint8_t * bitmap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// In all error cases, we set the default logo
|
// In all error cases, we set the default logo
|
||||||
RleBitmap pic(logo_taranis, 0);
|
loadLogoBitmap(bitmap);
|
||||||
*bitmap++ = pic.getWidth();
|
|
||||||
*bitmap++ = pic.getRawRows();
|
|
||||||
for(int i=0; i < MODEL_BITMAP_SIZE-2; i++)
|
|
||||||
*bitmap++ = pic.getNext();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
extern uint8_t modelBitmap[MODEL_BITMAP_SIZE];
|
extern uint8_t modelBitmap[MODEL_BITMAP_SIZE];
|
||||||
bool loadModelBitmap(char * name, uint8_t * bitmap);
|
bool loadModelBitmap(char * name, uint8_t * bitmap);
|
||||||
|
void loadLogoBitmap(uint8_t* bitmap);
|
||||||
|
|
||||||
void drawColumnHeader(const char * const * headers, uint8_t index);
|
void drawColumnHeader(const char * const * headers, uint8_t index);
|
||||||
|
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ void menuRadioSdManager(event_t _event)
|
|||||||
if (ext && isExtensionMatching(ext, BITMAPS_EXT)) {
|
if (ext && isExtensionMatching(ext, BITMAPS_EXT)) {
|
||||||
if (lastPos != menuVerticalPosition) {
|
if (lastPos != menuVerticalPosition) {
|
||||||
if (!lcdLoadBitmap(modelBitmap, reusableBuffer.sdManager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) {
|
if (!lcdLoadBitmap(modelBitmap, reusableBuffer.sdManager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) {
|
||||||
memcpy(modelBitmap, logo_taranis, MODEL_BITMAP_SIZE);
|
loadLogoBitmap(modelBitmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lcdDrawBitmap(22*FW+2, 2*FH+FH/2, modelBitmap);
|
lcdDrawBitmap(22*FW+2, 2*FH+FH/2, modelBitmap);
|
||||||
|
|||||||
Reference in New Issue
Block a user