fix(color): Bitmap name truncation if exactly 14 characters long (#4232)

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
philmoz
2023-10-31 11:40:49 +10:00
committed by GitHub
co-authored by Peter Feerick
parent ba30278456
commit f5593c44e8
7 changed files with 21 additions and 22 deletions
+5 -5
View File
@@ -239,14 +239,14 @@ void copySelection(char * dst, const char * src, uint8_t size)
void onModelSetupBitmapMenu(const char * result)
{
if (result == STR_UPDATE_LIST) {
if (!sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), nullptr)) {
if (!sdListFiles(BITMAPS_PATH, BITMAPS_EXT, LEN_BITMAP_NAME, nullptr)) {
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
}
}
else if (result != STR_EXIT) {
// The user choosed a bmp file in the list
copySelection(g_model.header.bitmap, result, sizeof(g_model.header.bitmap));
memcpy(modelHeaders[g_eeGeneral.currModel].bitmap, g_model.header.bitmap, sizeof(g_model.header.bitmap));
copySelection(g_model.header.bitmap, result, LEN_BITMAP_NAME);
memcpy(modelHeaders[g_eeGeneral.currModel].bitmap, g_model.header.bitmap, LEN_BITMAP_NAME);
storageDirty(EE_MODEL);
}
}
@@ -641,12 +641,12 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_SETUP_BITMAP:
lcdDrawTextAlignedLeft(y, STR_BITMAP);
if (ZEXIST(g_model.header.bitmap))
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN, y, g_model.header.bitmap, sizeof(g_model.header.bitmap), attr);
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN, y, g_model.header.bitmap, LEN_BITMAP_NAME, attr);
else
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VCSWFUNC, 0, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
s_editMode = 0;
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), g_model.header.bitmap, LIST_NONE_SD_FILE)) {
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, LEN_BITMAP_NAME, g_model.header.bitmap, LIST_NONE_SD_FILE)) {
POPUP_MENU_START(onModelSetupBitmapMenu);
}
else {