Skip to content

Commit

Permalink
🚸 Disable FT Motion during Biqu Microprobe use (#27368)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <[email protected]>
  • Loading branch information
narno2202 and thinkyhead authored Jan 22, 2025
1 parent 12d491c commit 7e02089
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 7 deletions.
1 change: 0 additions & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,6 @@
* For information about this sensor https://github.com/bigtreetech/MicroProbe
*
* Also requires PROBE_ENABLE_DISABLE
* With FT_MOTION requires ENDSTOP_INTERRUPTS_FEATURE
*/
//#define BIQU_MICROPROBE_V1 // Triggers HIGH
//#define BIQU_MICROPROBE_V2 // Triggers LOW
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
#include "../hilbert_curve.h"
#endif

#if FT_MOTION_DISABLE_FOR_PROBING
#include "../../../module/ft_motion.h"
#endif

#include <math.h>

#define UBL_G29_P31
Expand Down Expand Up @@ -309,6 +313,10 @@ void unified_bed_leveling::G29() {
const uint8_t p_val = parser.byteval('P');
const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen_test('J');

#if FT_MOTION_DISABLE_FOR_PROBING
FTMotionDisableInScope FT_Disabler; // Disable Fixed-Time Motion for probing
#endif

// Check for commands that require the printer to be homed
if (may_move) {
planner.synchronize();
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../../core/debug_out.h"

#if DISABLED(PROBE_MANUALLY) && FT_MOTION_DISABLE_FOR_PROBING
#include "../../../module/ft_motion.h"
#endif

#if ABL_USES_GRID
#if ENABLED(PROBE_Y_FIRST)
#define PR_OUTER_VAR abl.meshCount.x
Expand Down Expand Up @@ -280,6 +284,10 @@ G29_TYPE GcodeSuite::G29() {
// Set and report "probing" state to host
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE, false));

#if DISABLED(PROBE_MANUALLY) && FT_MOTION_DISABLE_FOR_PROBING
FTMotionDisableInScope FT_Disabler; // Disable Fixed-Time Motion for probing
#endif

/**
* On the initial G29 fetch command parameters.
*/
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/gcode/bedlevel/mbl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../../core/debug_out.h"

#if FT_MOTION_DISABLE_FOR_PROBING
#include "../../module/ft_motion.h"
#endif

// Save 130 bytes with non-duplication of PSTR
inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }

Expand All @@ -63,6 +67,10 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
*/
void GcodeSuite::G29() {

#if FT_MOTION_DISABLE_FOR_PROBING
FTMotionDisableInScope FT_Disabler; // Disable Fixed-Time Motion for probing
#endif

DEBUG_SECTION(log_G29, "G29", true);

// G29 Q is also available if debugging
Expand Down
13 changes: 13 additions & 0 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
#include "../../feature/bltouch.h"
#endif

#if FT_MOTION_DISABLE_FOR_PROBING
#include "../../module/ft_motion.h"
#endif

#include "../../lcd/marlinui.h"

#if ENABLED(EXTENSIBLE_UI)
Expand Down Expand Up @@ -129,6 +133,11 @@
#if ENABLED(Z_SAFE_HOMING)

inline void home_z_safely() {

#if FT_MOTION_DISABLE_FOR_PROBING
FTMotionDisableInScope FT_Disabler; // Disable Fixed-Time Motion for homing
#endif

DEBUG_SECTION(log_G28, "home_z_safely", DEBUGGING(LEVELING));

// Disallow Z homing if X or Y homing is needed
Expand Down Expand Up @@ -284,6 +293,10 @@ void GcodeSuite::G28() {
motion_state_t saved_motion_state = begin_slow_homing();
#endif

#if FT_MOTION_DISABLE_FOR_PROBING
FTMotionDisableInScope FT_Disabler; // Disable Fixed-Time Motion for homing
#endif

// Always home with tool 0 active
#if HAS_MULTI_HOTEND
#if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/gcode/probe/G30.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
#include "../../feature/probe_temp_comp.h"
#endif

#if FT_MOTION_DISABLE_FOR_PROBING
#include "../../module/ft_motion.h"
#endif

#if ANY(DWIN_CREALITY_LCD_JYERSUI, EXTENSIBLE_UI)
#define VERBOSE_SINGLE_PROBE
#endif
Expand Down Expand Up @@ -76,6 +80,10 @@ void GcodeSuite::G30() {
// Use 'C' to set Probe Temperature Compensation ON/OFF (on by default)
TERN_(HAS_PTC, ptc.set_enabled(parser.boolval('C', true)));

#if FT_MOTION_DISABLE_FOR_PROBING
FTMotionDisableInScope FT_Disabler; // Disable Fixed-Time Motion for probing
#endif

// Probe the bed, optionally raise, and return the measured height
const float measured_z = probe.probe_at_point(probepos, raise_after);

Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/inc/Conditionals-4-adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,9 @@
#define FTM_WINDOW_SIZE FTM_BW_SIZE
#define FTM_BATCH_SIZE FTM_BW_SIZE
#endif
#if ANY(BIQU_MICROPROBE_V1, BIQU_MICROPROBE_V2)
#define FT_MOTION_DISABLE_FOR_PROBING 1
#endif
#endif

// Multi-Stepping Limit
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1452,10 +1452,6 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#error "BIQU MicroProbe requires a PROBE_ENABLE_PIN."
#endif

#if ENABLED(FT_MOTION) && DISABLED(ENDSTOP_INTERRUPTS_FEATURE)
#error "BIQU Microprobe requires ENDSTOP_INTERRUPTS_FEATURE with FT_MOTION."
#endif

#if ENABLED(BIQU_MICROPROBE_V1)
#if ENABLED(INVERTED_PROBE_STATE)
#if Z_MIN_PROBE_ENDSTOP_HIT_STATE != LOW
Expand Down
13 changes: 12 additions & 1 deletion Marlin/src/module/ft_motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,18 @@ class FTMotion {

FORCE_INLINE static int32_t num_samples_shaper_settle() { return ( shaping.x.ena || shaping.y.ena ) ? FTM_ZMAX : 0; }


}; // class FTMotion

extern FTMotion ftMotion;

typedef struct FTMotionDisableInScope {
bool isactive;
FTMotionDisableInScope() {
isactive = ftMotion.cfg.active;
ftMotion.cfg.active = false;
}
~FTMotionDisableInScope() {
ftMotion.cfg.active = isactive;
if (isactive) ftMotion.init();
}
} FTMotionDisableInScope_t;
4 changes: 3 additions & 1 deletion buildroot/tests/STM32F103RC_btt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ set -e
restore_configs
opt_set MOTHERBOARD BOARD_BTT_SKR_MINI_E3_V1_0 SERIAL_PORT 1 SERIAL_PORT_2 -1 \
X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209 Z_DRIVER_TYPE TMC2209 E0_DRIVER_TYPE TMC2209
opt_enable CR10_STOCKDISPLAY PINS_DEBUGGING Z_IDLE_HEIGHT FT_MOTION FT_MOTION_MENU ADAPTIVE_STEP_SMOOTHING NONLINEAR_EXTRUSION
opt_enable CR10_STOCKDISPLAY PINS_DEBUGGING Z_IDLE_HEIGHT \
FT_MOTION FT_MOTION_MENU BIQU_MICROPROBE_V1 PROBE_ENABLE_DISABLE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR \
ADAPTIVE_STEP_SMOOTHING NONLINEAR_EXTRUSION
exec_test $1 $2 "BigTreeTech SKR Mini E3 1.0 - TMC2209 HW Serial, FT_MOTION" "$3"

0 comments on commit 7e02089

Please sign in to comment.