Skip to content

Commit 6d40776

Browse files
plampixthinkyhead
andauthored
🔧 CONFIGURE_FILAMENT_CHANGE - Optional M603 (MarlinFirmware#26613)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent 4a9e102 commit 6d40776

File tree

14 files changed

+42
-32
lines changed

14 files changed

+42
-32
lines changed

Marlin/Configuration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,7 +2054,7 @@
20542054
/**
20552055
* Enable detailed logging of G28, G29, M48, etc.
20562056
* Turn on with the command 'M111 S32'.
2057-
* NOTE: Requires a lot of PROGMEM!
2057+
* NOTE: Requires a lot of flash!
20582058
*/
20592059
//#define DEBUG_LEVELING_FEATURE
20602060

@@ -2343,7 +2343,7 @@
23432343
*/
23442344
//#define EEPROM_SETTINGS // Persistent storage with M500 and M501
23452345
//#define DISABLE_M503 // Saves ~2700 bytes of flash. Disable for release!
2346-
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
2346+
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save flash.
23472347
#define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load
23482348
#if ENABLED(EEPROM_SETTINGS)
23492349
//#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.

Marlin/Configuration_adv.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@
13421342
#define CALIBRATION_NOZZLE_TIP_HEIGHT 1.0 // mm
13431343
#define CALIBRATION_NOZZLE_OUTER_DIAMETER 2.0 // mm
13441344

1345-
// Uncomment to enable reporting (required for "G425 V", but consumes PROGMEM).
1345+
// Uncomment to enable reporting (required for "G425 V", but consumes flash).
13461346
//#define CALIBRATION_REPORTING
13471347

13481348
// The true location and dimension the cube/bolt/washer on the bed.
@@ -2929,6 +2929,7 @@
29292929

29302930
//#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
29312931
//#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
2932+
#define CONFIGURE_FILAMENT_CHANGE // Add M603 G-code and menu items. Requires ~1.3K bytes of flash.
29322933
#endif
29332934

29342935
// @section tmc_smart

Marlin/src/feature/max7219.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
#if ENABLED(MAX7219_DEBUG)
4141

42-
#define MAX7219_ERRORS // Disable to save 406 bytes of Program Memory
42+
#define MAX7219_ERRORS // Requires ~400 bytes of flash
4343

4444
#include "max7219.h"
4545

Marlin/src/feature/pause.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ static xyze_pos_t resume_position;
8989
PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;
9090
#endif
9191

92-
fil_change_settings_t fc_settings[EXTRUDERS];
92+
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
93+
fil_change_settings_t fc_settings[EXTRUDERS];
94+
#endif
9395

9496
#if HAS_MEDIA
9597
#include "../sd/cardreader.h"

Marlin/src/feature/pause.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
* This may be combined with related G-codes if features are consolidated.
2727
*/
2828

29-
typedef struct {
30-
float unload_length, load_length;
31-
} fil_change_settings_t;
32-
3329
#include "../inc/MarlinConfigPre.h"
3430

3531
#if ENABLED(ADVANCED_PAUSE_FEATURE)
@@ -69,7 +65,20 @@ enum PauseMessage : char {
6965
extern PauseMode pause_mode;
7066
#endif
7167

72-
extern fil_change_settings_t fc_settings[EXTRUDERS];
68+
typedef struct FilamentChangeSettings {
69+
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
70+
float load_length, unload_length;
71+
#else
72+
static constexpr float load_length = FILAMENT_CHANGE_FAST_LOAD_LENGTH,
73+
unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH;
74+
#endif
75+
} fil_change_settings_t;
76+
77+
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
78+
extern fil_change_settings_t fc_settings[EXTRUDERS];
79+
#else
80+
constexpr fil_change_settings_t fc_settings[EXTRUDERS];
81+
#endif
7382

7483
extern uint8_t did_pause_print;
7584

Marlin/src/gcode/feature/pause/M603.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
*
2121
*/
2222

23-
#include "../../../inc/MarlinConfig.h"
23+
#include "../../../inc/MarlinConfigPre.h"
2424

25-
#if ENABLED(ADVANCED_PAUSE_FEATURE)
25+
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
2626

2727
#include "../../gcode.h"
2828
#include "../../../feature/pause.h"
@@ -80,4 +80,4 @@ void GcodeSuite::M603_report(const bool forReplay/*=true*/) {
8080
#endif
8181
}
8282

83-
#endif // ADVANCED_PAUSE_FEATURE
83+
#endif // CONFIGURE_FILAMENT_CHANGE

Marlin/src/gcode/gcode.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,9 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
948948

949949
#if ENABLED(ADVANCED_PAUSE_FEATURE)
950950
case 600: M600(); break; // M600: Pause for Filament Change
951-
case 603: M603(); break; // M603: Configure Filament Change
951+
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
952+
case 603: M603(); break; // M603: Configure Filament Change
953+
#endif
952954
#endif
953955

954956
#if HAS_DUPLICATION_MODE

Marlin/src/lcd/e3v2/jyersui/dwin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,7 +2910,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
29102910
break;
29112911
#endif
29122912

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

29322932
#if ENABLED(PREVENT_COLD_EXTRUSION)
29332933
case ADVANCED_COLD_EXTRUDE:

Marlin/src/lcd/e3v2/proui/dwin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3302,7 +3302,7 @@ void drawFilSetMenu() {
33023302
#if ENABLED(PREVENT_COLD_EXTRUSION)
33033303
EDIT_ITEM(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, setExtMinT, &hmiData.extMinT);
33043304
#endif
3305-
#if ENABLED(ADVANCED_PAUSE_FEATURE)
3305+
#if ENABLED(CONFIGURE_FILAMENT_CHANGE)
33063306
EDIT_ITEM(ICON_FilLoad, MSG_FILAMENT_LOAD, onDrawPFloatMenu, setFilLoad, &fc_settings[0].load_length);
33073307
EDIT_ITEM(ICON_FilUnload, MSG_FILAMENT_UNLOAD, onDrawPFloatMenu, setFilUnload, &fc_settings[0].unload_length);
33083308
#endif

Marlin/src/lcd/extui/nextion/nextion_tft.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ void NextionTFT::panelInfo(uint8_t req) {
323323
SEND_PRINT_INFO("t8", getFilamentUsed_str);
324324
break;
325325

326-
case 28: // Filament laod/unload
326+
case 28: // Filament load/unload
327327
#if ENABLED(ADVANCED_PAUSE_FEATURE)
328328
#define SEND_PAUSE_INFO(A, B) SEND_VALasTXT(A, fc_settings[getActiveTool()].B)
329329
#else

0 commit comments

Comments
 (0)