diff --git a/radio/src/gui/Horus/lcd.cpp b/radio/src/gui/Horus/lcd.cpp index 67d5ad418..6c627898f 100644 --- a/radio/src/gui/Horus/lcd.cpp +++ b/radio/src/gui/Horus/lcd.cpp @@ -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); } diff --git a/radio/src/gui/Horus/view_main.cpp b/radio/src/gui/Horus/view_main.cpp index cf4fbbe42..7a42d74ce 100644 --- a/radio/src/gui/Horus/view_main.cpp +++ b/radio/src/gui/Horus/view_main.cpp @@ -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) { diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index fea6f427e..72d5f983c 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -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 diff --git a/radio/src/storage/sdcard_raw.cpp b/radio/src/storage/sdcard_raw.cpp index 652dfed0c..ae692b05b 100644 --- a/radio/src/storage/sdcard_raw.cpp +++ b/radio/src/storage/sdcard_raw.cpp @@ -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"); diff --git a/radio/src/storage/storage_common.cpp b/radio/src/storage/storage_common.cpp index 05bdfb692..834dc5ac3 100644 --- a/radio/src/storage/storage_common.cpp +++ b/radio/src/storage/storage_common.cpp @@ -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); }