A26 refresh SD routine refactoring to it is faster when no sd card is present.

This commit is contained in:
Knutwurst
2023-06-12 18:51:20 +02:00
parent 1be2be4b08
commit 1d2c42d994

View File

@@ -1423,34 +1423,24 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
case 26: // A26 refresh SD case 26: // A26 refresh SD
{ {
#ifdef SDSUPPORT #ifdef SDSUPPORT
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("TFT Serial Debug: RefreshSD(): currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_EOL();
SERIAL_ECHOPGM("TFT Serial Debug: RefreshSD(): currentFileOrDirectory: ", currentFileOrDirectory);
SERIAL_EOL();
#endif
FileList currentFileList; FileList currentFileList;
if ((strcasestr_P(currentFileOrDirectory, PSTR(SM_DIR_UP_S)) != NULL)
|| (strcasestr_P(currentFileOrDirectory, PSTR(SM_DIR_UP_L)) != NULL)
) {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Directory UP (cd ..)");
#endif
currentFileList.upDir();
}
else {
if (currentTouchscreenSelection[0] == '<') { if (currentTouchscreenSelection[0] == '<') {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Enter Special Menu"); SERIAL_ECHOLNPGM("TFT Serial Debug: Enter Special Menu");
#endif #endif
HandleSpecialMenu(); HandleSpecialMenu();
} } else if (((strcasestr_P(currentFileOrDirectory, PSTR(SM_DIR_UP_S)) != NULL) ||
else { (strcasestr_P(currentFileOrDirectory, PSTR(SM_DIR_UP_L)) != NULL)) &&
isMediaInserted()) {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Not a menu. Must be a directory!"); SERIAL_ECHOLNPGM("TFT Serial Debug: Directory UP (cd ..)");
#endif
currentFileList.upDir();
} else if (isMediaInserted()) {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Enter Directoy");
#endif #endif
#if ENABLED(KNUTWURST_DGUS2_TFT) #if ENABLED(KNUTWURST_DGUS2_TFT)
strcpy(currentFileOrDirectory, currentTouchscreenSelection); strcpy(currentFileOrDirectory, currentTouchscreenSelection);
int currentFileLen = strlen(currentFileOrDirectory); int currentFileLen = strlen(currentFileOrDirectory);
@@ -1460,13 +1450,11 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
currentFileList.changeDir(currentTouchscreenSelection); currentFileList.changeDir(currentTouchscreenSelection);
#endif #endif
} }
}
}
if (SpecialMenu == false) { if (SpecialMenu == false) {
currentTouchscreenSelection[0] = 0; currentTouchscreenSelection[0] = 0;
} }
#endif // ifdef SDSUPPORT #endif // ifdef SDSUPPORT
}
break; break;
case 28: // A28 filament test case 28: // A28 filament test