diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 35c7952f..956cd65e 100755 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -38,11 +38,19 @@ */ #define CONFIGURATION_H_VERSION 020005 +#define ANYCUBIC_TOUCHSCREEN +#define ANYCUBIC_FILAMENT_RUNOUT_SENSOR +#define ANYCUBIC_TFT_DEBUG +//#define POWER_OUTAGE_TEST + #define KNUTWURST_MEGAS //#define KNUTWURST_TMC +//#define KNUTWURS_DGUS2_TFT //#define KNUTWURST_BLTOUCH + + //#define KNUTWURST_DEBUG -//#define POWER_OUTAGE_TEST + //=========================================================================== //============================= Getting Started ============================= @@ -2387,9 +2395,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#define ANYCUBIC_TOUCHSCREEN -#define ANYCUBIC_FILAMENT_RUNOUT_SENSOR -//#define ANYCUBIC_TFT_DEBUG -//#define KNUTWURST_MEGAS_DEBUG -//#define KNUTWURST_TMC_DEBUG diff --git a/Marlin/src/lcd/anycubic_touchscreen.cpp b/Marlin/src/lcd/anycubic_touchscreen.cpp index fae84c40..163a0c2c 100755 --- a/Marlin/src/lcd/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/anycubic_touchscreen.cpp @@ -744,10 +744,21 @@ void AnycubicTouchscreenClass::PrintList() } } - outputString[fileNameLen] = '\0'; + outputString[fileNameLen] = '\0'; if (card.flag.filenameIsDir) { + #if ENABLED(KNUTWURS_DGUS2_TFT) + HARDWARE_SERIAL_PROTOCOLPGM("/"); + HARDWARE_SERIAL_PROTOCOL(card.filename); + HARDWARE_SERIAL_PROTOCOLLNPGM(".GCO"); + HARDWARE_SERIAL_PROTOCOLPGM("/"); + HARDWARE_SERIAL_PROTOCOL(outputString); + HARDWARE_SERIAL_PROTOCOLLNPGM(".gcode"); + SERIAL_ECHO(count); + SERIAL_ECHOPGM(": /"); + SERIAL_ECHOLN(outputString); + #else HARDWARE_SERIAL_PROTOCOL("/"); HARDWARE_SERIAL_PROTOCOLLN(card.filename); HARDWARE_SERIAL_PROTOCOL("/"); @@ -755,6 +766,7 @@ void AnycubicTouchscreenClass::PrintList() SERIAL_ECHO(count); SERIAL_ECHOPGM(": /"); SERIAL_ECHOLN(outputString); + #endif } else { @@ -1284,15 +1296,13 @@ void AnycubicTouchscreenClass::GetCommandFromTFT() SERIAL_EOL(); #endif } - else if ((TFTstrchr_pointer[4] == '<') - || (TFTstrchr_pointer[4] == '[') - || (TFTstrchr_pointer[4] == '_')) + else if (TFTstrchr_pointer[4] == '<') { strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 4); } else { - //currentTouchscreenSelection[0] = 0; + currentTouchscreenSelection[0] = 0; #ifdef ANYCUBIC_TFT_DEBUG SERIAL_ECHOLNPGM("TFT Serial Debug: Normal file open path"); @@ -1326,6 +1336,14 @@ void AnycubicTouchscreenClass::GetCommandFromTFT() #ifdef SDSUPPORT if ((!planner.movesplanned()) && (TFTstate != ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate != ANYCUBIC_TFT_STATE_SDOUTAGE) && (card.isFileOpen())) { + if ((currentTouchscreenSelection[0] == '<') || (currentTouchscreenSelection[0] == 0)) + { + SERIAL_ECHOLNPGM("ERROR: Special entry found! Stopping..."); + KillTFT(); + return; + } + + ai3m_pause_state = 0; #ifdef ANYCUBIC_TFT_DEBUG SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state); @@ -1567,11 +1585,8 @@ void AnycubicTouchscreenClass::GetCommandFromTFT() } else { - //if ((SelectedDirectory[0] == '.') && (SelectedDirectory[1] == '.')) - if ((currentTouchscreenSelection[0] == 'D') - && (currentTouchscreenSelection[1] == 'I') - && (currentTouchscreenSelection[2] == 'R') - && (currentTouchscreenSelection[3] == '_')) + if ((strcasestr(currentTouchscreenSelection, SM_DIR_UP_S) != NULL) + || (strcasestr(currentTouchscreenSelection, SM_DIR_UP_L) != NULL)) { #ifdef ANYCUBIC_TFT_DEBUG SERIAL_ECHOLNPGM("TFT Serial Debug: Directory UP (cd ..)"); @@ -1580,8 +1595,7 @@ void AnycubicTouchscreenClass::GetCommandFromTFT() } else { - if ((currentTouchscreenSelection[0] == '[') - || (currentTouchscreenSelection[0] == '_')) + if (currentTouchscreenSelection[0] == '<') { #ifdef ANYCUBIC_TFT_DEBUG SERIAL_ECHOLNPGM("TFT Serial Debug: Enter Special Menu"); @@ -1593,10 +1607,15 @@ void AnycubicTouchscreenClass::GetCommandFromTFT() #ifdef ANYCUBIC_TFT_DEBUG SERIAL_ECHOLNPGM("TFT Serial Debug: Not a menu. Must be a directory!"); #endif + + #if ENABLED(KNUTWURS_DGUS2_TFT) strcpy(currentFileOrDirectory, currentTouchscreenSelection); int currentFileLen = strlen(currentFileOrDirectory); currentFileOrDirectory[currentFileLen - 4] = '\0'; card.cd(currentFileOrDirectory); + #else + card.cd(currentTouchscreenSelection); + #endif } } } diff --git a/Marlin/src/lcd/anycubic_touchscreen.h b/Marlin/src/lcd/anycubic_touchscreen.h index bf641c74..d535b328 100755 --- a/Marlin/src/lcd/anycubic_touchscreen.h +++ b/Marlin/src/lcd/anycubic_touchscreen.h @@ -34,7 +34,7 @@ char *ftostr32(const float &); #define TFTBUFSIZE 4 #define TFT_MAX_CMD_SIZE 96 #define MSG_MY_VERSION "Knutwurst-1.0.7" -#define MAX_PRINTABLE_FILENAME_LEN 96 +#define MAX_PRINTABLE_FILENAME_LEN 30 #define ANYCUBIC_TFT_STATE_IDLE 0 #define ANYCUBIC_TFT_STATE_SDPRINT 1 @@ -44,49 +44,96 @@ char *ftostr32(const float &); #define ANYCUBIC_TFT_STATE_SDSTOP_REQ 5 #define ANYCUBIC_TFT_STATE_SDOUTAGE 99 +#if DISABLED(KNUTWURS_DGUS2_TFT) +#define SM_DIR_UP_L "/.." +#define SM_DIR_UP_S ".." +#define SM_SPECIAL_MENU_L "" +#define SM_SPECIAL_MENU_S "" +#define SM_PID_HOTEND_S "" +#define SM_PID_BED_S "" +#define SM_SAVE_EEPROM_S "" +#define SM_LOAD_DEFAULTS_S "" +#define SM_PREHEAT_BED_S "" +#define SM_MESH_START_S "" +#define SM_MESH_NEXT_S "" +#define SM_Z_UP_01_S "" +#define SM_Z_DN_01_S "" +#define SM_Z_UP_002_S "" +#define SM_Z_DN_002_S "" +#define SM_Z_UP_001_S "" +#define SM_Z_DN_001_S "" +#define SM_BLTOUCH_S "" +#define SM_PAUSE_S "" +#define SM_RESUME_S "" +#define SM_DIS_FILSENS_S "" +#define SM_EN_FILSENS_S "" +#define SM_EXIT_S ".gcode" +#define SM_SPECIAL_MENU_S ".gcode" +#define SM_PID_HOTEND_S ".gcode" +#define SM_PID_BED_S ".gcode" +#define SM_SAVE_EEPROM_S ".gcode" +#define SM_LOAD_DEFAULTS_S ".gcode" +#define SM_PREHEAT_BED_S ".gcode" +#define SM_MESH_START_S ".gcode" +#define SM_MESH_NEXT_S ".gcode" +#define SM_Z_UP_01_S ".gcode" +#define SM_Z_DN_01_S ".gcode" +#define SM_Z_UP_002_S ".gcode" +#define SM_Z_DN_002_S ".gcode" +#define SM_Z_UP_001_S ".gcode" +#define SM_Z_DN_001_S ".gcode" +#define SM_BLTOUCH_S ".gcode" +#define SM_PAUSE_S ".gcode" +#define SM_RESUME_S ".gcode" +#define SM_DIS_FILSENS_S ".gcode" +#define SM_EN_FILSENS_S ".gcode" +#define SM_EXIT_S "