From 5ee74668cf48a72736ffa8a1dfd6ca1fa6644eeb Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Fri, 16 Sep 2022 21:21:13 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Anycubic=20i3=20Mega=20LCD=20file?= =?UTF-8?q?=20menu=20fix=20(#24752)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 1 + .../anycubic_i3mega/anycubic_i3mega_lcd.cpp | 94 ++++++++++--------- 2 files changed, 51 insertions(+), 44 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 59285af763cd..a2370d99d083 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2989,6 +2989,7 @@ //#define ANYCUBIC_LCD_CHIRON #if EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON) //#define ANYCUBIC_LCD_DEBUG + //#define ANYCUBIC_LCD_GCODE_EXT // Add ".gcode" to menu entries for DGUS clone compatibility #endif // diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp index 0da8bb36a780..03997fa95bea 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -46,6 +46,12 @@ #define SENDLINE_DBG_PGM_VAL(x,y,z) sendLine_P(PSTR(x)) #endif +// Append ".gcode" to filename, if requested. Used for some DGUS-clone displays with built-in filter. +// Filenames are limited to 26 characters, so the actual name for the FILENAME can be 20 characters at most. +// If a longer string is desired without "extension, use the ALTNAME macro to provide a (longer) alternative. +#define SPECIAL_MENU_FILENAME(A) A TERN_(ANYCUBIC_LCD_GCODE_EXT, ".gcode") +#define SPECIAL_MENU_ALTNAME(A, B) TERN(ANYCUBIC_LCD_GCODE_EXT, A ".gcode", B) + AnycubicTFTClass AnycubicTFT; char AnycubicTFTClass::TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; @@ -383,8 +389,8 @@ void AnycubicTFTClass::RenderCurrentFileList() { if (!isMediaInserted() && !SpecialMenu) { SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02"); - SENDLINE_PGM(""); - SENDLINE_PGM(""); + SENDLINE_PGM("")); } else { if (CodeSeen('S')) @@ -403,58 +409,58 @@ void AnycubicTFTClass::RenderSpecialMenu(uint16_t selectedNumber) { switch (selectedNumber) { #if ENABLED(PROBE_MANUALLY) case 0: // First Page - SENDLINE_PGM("<01ZUp0.1>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<02ZUp0.02>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<03ZDn0.02>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<04ZDn0.1>"); - SENDLINE_PGM(""); + SENDLINE_PGM("<01ZUP~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<02ZUP~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<03ZDO~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<04ZDO~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); break; case 4: // Second Page - SENDLINE_PGM("<05PrehtBed>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<06SMeshLvl>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<07MeshNPnt>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<08HtEndPID>"); - SENDLINE_PGM(""); + SENDLINE_PGM("<05PRE~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<06MES~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_ALTNAME("", "")); + SENDLINE_PGM("<07NEX~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<08PID~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); break; case 8: // Third Page - SENDLINE_PGM("<09HtBedPID>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<10FWDeflts>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<11SvEEPROM>"); - SENDLINE_PGM(""); - SENDLINE_PGM(""); - SENDLINE_PGM(""); + SENDLINE_PGM("<09PID~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<10FWD~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<11SAV~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("")); break; #else case 0: // First Page - SENDLINE_PGM("<01PrehtBed>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<02ABL>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<03HtEndPID>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<04HtBedPID>"); - SENDLINE_PGM(""); + SENDLINE_PGM("<01PRE~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<02ABL~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<03PID~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_ALTNAME("", "")); + SENDLINE_PGM("<04PID~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_ALTNAME("", "")); break; case 4: // Second Page - SENDLINE_PGM("<05FWDeflts>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<06SvEEPROM>"); - SENDLINE_PGM(""); - SENDLINE_PGM("<07SendM108>"); - SENDLINE_PGM(""); - SENDLINE_PGM(""); - SENDLINE_PGM(""); + SENDLINE_PGM("<05FWD~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<06SAV~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_FILENAME("")); + SENDLINE_PGM("<06SEN~1.GCO"); + SENDLINE_PGM(SPECIAL_MENU_ALTNAME("", "")); + SENDLINE_PGM("")); break; #endif // PROBE_MANUALLY @@ -478,8 +484,8 @@ void AnycubicTFTClass::RenderCurrentFolder(uint16_t selectedNumber) { for (cnt = selectedNumber; cnt <= max_files; cnt++) { if (cnt == 0) { // Special Entry if (currentFileList.isAtRootDir()) { - SENDLINE_PGM(""); - SENDLINE_PGM(""); + SENDLINE_PGM("")); } else { SENDLINE_PGM("/..");