🔧 CONFIGURE_FILAMENT_CHANGE - Optional M603 (#26613)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
plampix 2024-01-03 16:43:18 +01:00 committed by GitHub
parent 4a9e102c2e
commit 6d407767e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 42 additions and 32 deletions

View file

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

View file

@ -1342,7 +1342,7 @@
#define CALIBRATION_NOZZLE_TIP_HEIGHT 1.0 // mm #define CALIBRATION_NOZZLE_TIP_HEIGHT 1.0 // mm
#define CALIBRATION_NOZZLE_OUTER_DIAMETER 2.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 //#define CALIBRATION_REPORTING
// The true location and dimension the cube/bolt/washer on the bed. // 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_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 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 #endif
// @section tmc_smart // @section tmc_smart

View file

@ -39,7 +39,7 @@
#if ENABLED(MAX7219_DEBUG) #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" #include "max7219.h"

View file

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

View file

@ -26,10 +26,6 @@
* This may be combined with related G-codes if features are consolidated. * 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" #include "../inc/MarlinConfigPre.h"
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
@ -69,7 +65,20 @@ enum PauseMessage : char {
extern PauseMode pause_mode; extern PauseMode pause_mode;
#endif #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; extern uint8_t did_pause_print;

View file

@ -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 "../../gcode.h"
#include "../../../feature/pause.h" #include "../../../feature/pause.h"
@ -80,4 +80,4 @@ void GcodeSuite::M603_report(const bool forReplay/*=true*/) {
#endif #endif
} }
#endif // ADVANCED_PAUSE_FEATURE #endif // CONFIGURE_FILAMENT_CHANGE

View file

@ -948,7 +948,9 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
case 600: M600(); break; // M600: Pause for Filament Change 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 #endif
#if HAS_DUPLICATION_MODE #if HAS_DUPLICATION_MODE

View file

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

View file

@ -3302,7 +3302,7 @@ void drawFilSetMenu() {
#if ENABLED(PREVENT_COLD_EXTRUSION) #if ENABLED(PREVENT_COLD_EXTRUSION)
EDIT_ITEM(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, setExtMinT, &hmiData.extMinT); EDIT_ITEM(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, setExtMinT, &hmiData.extMinT);
#endif #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_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); EDIT_ITEM(ICON_FilUnload, MSG_FILAMENT_UNLOAD, onDrawPFloatMenu, setFilUnload, &fc_settings[0].unload_length);
#endif #endif

View file

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

View file

@ -136,7 +136,7 @@ void menu_backlash();
} }
#endif #endif
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(CONFIGURE_FILAMENT_CHANGE)
constexpr float extrude_maxlength = TERN(PREVENT_LENGTHY_EXTRUDE, EXTRUDE_MAXLENGTH, 999); constexpr float extrude_maxlength = TERN(PREVENT_LENGTHY_EXTRUDE, EXTRUDE_MAXLENGTH, 999);
EDIT_ITEM_FAST(float4, MSG_FILAMENT_UNLOAD, &fc_settings[active_extruder].unload_length, 0, extrude_maxlength); EDIT_ITEM_FAST(float4, MSG_FILAMENT_UNLOAD, &fc_settings[active_extruder].unload_length, 0, extrude_maxlength);

View file

@ -36,7 +36,7 @@
*/ */
// Change EEPROM version if the structure changes // Change EEPROM version if the structure changes
#define EEPROM_VERSION "V89" #define EEPROM_VERSION "V90"
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
// Check the integrity of data offsets. // Check the integrity of data offsets.
@ -508,7 +508,7 @@ typedef struct SettingsDataStruct {
// //
// ADVANCED_PAUSE_FEATURE // ADVANCED_PAUSE_FEATURE
// //
#if HAS_EXTRUDERS #if ENABLED(CONFIGURE_FILAMENT_CHANGE)
fil_change_settings_t fc_settings[EXTRUDERS]; // M603 T U L fil_change_settings_t fc_settings[EXTRUDERS]; // M603 T U L
#endif #endif
@ -1551,11 +1551,8 @@ void MarlinSettings::postprocess() {
// //
// Advanced Pause filament load & unload lengths // Advanced Pause filament load & unload lengths
// //
#if HAS_EXTRUDERS #if ENABLED(CONFIGURE_FILAMENT_CHANGE)
{ {
#if DISABLED(ADVANCED_PAUSE_FEATURE)
const fil_change_settings_t fc_settings[EXTRUDERS] = { 0, 0 };
#endif
_FIELD_TEST(fc_settings); _FIELD_TEST(fc_settings);
EEPROM_WRITE(fc_settings); EEPROM_WRITE(fc_settings);
} }
@ -2626,11 +2623,8 @@ void MarlinSettings::postprocess() {
// //
// Advanced Pause filament load & unload lengths // Advanced Pause filament load & unload lengths
// //
#if HAS_EXTRUDERS #if ENABLED(CONFIGURE_FILAMENT_CHANGE)
{ {
#if DISABLED(ADVANCED_PAUSE_FEATURE)
fil_change_settings_t fc_settings[EXTRUDERS];
#endif
_FIELD_TEST(fc_settings); _FIELD_TEST(fc_settings);
EEPROM_READ(fc_settings); EEPROM_READ(fc_settings);
} }
@ -3549,7 +3543,7 @@ void MarlinSettings::reset() {
// //
// Advanced Pause filament load & unload lengths // Advanced Pause filament load & unload lengths
// //
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(CONFIGURE_FILAMENT_CHANGE)
EXTRUDER_LOOP() { EXTRUDER_LOOP() {
fc_settings[e].unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH; fc_settings[e].unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH;
fc_settings[e].load_length = FILAMENT_CHANGE_FAST_LOAD_LENGTH; fc_settings[e].load_length = FILAMENT_CHANGE_FAST_LOAD_LENGTH;
@ -3924,7 +3918,7 @@ void MarlinSettings::reset() {
// //
// Advanced Pause filament load & unload lengths // Advanced Pause filament load & unload lengths
// //
TERN_(ADVANCED_PAUSE_FEATURE, gcode.M603_report(forReplay)); TERN_(CONFIGURE_FILAMENT_CHANGE, gcode.M603_report(forReplay));
// //
// Tool-changing Parameters // Tool-changing Parameters

View file

@ -18,6 +18,7 @@ opt_set E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 NEOPIXEL_
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER BLTOUCH NEOPIXEL_LED Z_SAFE_HOMING NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE \ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER BLTOUCH NEOPIXEL_LED Z_SAFE_HOMING NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE \
FILAMENT_RUNOUT_SENSOR FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP FILAMENT_CHANGE_RESUME_ON_INSERT PAUSE_REHEAT_FAST_RESUME \ FILAMENT_RUNOUT_SENSOR FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP FILAMENT_CHANGE_RESUME_ON_INSERT PAUSE_REHEAT_FAST_RESUME \
LCD_BED_TRAMMING BED_TRAMMING_USE_PROBE LCD_BED_TRAMMING BED_TRAMMING_USE_PROBE
opt_disable CONFIGURE_FILAMENT_CHANGE
exec_test $1 $2 "BigTreeTech GTR | 8 Extruders | Auto-Fan | Mixed TMC Drivers | Runout Sensors w/ distinct states" "$3" exec_test $1 $2 "BigTreeTech GTR | 8 Extruders | Auto-Fan | Mixed TMC Drivers | Runout Sensors w/ distinct states" "$3"
restore_configs restore_configs

View file

@ -259,7 +259,8 @@ MIXING_EXTRUDER = build_src_filter=+<src/feature/mixing.c
HAS_PRUSA_MMU1 = build_src_filter=+<src/feature/mmu/mmu.cpp> HAS_PRUSA_MMU1 = build_src_filter=+<src/feature/mmu/mmu.cpp>
HAS_PRUSA_MMU2 = build_src_filter=+<src/feature/mmu/mmu2.cpp> +<src/gcode/feature/prusa_MMU2> HAS_PRUSA_MMU2 = build_src_filter=+<src/feature/mmu/mmu2.cpp> +<src/gcode/feature/prusa_MMU2>
PASSWORD_FEATURE = build_src_filter=+<src/feature/password> +<src/gcode/feature/password> PASSWORD_FEATURE = build_src_filter=+<src/feature/password> +<src/gcode/feature/password>
ADVANCED_PAUSE_FEATURE = build_src_filter=+<src/feature/pause.cpp> +<src/gcode/feature/pause/M600.cpp> +<src/gcode/feature/pause/M603.cpp> ADVANCED_PAUSE_FEATURE = build_src_filter=+<src/feature/pause.cpp> +<src/gcode/feature/pause/M600.cpp>
CONFIGURE_FILAMENT_CHANGE = build_src_filter=+<src/gcode/feature/pause/M603.cpp>
PSU_CONTROL = build_src_filter=+<src/feature/power.cpp> PSU_CONTROL = build_src_filter=+<src/feature/power.cpp>
HAS_POWER_MONITOR = build_src_filter=+<src/feature/power_monitor.cpp> +<src/gcode/feature/power_monitor> HAS_POWER_MONITOR = build_src_filter=+<src/feature/power_monitor.cpp> +<src/gcode/feature/power_monitor>
POWER_LOSS_RECOVERY = build_src_filter=+<src/feature/powerloss.cpp> +<src/gcode/feature/powerloss> POWER_LOSS_RECOVERY = build_src_filter=+<src/feature/powerloss.cpp> +<src/gcode/feature/powerloss>