mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
[Horus] Freeze when invalid (or no) model bitmap
This commit is contained in:
parent
d2155ef089
commit
787d2ffa92
5 changed files with 9 additions and 7 deletions
|
@ -896,6 +896,10 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, co
|
|||
width = LCD_W-x;
|
||||
}
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (scale == 0) {
|
||||
lcdDrawBitmapDMA(x, y, width, height, bmp+4);
|
||||
}
|
||||
|
|
|
@ -390,12 +390,10 @@ bool menuMainView(evt_t event)
|
|||
lcdDrawBitmapPattern(MODELPANEL_LEFT+6, MODELPANEL_TOP+4, LBM_MODEL_ICON, TITLE_BGCOLOR);
|
||||
lcdDrawSizedText(MODELPANEL_LEFT+45, MODELPANEL_TOP+10, g_model.header.name, LEN_MODEL_NAME, ZCHAR|SMLSIZE);
|
||||
lcdDrawSolidHorizontalLine(MODELPANEL_LEFT+39, MODELPANEL_TOP+27, MODELPANEL_WIDTH-48, TITLE_BGCOLOR);
|
||||
// #if 0
|
||||
int scale = getBitmapScale(modelBitmap, MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT);
|
||||
int width = getBitmapScaledSize(getBitmapWidth(modelBitmap), scale);
|
||||
int height = getBitmapScaledSize(getBitmapHeight(modelBitmap), scale);
|
||||
lcdDrawBitmap(MODELPANEL_LEFT+(MODEL_BITMAP_WIDTH-width)/2, MODELPANEL_TOP+MODELPANEL_HEIGHT-MODEL_BITMAP_HEIGHT/2-height/2, modelBitmap, 0, 0, scale);
|
||||
// #endif
|
||||
|
||||
// Timers
|
||||
if (g_model.timers[0].mode) {
|
||||
|
|
|
@ -69,7 +69,10 @@ bool loadModelBitmap(char * name, uint8_t * bitmap)
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(COLORLCD)
|
||||
#if defined(COLORLCD)
|
||||
// TODO only the first bytes can be set to 0
|
||||
memset(bitmap, 0, MODEL_BITMAP_SIZE);
|
||||
#else
|
||||
// In all error cases, we set the default logo
|
||||
memcpy(bitmap, logo_taranis, MODEL_BITMAP_SIZE);
|
||||
#endif
|
||||
|
|
|
@ -414,8 +414,6 @@ const char * storageModifyLine(unsigned int operation, int category, int positio
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
f_close(&file);
|
||||
f_unlink(RADIO_PATH "/models.old");
|
||||
f_rename(RADIO_MODELSLIST_PATH, RADIO_PATH "/models.old");
|
||||
|
|
|
@ -123,7 +123,6 @@ void storageEraseAll(bool warn)
|
|||
MESSAGE(STR_STORAGE_WARNING, STR_STORAGE_FORMAT, NULL, AU_STORAGE_FORMAT);
|
||||
|
||||
storageFormat();
|
||||
storageDirty(EE_GENERAL);
|
||||
storageDirty(EE_MODEL);
|
||||
storageDirty(EE_GENERAL|EE_MODEL);
|
||||
storageCheck(true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue