I promised :)
This commit is contained in:
@@ -620,12 +620,12 @@ void menuGeneralSdManagerInfo(uint8_t event)
|
|||||||
|
|
||||||
inline bool isFilenameGreater(bool isfile, const char * fn, const char * line)
|
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)
|
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)
|
void onSdManagerMenu(const char *result)
|
||||||
@@ -713,7 +713,7 @@ void menuGeneralSdManager(uint8_t event)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (m_posVert > 0) {
|
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]) {
|
if (!reusableBuffer.sdmanager.lines[index][SD_SCREEN_FILE_LENGTH+1]) {
|
||||||
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
||||||
s_pgOfs = 0;
|
s_pgOfs = 0;
|
||||||
@@ -741,7 +741,7 @@ void menuGeneralSdManager(uint8_t event)
|
|||||||
/* TODO if (!strcmp(ext, MODELS_EXT)) {
|
/* TODO if (!strcmp(ext, MODELS_EXT)) {
|
||||||
s_menu[s_menu_count++] = STR_LOAD_FILE;
|
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);
|
MENU_ADD_ITEM(STR_PLAY_FILE);
|
||||||
}
|
}
|
||||||
#endif
|
#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 (!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
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -203,19 +203,19 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t len = strlen(fn);
|
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++;
|
s_menu_count++;
|
||||||
fn[len-4] = '\0';
|
fn[len-4] = '\0';
|
||||||
|
|
||||||
if (s_menu_offset == 0) {
|
if (s_menu_offset == 0) {
|
||||||
if (selection && strncmp(fn, selection, maxlen) < 0) {
|
if (selection && strncasecmp(fn, selection, maxlen) < 0) {
|
||||||
s_last_menu_offset++;
|
s_last_menu_offset++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (uint8_t i=0; i<MENU_MAX_LINES; i++) {
|
for (uint8_t i=0; i<MENU_MAX_LINES; i++) {
|
||||||
char *line = reusableBuffer.modelsel.menu_bss[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 < MENU_MAX_LINES-1) memmove(reusableBuffer.modelsel.menu_bss[i+1], line, sizeof(reusableBuffer.modelsel.menu_bss[i]) * (MENU_MAX_LINES-1-i));
|
if (i < MENU_MAX_LINES-1) memmove(reusableBuffer.modelsel.menu_bss[i+1], line, sizeof(reusableBuffer.modelsel.menu_bss[i]) * (MENU_MAX_LINES-1-i));
|
||||||
memset(line, 0, MENU_LINE_LENGTH);
|
memset(line, 0, MENU_LINE_LENGTH);
|
||||||
strcpy(line, fn);
|
strcpy(line, fn);
|
||||||
@@ -229,7 +229,7 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen,
|
|||||||
else if (s_last_menu_offset == 0xffff) {
|
else if (s_last_menu_offset == 0xffff) {
|
||||||
for (int i=MENU_MAX_LINES-1; i>=0; i--) {
|
for (int i=MENU_MAX_LINES-1; i>=0; i--) {
|
||||||
char *line = reusableBuffer.modelsel.menu_bss[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);
|
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);
|
memset(line, 0, MENU_LINE_LENGTH);
|
||||||
strcpy(line, fn);
|
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];
|
s_menu[i] = reusableBuffer.modelsel.menu_bss[i];
|
||||||
}
|
}
|
||||||
else if (s_menu_offset > s_last_menu_offset) {
|
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);
|
memset(reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1], 0, MENU_LINE_LENGTH);
|
||||||
strcpy(reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1], fn);
|
strcpy(reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1], fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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);
|
memset(reusableBuffer.modelsel.menu_bss[0], 0, MENU_LINE_LENGTH);
|
||||||
strcpy(reusableBuffer.modelsel.menu_bss[0], fn);
|
strcpy(reusableBuffer.modelsel.menu_bss[0], fn);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user