Fix special menu not shown, when SD card is not inserted (Fix for #463)

This commit is contained in:
Knutwurst
2023-05-28 17:13:20 +02:00
parent 22dedaeb81
commit ae82913d1f
2 changed files with 49 additions and 51 deletions

View File

@@ -44,7 +44,7 @@
#define CUSTOM_BUILD_VERSION "1.5.0-b5"
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2023-05-24"
#define STRING_DISTRIBUTION_DATE "2023-05-27"
#endif
/**

View File

@@ -313,7 +313,7 @@
#if ENABLED(SDSUPPORT)
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
if (READ(FIL_RUNOUT_PIN)) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... ");
#endif
@@ -360,7 +360,7 @@
void AnycubicTouchscreenClass::HandleSpecialMenu() {
#if ENABLED(KNUTWURST_SPECIAL_MENU)
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("DEBUG: Special Menu Selection: ", currentTouchscreenSelection);
SERIAL_ECHOPGM("TFT Serial Debug: Special Menu Selection: ", currentTouchscreenSelection);
SERIAL_EOL();
#endif
if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_SPECIAL_MENU_L)) != NULL)
@@ -766,7 +766,7 @@
zOffsetBuffer = SM_BLTZ_DISP_L;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("DEBUG: Current probe.offset.z: ", float(probe.offset.z));
SERIAL_ECHOPGM("TFT Serial Debug: Current probe.offset.z: ", float(probe.offset.z));
SERIAL_EOL();
#endif
@@ -1093,7 +1093,7 @@
}
void AnycubicTouchscreenClass::UserConfirmRequired(const char * const msg) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: OnUserConfirmRequired triggered... ", msg);
#endif
@@ -1301,27 +1301,29 @@
case 13: // A13 SELECTION FILE
#if ENABLED(SDSUPPORT)
if (isMediaInserted()) {
{
starpos = (strchr(TFTstrchr_pointer + 4, '*'));
if (TFTstrchr_pointer[4] == '/') {
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 5);
currentFileOrDirectory[0] = 0;
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
SENDLINE_PGM("");
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_EOL();
#endif
}
else if (TFTstrchr_pointer[4] == '<') {
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 4);
SpecialMenu = true;
currentFileOrDirectory[0] = 0;
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
SENDLINE_PGM("");
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("J21", "TFT Serial Debug: Clear file selection... J21 ");
SERIAL_EOL();
#endif
}
else {
if (SpecialMenu == false)
currentTouchscreenSelection[0] = 0;
if (starpos) *(starpos - 1) = '\0';
if (starpos != NULL) *(starpos - 1) = '\0';
strcpy(currentFileOrDirectory, TFTstrchr_pointer + 4);
SENDLINE_DBG_PGM_VAL("J20", "TFT Serial Debug: File Selected... J20 ", currentFileOrDirectory); // J20 File Selected
}
}
@@ -1510,12 +1512,13 @@
break;
case 26: // A26 refresh SD
{
#ifdef SDSUPPORT
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_EOL();
#endif
if (isMediaInserted()) {
if (strlen(currentTouchscreenSelection) > 0) {
FileList currentFileList;
if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_S)) != NULL)
@@ -1549,16 +1552,11 @@
}
}
}
}
if (SpecialMenu == false)
currentTouchscreenSelection[0] = 0;
}
#endif // ifdef SDSUPPORT
break;
#ifdef SERVO_ENDSTOPS
case 27: // A27 servos angles adjust
break;
#endif
case 28: // A28 filament test
{
@@ -1950,7 +1948,7 @@
if (ELAPSED(ms, nextStopCheck)) {
nextStopCheck = ms + 1000UL;
if (mediaPrintingState == AMPRINTSTATE_STOP_REQUESTED) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Finished stopping print, releasing motors ...");
#endif
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;