From 2a2840eb1471c26d7bb338ffb0c8021ce8d5b90c Mon Sep 17 00:00:00 2001 From: "bsongis@gmail.com" Date: Tue, 18 Jun 2013 18:16:47 +0000 Subject: [PATCH] I promised :) --- src/gui/menu_general.cpp | 26 ++++++-- src/gui/menu_model.cpp | 12 ++-- src/targets/gruvin9x/board_gruvin9x.h | 94 +++++++++++++-------------- 3 files changed, 75 insertions(+), 57 deletions(-) diff --git a/src/gui/menu_general.cpp b/src/gui/menu_general.cpp index 91cf576c1..f500b7e4b 100644 --- a/src/gui/menu_general.cpp +++ b/src/gui/menu_general.cpp @@ -620,12 +620,12 @@ void menuGeneralSdManagerInfo(uint8_t event) inline bool isFilenameGreater(bool isfile, const char * fn, const char * line) { - return (isfile && !line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcmp(fn, line) > 0); + return (isfile && !line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) > 0); } inline bool isFilenameLower(bool isfile, const char * fn, const char * line) { - return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcmp(fn, line) < 0); + return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) < 0); } void onSdManagerMenu(const char *result) @@ -713,7 +713,7 @@ void menuGeneralSdManager(uint8_t event) #endif { if (m_posVert > 0) { - uint8_t index = m_posVert-1-s_pgOfs; + vertpos_t index = m_posVert-1-s_pgOfs; if (!reusableBuffer.sdmanager.lines[index][SD_SCREEN_FILE_LENGTH+1]) { f_chdir(reusableBuffer.sdmanager.lines[index]); s_pgOfs = 0; @@ -741,7 +741,7 @@ void menuGeneralSdManager(uint8_t event) /* TODO if (!strcmp(ext, MODELS_EXT)) { s_menu[s_menu_count++] = STR_LOAD_FILE; } - else */ if (!strcmp(ext, SOUNDS_EXT)) { + else */ if (!strcasecmp(ext, SOUNDS_EXT)) { MENU_ADD_ITEM(STR_PLAY_FILE); } #endif @@ -845,6 +845,24 @@ void menuGeneralSdManager(uint8_t event) if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(lcdLastPos, y, ']', attr); } } } + +#if defined(PCBTARANIS) + static vertpos_t sdBitmapIdx = 0xFFFF; + static uint8_t sdBitmap[MODEL_BITMAP_SIZE]; + vertpos_t index = m_posVert-1-s_pgOfs; + if (m_posVert > 0) { + char * ext = reusableBuffer.sdmanager.lines[index]; + ext += strlen(ext) - 4; + if (!strcasecmp(ext, BITMAPS_EXT)) { + if (sdBitmapIdx != m_posVert) { + sdBitmapIdx = m_posVert; + if (bmpLoad(sdBitmap, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) + memcpy(sdBitmap, logo_taranis, MODEL_BITMAP_SIZE); + } + lcd_bmp(22*FW+2, 2*FH+FH/2, sdBitmap); + } + } +#endif } #endif diff --git a/src/gui/menu_model.cpp b/src/gui/menu_model.cpp index f79ac182f..2c3e0195c 100644 --- a/src/gui/menu_model.cpp +++ b/src/gui/menu_model.cpp @@ -203,19 +203,19 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen, #endif uint8_t len = strlen(fn); - if (len < 5 || len > maxlen+4 || strcmp(fn+len-4, extension) || (fno.fattrib & AM_DIR)) continue; + if (len < 5 || len > maxlen+4 || strcasecmp(fn+len-4, extension) || (fno.fattrib & AM_DIR)) continue; s_menu_count++; fn[len-4] = '\0'; if (s_menu_offset == 0) { - if (selection && strncmp(fn, selection, maxlen) < 0) { + if (selection && strncasecmp(fn, selection, maxlen) < 0) { s_last_menu_offset++; } else { for (uint8_t i=0; i=0; i--) { char *line = reusableBuffer.modelsel.menu_bss[i]; - if (line[0] == '\0' || strcmp(fn, line) > 0) { + if (line[0] == '\0' || strcasecmp(fn, line) > 0) { if (i > 0) memmove(reusableBuffer.modelsel.menu_bss[0], reusableBuffer.modelsel.menu_bss[1], sizeof(reusableBuffer.modelsel.menu_bss[i]) * i); memset(line, 0, MENU_LINE_LENGTH); strcpy(line, fn); @@ -240,13 +240,13 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen, s_menu[i] = reusableBuffer.modelsel.menu_bss[i]; } else if (s_menu_offset > s_last_menu_offset) { - if (strcmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-2]) > 0 && strcmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1]) < 0) { + if (strcasecmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-2]) > 0 && strcasecmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1]) < 0) { memset(reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1], 0, MENU_LINE_LENGTH); strcpy(reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1], fn); } } else { - if (strcmp(fn, reusableBuffer.modelsel.menu_bss[1]) < 0 && strcmp(fn, reusableBuffer.modelsel.menu_bss[0]) > 0) { + if (strcasecmp(fn, reusableBuffer.modelsel.menu_bss[1]) < 0 && strcasecmp(fn, reusableBuffer.modelsel.menu_bss[0]) > 0) { memset(reusableBuffer.modelsel.menu_bss[0], 0, MENU_LINE_LENGTH); strcpy(reusableBuffer.modelsel.menu_bss[0], fn); } diff --git a/src/targets/gruvin9x/board_gruvin9x.h b/src/targets/gruvin9x/board_gruvin9x.h index 2d77759aa..27f71c8f9 100644 --- a/src/targets/gruvin9x/board_gruvin9x.h +++ b/src/targets/gruvin9x/board_gruvin9x.h @@ -37,48 +37,48 @@ #ifndef board_gruvin9x_h #define board_gruvin9x_h -#define GPIO_BUTTON_MENU pinl -#define GPIO_BUTTON_EXIT pinl -#define GPIO_BUTTON_RIGHT pinl -#define GPIO_BUTTON_LEFT pinl -#define GPIO_BUTTON_UP pinl -#define GPIO_BUTTON_DOWN pinl -#define PIN_BUTTON_MENU (1<