SD Menu patches

This commit is contained in:
Scott Lahteine 2017-11-26 01:14:18 -06:00
parent 9b64be0bc5
commit f90c075d1f
3 changed files with 8 additions and 6 deletions

View file

@ -3743,7 +3743,7 @@ void kill_screen(const char* lcd_msg) {
#endif #endif
void lcd_sd_updir() { void lcd_sd_updir() {
card.updir(); encoderPosition = card.updir() ? ENCODER_STEPS_PER_MENU_ITEM : 0;
encoderTopLine = 0; encoderTopLine = 0;
screen_changed = true; screen_changed = true;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
@ -4444,7 +4444,8 @@ void kill_screen(const char* lcd_msg) {
void menu_action_sddirectory(const char* filename, char* longFilename) { void menu_action_sddirectory(const char* filename, char* longFilename) {
UNUSED(longFilename); UNUSED(longFilename);
card.chdir(filename); card.chdir(filename);
encoderPosition = 0; encoderTopLine = 0;
encoderPosition = 2 * ENCODER_STEPS_PER_MENU_ITEM;
screen_changed = true; screen_changed = true;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
} }

View file

@ -631,13 +631,14 @@ void CardReader::chdir(const char * relpath) {
} }
} }
void CardReader::updir() { int8_t CardReader::updir() {
if (workDirDepth > 0) { // At least 1 dir has been saved if (workDirDepth > 0) { // At least 1 dir has been saved
workDir = --workDirDepth ? workDirParents[workDirDepth] : root; // Use parent, or root if none workDir = --workDirDepth ? workDirParents[workDirDepth - 1] : root; // Use parent, or root if none
#if ENABLED(SDCARD_SORT_ALPHA) #if ENABLED(SDCARD_SORT_ALPHA)
presort(); presort();
#endif #endif
} }
return workDirDepth;
} }
#if ENABLED(SDCARD_SORT_ALPHA) #if ENABLED(SDCARD_SORT_ALPHA)

View file

@ -63,7 +63,7 @@ public:
void ls(); void ls();
void chdir(const char *relpath); void chdir(const char *relpath);
void updir(); int8_t updir();
void setroot(); void setroot();
uint16_t get_num_Files(); uint16_t get_num_Files();