Add root flag to CardReader (#15275)

This commit is contained in:
Robby Candra
2019-09-17 05:49:55 +07:00
committed by Scott Lahteine
parent eb1a368277
commit 98233b1de0
4 changed files with 11 additions and 18 deletions

View File

@ -975,8 +975,7 @@ namespace ExtUI {
bool FileList::isAtRootDir() {
#if ENABLED(SDSUPPORT)
card.getWorkDirName();
return card.filename[0] == '/';
card.flag.workDirIsRoot;
#else
return true;
#endif

View File

@ -127,21 +127,14 @@ void menu_media() {
#if HAS_GRAPHICAL_LCD
static uint16_t fileCnt;
static bool at_root;
if (ui.first_page) {
fileCnt = card.get_num_Files();
card.getWorkDirName();
at_root = card.filename[0] == '/';
}
if (ui.first_page) fileCnt = card.get_num_Files();
#else
const uint16_t fileCnt = card.get_num_Files();
card.getWorkDirName();
const bool at_root = card.filename[0] == '/';
#endif
START_MENU();
MENU_BACK(MSG_MAIN);
if (at_root) {
if (card.flag.workDirIsRoot) {
#if !PIN_EXISTS(SD_DETECT)
MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
#endif