Ver código fonte

✨ Anycubic i3 Mega LCD file menu fix (#24752)

Stefan Kalscheuer 2 anos atrás
pai
commit
06d7d2ada4
Nenhuma conta vinculada ao e-mail do autor do commit

+ 1
- 0
Marlin/Configuration.h Ver arquivo

@@ -2989,6 +2989,7 @@
2989 2989
 //#define ANYCUBIC_LCD_CHIRON
2990 2990
 #if EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
2991 2991
   //#define ANYCUBIC_LCD_DEBUG
2992
+  //#define ANYCUBIC_LCD_GCODE_EXT  // Add ".gcode" to menu entries for DGUS clone compatibility
2992 2993
 #endif
2993 2994
 
2994 2995
 //

+ 50
- 44
Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp Ver arquivo

@@ -46,6 +46,12 @@
46 46
   #define SENDLINE_DBG_PGM_VAL(x,y,z) sendLine_P(PSTR(x))
47 47
 #endif
48 48
 
49
+// Append ".gcode" to filename, if requested. Used for some DGUS-clone displays with built-in filter.
50
+// Filenames are limited to 26 characters, so the actual name for the FILENAME can be 20 characters at most.
51
+// If a longer string is desired without "extension, use the ALTNAME macro to provide a (longer) alternative.
52
+#define SPECIAL_MENU_FILENAME(A) A TERN_(ANYCUBIC_LCD_GCODE_EXT, ".gcode")
53
+#define SPECIAL_MENU_ALTNAME(A, B) TERN(ANYCUBIC_LCD_GCODE_EXT, A ".gcode", B)
54
+
49 55
 AnycubicTFTClass AnycubicTFT;
50 56
 
51 57
 char AnycubicTFTClass::TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
@@ -383,8 +389,8 @@ void AnycubicTFTClass::RenderCurrentFileList() {
383 389
     if (!isMediaInserted() && !SpecialMenu) {
384 390
       SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02");
385 391
 
386
-      SENDLINE_PGM("<Special_Menu>");
387
-      SENDLINE_PGM("<Special_Menu>");
392
+      SENDLINE_PGM("<SPECI~1.GCO");
393
+      SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Special Menu>"));
388 394
     }
389 395
     else {
390 396
       if (CodeSeen('S'))
@@ -403,58 +409,58 @@ void AnycubicTFTClass::RenderSpecialMenu(uint16_t selectedNumber) {
403 409
   switch (selectedNumber) {
404 410
     #if ENABLED(PROBE_MANUALLY)
405 411
       case 0: // First Page
406
-        SENDLINE_PGM("<01ZUp0.1>");
407
-        SENDLINE_PGM("<Z Up 0.1>");
408
-        SENDLINE_PGM("<02ZUp0.02>");
409
-        SENDLINE_PGM("<Z Up 0.02>");
410
-        SENDLINE_PGM("<03ZDn0.02>");
411
-        SENDLINE_PGM("<Z Down 0.02>");
412
-        SENDLINE_PGM("<04ZDn0.1>");
413
-        SENDLINE_PGM("<Z Down 0.1>");
412
+        SENDLINE_PGM("<01ZUP~1.GCO");
413
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Z Up 0.1>"));
414
+        SENDLINE_PGM("<02ZUP~1.GCO");
415
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Z Up 0.02>"));
416
+        SENDLINE_PGM("<03ZDO~1.GCO");
417
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Z Down 0.02>"));
418
+        SENDLINE_PGM("<04ZDO~1.GCO");
419
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Z Down 0.1>"));
414 420
         break;
415 421
 
416 422
       case 4: // Second Page
417
-        SENDLINE_PGM("<05PrehtBed>");
418
-        SENDLINE_PGM("<Preheat bed>");
419
-        SENDLINE_PGM("<06SMeshLvl>");
420
-        SENDLINE_PGM("<Start Mesh Leveling>");
421
-        SENDLINE_PGM("<07MeshNPnt>");
422
-        SENDLINE_PGM("<Next Mesh Point>");
423
-        SENDLINE_PGM("<08HtEndPID>");
424
-        SENDLINE_PGM("<Auto Tune Hotend PID>");
423
+        SENDLINE_PGM("<05PRE~1.GCO");
424
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Preheat Bed>"));
425
+        SENDLINE_PGM("<06MES~1.GCO");
426
+        SENDLINE_PGM(SPECIAL_MENU_ALTNAME("<Mesh Leveling>", "<Start Mesh Leveling>"));
427
+        SENDLINE_PGM("<07NEX~1.GCO");
428
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Next Mesh Point>"));
429
+        SENDLINE_PGM("<08PID~1.GCO");
430
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<PID Tune Hotend>"));
425 431
         break;
426 432
 
427 433
       case 8: // Third Page
428
-        SENDLINE_PGM("<09HtBedPID>");
429
-        SENDLINE_PGM("<Auto Tune Hotbed PID>");
430
-        SENDLINE_PGM("<10FWDeflts>");
431
-        SENDLINE_PGM("<Load FW Defaults>");
432
-        SENDLINE_PGM("<11SvEEPROM>");
433
-        SENDLINE_PGM("<Save EEPROM>");
434
-        SENDLINE_PGM("<Exit>");
435
-        SENDLINE_PGM("<Exit>");
434
+        SENDLINE_PGM("<09PID~1.GCO");
435
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<PID Tune Hotbed>"));
436
+        SENDLINE_PGM("<10FWD~1.GCO");
437
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Load FW Defaults>"));
438
+        SENDLINE_PGM("<11SAV~1.GCO");
439
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Save EEPROM>"));
440
+        SENDLINE_PGM("<EXIT_~1.GCO");
441
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Exit>"));
436 442
         break;
437 443
     #else
438 444
       case 0: // First Page
439
-        SENDLINE_PGM("<01PrehtBed>");
440
-        SENDLINE_PGM("<Preheat bed>");
441
-        SENDLINE_PGM("<02ABL>");
442
-        SENDLINE_PGM("<Auto Bed Leveling>");
443
-        SENDLINE_PGM("<03HtEndPID>");
444
-        SENDLINE_PGM("<Auto Tune Hotend PID>");
445
-        SENDLINE_PGM("<04HtBedPID>");
446
-        SENDLINE_PGM("<Auto Tune Hotbed PID>");
445
+        SENDLINE_PGM("<01PRE~1.GCO");
446
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Preheat Bed>"));
447
+        SENDLINE_PGM("<02ABL~1.GCO");
448
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Auto Bed Leveling>"));
449
+        SENDLINE_PGM("<03PID~1.GCO");
450
+        SENDLINE_PGM(SPECIAL_MENU_ALTNAME("<PID Tune Hotend>", "<Auto Tune Hotend PID>"));
451
+        SENDLINE_PGM("<04PID~1.GCO");
452
+        SENDLINE_PGM(SPECIAL_MENU_ALTNAME("<PID Tune Hotbed>", "<Auto Tune Hotbed PID>"));
447 453
         break;
448 454
 
449 455
       case 4: // Second Page
450
-        SENDLINE_PGM("<05FWDeflts>");
451
-        SENDLINE_PGM("<Load FW Defaults>");
452
-        SENDLINE_PGM("<06SvEEPROM>");
453
-        SENDLINE_PGM("<Save EEPROM>");
454
-        SENDLINE_PGM("<07SendM108>");
455
-        SENDLINE_PGM("<Send User Confirmation>");
456
-        SENDLINE_PGM("<Exit>");
457
-        SENDLINE_PGM("<Exit>");
456
+        SENDLINE_PGM("<05FWD~1.GCO");
457
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Load FW Defaults>"));
458
+        SENDLINE_PGM("<06SAV~1.GCO");
459
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Save EEPROM>"));
460
+        SENDLINE_PGM("<06SEN~1.GCO");
461
+        SENDLINE_PGM(SPECIAL_MENU_ALTNAME("<User Confirmation>", "<Send User Confirmation>"));
462
+        SENDLINE_PGM("<EXIT_~1.GCO");
463
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Exit>"));
458 464
         break;
459 465
 
460 466
         #endif // PROBE_MANUALLY
@@ -478,8 +484,8 @@ void AnycubicTFTClass::RenderCurrentFolder(uint16_t selectedNumber) {
478 484
   for (cnt = selectedNumber; cnt <= max_files; cnt++) {
479 485
     if (cnt == 0) { // Special Entry
480 486
       if (currentFileList.isAtRootDir()) {
481
-        SENDLINE_PGM("<specialmnu>");
482
-        SENDLINE_PGM("<Special Menu>");
487
+        SENDLINE_PGM("<SPECI~1.GCO");
488
+        SENDLINE_PGM(SPECIAL_MENU_FILENAME("<Special Menu>"));
483 489
       }
484 490
       else {
485 491
         SENDLINE_PGM("/..");

Carregando…
Cancelar
Salvar