Browse Source

🔧 CONFIGURE_FILAMENT_CHANGE - Optional M603 (#26613)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
plampix 1 year ago
parent
commit
6d407767e7

+ 2 - 2
Marlin/Configuration.h

@@ -2054,7 +2054,7 @@
 /**
  * Enable detailed logging of G28, G29, M48, etc.
  * Turn on with the command 'M111 S32'.
- * NOTE: Requires a lot of PROGMEM!
+ * NOTE: Requires a lot of flash!
  */
 //#define DEBUG_LEVELING_FEATURE
 
@@ -2343,7 +2343,7 @@
  */
 //#define EEPROM_SETTINGS     // Persistent storage with M500 and M501
 //#define DISABLE_M503        // Saves ~2700 bytes of flash. Disable for release!
-#define EEPROM_CHITCHAT       // Give feedback on EEPROM commands. Disable to save PROGMEM.
+#define EEPROM_CHITCHAT       // Give feedback on EEPROM commands. Disable to save flash.
 #define EEPROM_BOOT_SILENT    // Keep M503 quiet and only give errors during first load
 #if ENABLED(EEPROM_SETTINGS)
   //#define EEPROM_AUTO_INIT  // Init EEPROM automatically on any errors.

+ 2 - 1
Marlin/Configuration_adv.h

@@ -1342,7 +1342,7 @@
   #define CALIBRATION_NOZZLE_TIP_HEIGHT          1.0  // mm
   #define CALIBRATION_NOZZLE_OUTER_DIAMETER      2.0  // mm
 
-  // Uncomment to enable reporting (required for "G425 V", but consumes PROGMEM).
+  // Uncomment to enable reporting (required for "G425 V", but consumes flash).
   //#define CALIBRATION_REPORTING
 
   // The true location and dimension the cube/bolt/washer on the bed.
@@ -2929,6 +2929,7 @@
 
   //#define FILAMENT_LOAD_UNLOAD_GCODES           // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
   //#define FILAMENT_UNLOAD_ALL_EXTRUDERS         // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
+  #define CONFIGURE_FILAMENT_CHANGE               // Add M603 G-code and menu items. Requires ~1.3K bytes of flash.
 #endif
 
 // @section tmc_smart

+ 1 - 1
Marlin/src/feature/max7219.cpp

@@ -39,7 +39,7 @@
 
 #if ENABLED(MAX7219_DEBUG)
 
-#define MAX7219_ERRORS // Disable to save 406 bytes of Program Memory
+#define MAX7219_ERRORS // Requires ~400 bytes of flash
 
 #include "max7219.h"
 

+ 3 - 1
Marlin/src/feature/pause.cpp

@@ -89,7 +89,9 @@ static xyze_pos_t resume_position;
   PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;
 #endif
 
-fil_change_settings_t fc_settings[EXTRUDERS];
+#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
+  fil_change_settings_t fc_settings[EXTRUDERS];
+#endif
 
 #if HAS_MEDIA
   #include "../sd/cardreader.h"

+ 14 - 5
Marlin/src/feature/pause.h

@@ -26,10 +26,6 @@
  * This may be combined with related G-codes if features are consolidated.
  */
 
-typedef struct {
-  float unload_length, load_length;
-} fil_change_settings_t;
-
 #include "../inc/MarlinConfigPre.h"
 
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
@@ -69,7 +65,20 @@ enum PauseMessage : char {
   extern PauseMode pause_mode;
 #endif
 
-extern fil_change_settings_t fc_settings[EXTRUDERS];
+typedef struct FilamentChangeSettings {
+  #if ENABLED(CONFIGURE_FILAMENT_CHANGE)
+    float load_length, unload_length;
+  #else
+    static constexpr float load_length = FILAMENT_CHANGE_FAST_LOAD_LENGTH,
+                           unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH;
+  #endif
+} fil_change_settings_t;
+
+#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
+  extern fil_change_settings_t fc_settings[EXTRUDERS];
+#else
+  constexpr fil_change_settings_t fc_settings[EXTRUDERS];
+#endif
 
 extern uint8_t did_pause_print;
 

+ 3 - 3
Marlin/src/gcode/feature/pause/M603.cpp

@@ -20,9 +20,9 @@
  *
  */
 
-#include "../../../inc/MarlinConfig.h"
+#include "../../../inc/MarlinConfigPre.h"
 
-#if ENABLED(ADVANCED_PAUSE_FEATURE)
+#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
 
 #include "../../gcode.h"
 #include "../../../feature/pause.h"
@@ -80,4 +80,4 @@ void GcodeSuite::M603_report(const bool forReplay/*=true*/) {
   #endif
 }
 
-#endif // ADVANCED_PAUSE_FEATURE
+#endif // CONFIGURE_FILAMENT_CHANGE

+ 3 - 1
Marlin/src/gcode/gcode.cpp

@@ -948,7 +948,9 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
 
       #if ENABLED(ADVANCED_PAUSE_FEATURE)
         case 600: M600(); break;                                  // M600: Pause for Filament Change
-        case 603: M603(); break;                                  // M603: Configure Filament Change
+        #if ENABLED(CONFIGURE_FILAMENT_CHANGE)
+          case 603: M603(); break;                                  // M603: Configure Filament Change
+        #endif
       #endif
 
       #if HAS_DUPLICATION_MODE

+ 2 - 2
Marlin/src/lcd/e3v2/jyersui/dwin.cpp

@@ -2910,7 +2910,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
             break;
         #endif
 
-        #if ENABLED(ADVANCED_PAUSE_FEATURE)
+        #if ENABLED(CONFIGURE_FILAMENT_CHANGE)
           case ADVANCED_LOAD:
             if (draw) {
               drawMenuItem(row, ICON_WriteEEPROM, F("Load Length"));
@@ -2927,7 +2927,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
             else
               modifyValue(fc_settings[0].unload_length, 0, EXTRUDE_MAXLENGTH, 1);
             break;
-        #endif // ADVANCED_PAUSE_FEATURE
+        #endif // CONFIGURE_FILAMENT_CHANGE
 
         #if ENABLED(PREVENT_COLD_EXTRUSION)
           case ADVANCED_COLD_EXTRUDE:

+ 1 - 1
Marlin/src/lcd/e3v2/proui/dwin.cpp

@@ -3302,7 +3302,7 @@ void drawFilSetMenu() {
     #if ENABLED(PREVENT_COLD_EXTRUSION)
       EDIT_ITEM(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, setExtMinT, &hmiData.extMinT);
     #endif
-    #if ENABLED(ADVANCED_PAUSE_FEATURE)
+    #if ENABLED(CONFIGURE_FILAMENT_CHANGE)
       EDIT_ITEM(ICON_FilLoad, MSG_FILAMENT_LOAD, onDrawPFloatMenu, setFilLoad, &fc_settings[0].load_length);
       EDIT_ITEM(ICON_FilUnload, MSG_FILAMENT_UNLOAD, onDrawPFloatMenu, setFilUnload, &fc_settings[0].unload_length);
     #endif

+ 1 - 1
Marlin/src/lcd/extui/nextion/nextion_tft.cpp

@@ -323,7 +323,7 @@ void NextionTFT::panelInfo(uint8_t req) {
     SEND_PRINT_INFO("t8", getFilamentUsed_str);
     break;
 
-  case 28: // Filament laod/unload
+  case 28: // Filament load/unload
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
       #define SEND_PAUSE_INFO(A, B) SEND_VALasTXT(A, fc_settings[getActiveTool()].B)
     #else

Some files were not shown because too many files changed in this diff