Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2ea23c9
Update Configuration.h Thermal Settings
DLMCW Jan 21, 2025
151cda1
Update Configuration_adv.h HAC
DLMCW Jan 21, 2025
9e716b6
Update Configuration_adv.h Enable Emergency Parser
DLMCW Feb 13, 2025
bb4d4d3
Update Configuration.h bed leveling
DLMCW Feb 21, 2025
a511336
Update Configuration_adv.h enable babystepping
DLMCW Feb 21, 2025
448f5fb
Update Configuration_adv.h stall sensitivity
DLMCW Feb 21, 2025
2cfe6f6
Merge pull request #1 from DLMCW/DLMCW-bed-leveling
DLMCW Feb 26, 2025
d8b339f
Edit src filters in platform.ini and edit text case in other files to…
DLMCW Mar 4, 2025
c2f05a0
Update Configuration.h disable leveling
DLMCW Mar 13, 2025
aa4a243
Update Configuration_adv.h disable s-curve accel
DLMCW Mar 13, 2025
97e2adf
Update Configuration.h
DLMCW Mar 13, 2025
b1ee046
Update Configuration_adv.h
DLMCW Mar 13, 2025
d79da73
Update platformio.ini
DLMCW Mar 13, 2025
06f5b5e
Update Version.h build version
DLMCW Mar 13, 2025
24c591b
Update Configuration_adv.h
DLMCW Mar 16, 2025
fb0eb8a
Update Configuration_adv.h TX/RX Buffer
DLMCW Mar 22, 2025
89667dc
Enable runout sensors for Octoprint.
DLMCW Mar 26, 2025
e0dbdad
prevent duplicate prompts, duplicate pause, and enable park on pause.
DLMCW Mar 27, 2025
93cbac9
add e_parser code to queue.cpp
DLMCW Mar 29, 2025
9b7e712
standardized runout handling
DLMCW Mar 29, 2025
55c70ad
bug fix
DLMCW Mar 31, 2025
959a66c
Merge pull request #2 from DLMCW/runout-for-octo
DLMCW Mar 31, 2025
d50ed6c
Restore Snapmaker defaults.
DLMCW Mar 31, 2025
4148e70
Added pre-compiled bin in release folder
DLMCW Mar 31, 2025
a46a6e1
Enabled M2000 S200 for Octoprint
DLMCW Apr 1, 2025
7fe292c
Restore Snapmaker defaults.
DLMCW Mar 31, 2025
158af50
Added pre-compiled bin in release folder
DLMCW Mar 31, 2025
10a0124
Enabled M2000 S200 for Octoprint
DLMCW Apr 1, 2025
e7bb45a
Added pre-compiled bin in release folder
DLMCW Mar 31, 2025
3fa59bd
Revert "Restore Snapmaker defaults."
DLMCW Apr 1, 2025
e8fedd0
M2000 S200 fix
DLMCW Apr 2, 2025
d4477fa
Created independant nozzle_park_point for each extruder. Bug fix for …
DLMCW Apr 3, 2025
b902224
M2000 soft endstops fix
DLMCW Apr 4, 2025
effc487
increase x_max_pos to 338.5 and quiet terminal spam
DLMCW Apr 13, 2025
92d5874
Merge branch 'main' into runout-for-octo
DLMCW Apr 13, 2025
85825ed
Merge pull request #4 from DLMCW/runout-for-octo
DLMCW Apr 13, 2025
cc28071
Remove double sensor check in idle loop. revert err mask to 8 bits in…
DLMCW Jul 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 38 additions & 22 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@
* The probe replaces the Z-MIN endstop and is used for Z homing.
* (Automatically enables USE_PROBE_FOR_Z_HOMING.)
*/
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
//#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN

// Force the use of the probe for Z-axis homing
//#define USE_PROBE_FOR_Z_HOMING
Expand Down Expand Up @@ -1364,7 +1364,7 @@
#define X_MIN_POS ((X_BED_SIZE / 2) - BAD_CENTER_X_POS)
#define Y_MIN_POS ((Y_BED_SIZE / 2) - BAD_CENTER_Y_POS)
#define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE
#define X_MAX_POS 338.5
#define Y_MAX_POS Y_BED_SIZE
#define Z_MAX_POS 215
//#define I_MIN_POS 0
Expand Down Expand Up @@ -1424,13 +1424,30 @@
* RAMPS-based boards use SERVO3_PIN for the first runout sensor.
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
*/
//#define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.

#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
#define FILAMENT_RUNOUT_SENSOR

#define CUSTOM_FILAMENT_SENSOR // Snapmaker J1 custom ADC filament runout sensors.

#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
#define NUM_RUNOUT_SENSORS 2 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.


// Not used when CUSTOM_FILAMENT_SENSOR enabled, but must be defined.
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN -1 // Dummy pin for custom ADC sensor
#endif
#ifndef FIL_RUNOUT2_PIN
#define FIL_RUNOUT2_PIN -1 // Dummy pin for custom ADC sensor
#endif
#define FIL_RUNOUT_STATE HIGH // Placeholder state (unused with -1 pins)
#define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE
#define FIL_RUNOUT2_STATE FIL_RUNOUT_STATE
#endif


//#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
//#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
//#define WATCH_ALL_RUNOUT_SENSORS // Execute runout script on any triggering sensor, not only for the active extruder.
// This is automatically enabled for MIXING_EXTRUDERs.
Expand Down Expand Up @@ -1484,7 +1501,7 @@
// large enough to avoid false positives.)
//#define FILAMENT_MOTION_SENSOR
#endif
#endif


//===========================================================================
//=============================== Bed Leveling ==============================
Expand Down Expand Up @@ -1543,8 +1560,8 @@
*/
//#define PREHEAT_BEFORE_LEVELING
#if ENABLED(PREHEAT_BEFORE_LEVELING)
#define LEVELING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time
#define LEVELING_BED_TEMP 50
#define LEVELING_NOZZLE_TEMP 200 // (°C) Only applies to E0 at this time
#define LEVELING_BED_TEMP 100
#endif

/**
Expand Down Expand Up @@ -1593,8 +1610,8 @@
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)

// Set the number of grid points per dimension.
#define GRID_MAX_POINTS_X 3
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
#define GRID_MAX_POINTS_X 5
#define GRID_MAX_POINTS_Y 3

// Probe along the Y axis, advancing X after each column
//#define PROBE_Y_FIRST
Expand Down Expand Up @@ -1876,16 +1893,15 @@
* P1 Raise the nozzle always to Z-park height.
* P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS.
*/
//#define NOZZLE_PARK_FEATURE
#define NOZZLE_PARK_FEATURE

#if ENABLED(NOZZLE_PARK_FEATURE)
// Specify a park position as { X, Y, Z_raise }
#define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 }
//#define NOZZLE_PARK_X_ONLY // X move only is required to park
//#define NOZZLE_PARK_Y_ONLY // Y move only is required to park
// Define park positions as separate { X, Y, Z_raise } for each extruder
#define NOZZLE_PARK_POINT_T0 { -6, Y_MIN_POS, 20 } /* T0: park position */
#define NOZZLE_PARK_POINT_T1 { 331, Y_MIN_POS, 20 } /* T1: park position */
#define NOZZLE_PARK_Z_RAISE_MIN 2 // (mm) Always raise Z by at least this distance
#define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis)
#define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers)
#define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate
#define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate
#endif

/**
Expand Down Expand Up @@ -2908,4 +2924,4 @@
*
*/
#define DEBUG_IO PD0
#define DEBUG_ISR_CPU_USAGE
#define DEBUG_ISR_CPU_USAGE
40 changes: 20 additions & 20 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
* Thermal Protection parameters for the heated chamber.
*/
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
#define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_CHAMBER_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius

/**
Expand Down Expand Up @@ -945,7 +945,7 @@
* Set DISABLE_INACTIVE_? 'true' to shut down axis steppers after an idle period.
* The Deactive Time can be overridden with M18 and M84. Set to 0 for No Timeout.
*/
#define DEFAULT_STEPPER_DEACTIVE_TIME 120
#define DEFAULT_STEPPER_DEACTIVE_TIME 300
#define DISABLE_INACTIVE_X true
#define DISABLE_INACTIVE_Y true
#define DISABLE_INACTIVE_Z true // Set 'false' if the nozzle could fall onto your printed part!
Expand Down Expand Up @@ -1822,7 +1822,7 @@
*
* Warning: Does not respect endstops!
*/
//#define BABYSTEPPING
#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
//#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR
//#define BABYSTEP_WITHOUT_HOMING
Expand Down Expand Up @@ -1872,9 +1872,9 @@
#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.02 // Unit: mm compression per 1mm/s extruder speed
#define LIN_ADVANCE_K 0.04 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#define EXPERIMENTAL_SCURVE // Enable this option to permit S-Curve Acceleration
//#define EXPERIMENTAL_SCURVE // Enable this option to permit S-Curve Acceleration
#endif

// @section leveling
Expand Down Expand Up @@ -2135,13 +2135,13 @@
// For debug-echo: 128 bytes for the optimal speed.
// Other output doesn't need to be that speedy.
// :[0, 2, 4, 8, 16, 32, 64, 128, 256]
#define TX_BUFFER_SIZE 0
#define TX_BUFFER_SIZE 4

// Host Receive Buffer Size
// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
// To use flow control, set this buffer size to at least 1024 bytes.
// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
//#define RX_BUFFER_SIZE 1024
#define RX_BUFFER_SIZE 32

#if RX_BUFFER_SIZE >= 1024
// Enable to have the controller send XON/XOFF control characters to
Expand Down Expand Up @@ -2173,7 +2173,7 @@
* Currently handles M108, M112, M410, M876
* NOTE: Not yet implemented for all platforms.
*/
//#define EMERGENCY_PARSER
#define EMERGENCY_PARSER

/**
* Realtime Reporting (requires EMERGENCY_PARSER)
Expand Down Expand Up @@ -2350,14 +2350,14 @@
*
* Enable PARK_HEAD_ON_PAUSE to add the G-code M125 Pause and Park.
*/
//#define ADVANCED_PAUSE_FEATURE
#define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract.
// This short retract is done immediately, before parking the nozzle.
#define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast.
#define FILAMENT_CHANGE_UNLOAD_FEEDRATE 20 // (mm/s) Unload filament feedrate. This can be pretty fast.
#define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
#define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload.
#define FILAMENT_CHANGE_UNLOAD_LENGTH 0 // (mm) The length of filament for a complete unload.
// For Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the nozzle.
// Set to 0 for manual unloading.
Expand All @@ -2371,7 +2371,7 @@
// For direct drive, the full length of the nozzle.
//#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted.
#define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate.
#define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading.
#define ADVANCED_PAUSE_PURGE_LENGTH 10 // (mm) Length to extrude after loading.
// Set to 0 for manual extrusion.
// Filament can be extruded repeatedly from the Filament Change menu
// until extrusion is consistent, and to purge old filament.
Expand All @@ -2384,11 +2384,11 @@
#define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged.
#define FILAMENT_UNLOAD_PURGE_FEEDRATE 25 // (mm/s) feedrate to purge before unload

#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
#define PAUSE_PARK_NOZZLE_TIMEOUT 300 // (seconds) Time limit before the nozzle is turned off for safety.
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed.
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.

//#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
//#define HOME_BEFORE_FILAMENT_CHANGE // If needed, home before parking for filament change

//#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
Expand Down Expand Up @@ -2909,11 +2909,11 @@

#if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
// TMC2209: 0...255. TMC2130: -64...63
#define X_STALL_SENSITIVITY 8
#define X_STALL_SENSITIVITY 20
#define X2_STALL_SENSITIVITY X_STALL_SENSITIVITY
#define Y_STALL_SENSITIVITY 8
#define Y2_STALL_SENSITIVITY Y_STALL_SENSITIVITY
//#define Z_STALL_SENSITIVITY 8
#define Y_STALL_SENSITIVITY 20
//#define Y2_STALL_SENSITIVITY Y_STALL_SENSITIVITY
#define Z_STALL_SENSITIVITY 100
//#define Z2_STALL_SENSITIVITY Z_STALL_SENSITIVITY
//#define Z3_STALL_SENSITIVITY Z_STALL_SENSITIVITY
//#define Z4_STALL_SENSITIVITY Z_STALL_SENSITIVITY
Expand Down Expand Up @@ -3788,9 +3788,9 @@
* Host Prompt Support enables Marlin to use the host for user prompts so
* filament runout and other processes can be managed from the host side.
*/
//#define HOST_ACTION_COMMANDS
#define HOST_ACTION_COMMANDS
#if ENABLED(HOST_ACTION_COMMANDS)
//#define HOST_PROMPT_SUPPORT
#define HOST_PROMPT_SUPPORT
//#define HOST_START_MENU_ITEM // Add a menu item that tells the host to start
#endif

Expand Down
14 changes: 13 additions & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "gcode/parser.h"
#include "gcode/queue.h"

#include "feature/runout.h"
#include "feature/pause.h"
#include "sd/cardreader.h"

Expand All @@ -72,6 +73,7 @@
#include "../snapmaker/module/filament_sensor.h"
#include "../snapmaker/module/print_control.h"
#include "../snapmaker/module/system.h"

#if HAS_TOUCH_BUTTONS
#include "lcd/touch/touch_buttons.h"
#endif
Expand Down Expand Up @@ -828,7 +830,15 @@ void idle(bool no_stepper_sleep/*=false*/) {
(void)check_tool_sensor_stats(active_extruder, true);

// Handle filament runout sensors
TERN_(HAS_FILAMENT_SENSOR, runout.run());
TERN_(HAS_FILAMENT_SENSOR, {
if (!is_hmi_printing && marlin_state != MF_INITIALIZING) { // OctoPrint: Custom runout detection
HOTEND_LOOP() {
if (filament_sensor.is_trigger(e) && !FilamentMonitor::is_triggered(e)) {
FilamentMonitor::runout_detected(e);
}
}
}
});

// Run HAL idle tasks
TERN_(HAL_IDLETASK, HAL_idletask());
Expand Down Expand Up @@ -1676,6 +1686,8 @@ AT_END_OF_TEXT void setup() {
ui.check_touch_calibration();
#endif

is_hmi_printing = false; // Default to OctoPrint/serial

marlin_state = MF_RUNNING;

SETUP_LOG("setup() completed.");
Expand Down
19 changes: 15 additions & 4 deletions Marlin/src/feature/mmu/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,12 @@ bool MMU2::get_response() {
* Wait for response and deal with timeout if necessary
*/
void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {

constexpr xyz_pos_t park_point = NOZZLE_PARK_POINT;
xyz_pos_t park_point;
if (active_extruder == 0) {
park_point = xyz_pos_t{NOZZLE_PARK_POINT_T0};
} else {
park_point = xyz_pos_t{NOZZLE_PARK_POINT_T1};
}
bool response = false;
mmu_print_saved = false;
xyz_pos_t resume_position;
Expand All @@ -795,8 +799,15 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
resume_hotend_temp = thermalManager.degTargetHotend(active_extruder);
resume_position = current_position;

if (move_axes && all_axes_homed())
nozzle.park(0, park_point /*= NOZZLE_PARK_POINT*/);
if (move_axes && all_axes_homed()) {
#if ENABLED(DUAL_X_CARRIAGE)
if (active_extruder == 1) endstops.enable_globally(false);
#endif
nozzle.park(0, park_point);
#if ENABLED(DUAL_X_CARRIAGE)
if (active_extruder == 1) endstops.enable_globally(true);
#endif
}

if (turn_off_nozzle) thermalManager.setTargetHotend(0, active_extruder);

Expand Down
Loading