Prusa MINI Firmware overview
probe.h
Go to the documentation of this file.
1 /**
2  * Marlin 3D Printer Firmware
3  * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4  *
5  * Based on Sprinter and grbl.
6  * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 #pragma once
23 
24 /**
25  * probe.h - Move, deploy, enable, etc.
26  */
27 
28 #include "../inc/MarlinConfig.h"
29 
30 #if HAS_BED_PROBE
31 
32  constexpr xyz_pos_t nozzle_to_probe_offset = NOZZLE_TO_PROBE_OFFSET;
33 
34  extern xyz_pos_t probe_offset;
35 
36  bool set_probe_deployed(const bool deploy);
37  #ifdef Z_AFTER_PROBING
38  void move_z_after_probing();
39  #endif
40  enum ProbePtRaise : unsigned char {
41  PROBE_PT_NONE, // No raise or stow after run_z_probe
42  PROBE_PT_STOW, // Do a complete stow after run_z_probe
43  PROBE_PT_RAISE, // Raise to "between" clearance after run_z_probe
44  PROBE_PT_BIG_RAISE // Raise to big clearance after run_z_probe
45  };
46  float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true);
47  inline float probe_at_point(const xy_pos_t &pos, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true) {
48  return probe_at_point(pos.x, pos.y, raise_after, verbose_level, probe_relative);
49  }
50  #define DEPLOY_PROBE() set_probe_deployed(true)
51  #define STOW_PROBE() set_probe_deployed(false)
52  #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
53  extern const char msg_wait_for_bed_heating[25];
54  #endif
55 
56 #else
57 
58  constexpr xyz_pos_t probe_offset{0};
59 
60  #define DEPLOY_PROBE()
61  #define STOW_PROBE()
62 
63 #endif
64 
65 #if HAS_LEVELING && (HAS_BED_PROBE || ENABLED(PROBE_MANUALLY))
66  inline float probe_min_x() {
67  return _MAX(
68  #if IS_KINEMATIC
69  PROBE_X_MIN, MESH_MIN_X
70  #else
72  #endif
73  );
74  }
75  inline float probe_max_x() {
76  return _MIN(
77  #if IS_KINEMATIC
78  PROBE_X_MAX, MESH_MAX_X
79  #else
81  #endif
82  );
83  }
84  inline float probe_min_y() {
85  return _MAX(
86  #if IS_KINEMATIC
87  PROBE_Y_MIN, MESH_MIN_Y
88  #else
90  #endif
91  );
92  }
93  inline float probe_max_y() {
94  return _MIN(
95  #if IS_KINEMATIC
96  PROBE_Y_MAX, MESH_MAX_Y
97  #else
99  #endif
100  );
101  }
102 #else
103  inline float probe_min_x() { return 0; };
104  inline float probe_max_x() { return 0; };
105  inline float probe_min_y() { return 0; };
106  inline float probe_max_y() { return 0; };
107 #endif
108 
109 #if HAS_Z_SERVO_PROBE
110  void servo_probe_init();
111 #endif
112 
113 #if QUIET_PROBING
114  void probing_pause(const bool p);
115 #endif
delta_clip_start_height
float delta_clip_start_height
planner.h
XYZval::z
T z
Definition: types.h:286
GET_TEXT
#define GET_TEXT(MSG)
Definition: multi_language.h:72
Y_MIN_POS
#define Y_MIN_POS
Definition: Configuration_A3ides_2209_MINI.h:985
endstops.h
backlash
Backlash backlash
XYZEval::z
T z
Definition: types.h:383
temperature.h
stop
void stop()
Definition: Marlin.cpp:783
XYZval::x
T x
Definition: types.h:286
DEPLOY_PROBE
#define DEPLOY_PROBE()
Definition: probe.h:60
disable_e_steppers
void disable_e_steppers()
Definition: Marlin.cpp:293
stepper.h
probe_offset
constexpr xyz_pos_t probe_offset
Definition: probe.h:58
PROGMEM
#define PROGMEM
Definition: pgmspace.h:29
Z_PROBE_SPEED_FAST
#define Z_PROBE_SPEED_FAST
Definition: Configuration_A3ides_2209_MINI.h:868
indirection.h
X_AXIS
Definition: types.h:37
RECIPROCAL
#define RECIPROCAL(x)
Definition: macros.h:273
Z_AFTER_PROBING
#define Z_AFTER_PROBING
Definition: Configuration_A3ides_2209_MINI.h:895
Z_CLEARANCE_MULTI_PROBE
#define Z_CLEARANCE_MULTI_PROBE
Definition: Configuration_A3ides_2209_MINI.h:894
DEBUG_ECHOLNPGM
#define DEBUG_ECHOLNPGM(...)
Definition: debug_out.h:79
MIN_PROBE_EDGE_BACK
#define MIN_PROBE_EDGE_BACK
Definition: Conditionals_post.h:1466
host_prompt_do
void host_prompt_do(const PromptReason type, const char *const pstr, const char *const pbtn)
Definition: marlin_server.cpp:1103
_MAX
#define _MAX(V...)
Definition: macros.h:346
do_blocking_move_to_z
void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s)
Definition: motion.cpp:450
do_blocking_move_to_xy
void do_blocking_move_to_xy(const float &rx, const float &ry, const feedRate_t &fr_mm_s)
Definition: motion.cpp:454
PGM_P
#define PGM_P
Definition: pgmspace.h:30
X_MIN
Definition: endstops.h:32
i
uint8_t i
Definition: screen_test_graph.c:72
SERIAL_ECHOLNPAIR_F
#define SERIAL_ECHOLNPAIR_F(V...)
Definition: serial.h:177
_MIN
#define _MIN(V...)
Definition: macros.h:333
Endstops::enable
static void enable(const bool onoff=true)
Definition: endstops.cpp:291
disable_Y
#define disable_Y()
Definition: Marlin.h:104
DEBUG_ECHOLNPAIR
#define DEBUG_ECHOLNPAIR(...)
Definition: debug_out.h:82
IS_KINEMATIC
#define IS_KINEMATIC
Definition: Conditionals_LCD.h:545
motion.h
feedRate_t
float feedRate_t
Definition: types.h:80
KEEPALIVE_STATE
#define KEEPALIVE_STATE(N)
Definition: gcode.h:365
IsRunning
bool IsRunning()
Definition: Marlin.h:331
wait_for_user
bool wait_for_user
Definition: Marlin.cpp:188
BLTouch::deploy
static FORCE_INLINE bool deploy()
Definition: bltouch.h:72
MULTIPLE_PROBING
#define MULTIPLE_PROBING
Definition: Configuration_A3ides_2209_MINI.h:876
X_MIN_POS
#define X_MIN_POS
Definition: Configuration_A3ides_2209_MINI.h:984
NOMORE
#define NOMORE(v, n)
Definition: macros.h:133
Z_MAX_POS
#define Z_MAX_POS
Definition: Configuration_A3ides_2209_MINI.h:989
MOVE_SERVO
#define MOVE_SERVO(I, P)
Definition: servo.h:93
ABS
#define ABS(a)
Definition: macros.h:266
Endstops::not_homing
static void not_homing()
Definition: endstops.cpp:297
Z_PROBE_SPEED_SLOW
#define Z_PROBE_SPEED_SLOW
Definition: Configuration_A3ides_2209_MINI.h:871
SOL1_PIN
#define SOL1_PIN
Definition: pins_LEAPFROG.h:89
bltouch
BLTouch bltouch
MIN_PROBE_EDGE_RIGHT
#define MIN_PROBE_EDGE_RIGHT
Definition: Conditionals_post.h:1460
delta.h
FORCE_INLINE
#define FORCE_INLINE
Definition: macros.h:40
Y_MAX_POS
#define Y_MAX_POS
Definition: Configuration_A3ides_2209_MINI.h:988
PSTR
#define PSTR(str)
Definition: pgmspace.h:31
current_position
xyze_pos_t current_position
Definition: motion.cpp:102
position_is_reachable
bool position_is_reachable(const float &rx, const float &ry)
Definition: motion.h:325
Z_CLEARANCE_BETWEEN_PROBES
#define Z_CLEARANCE_BETWEEN_PROBES
Definition: Configuration_A3ides_2209_MINI.h:893
LOGICAL_Y_POSITION
#define LOGICAL_Y_POSITION(POS)
Definition: motion.h:279
Z_MIN_PROBE
Definition: endstops.h:32
Y_MIN_BED
#define Y_MIN_BED
Definition: Conditionals_post.h:83
set_current_from_steppers_for_axis
void set_current_from_steppers_for_axis(const AxisEnum axis)
Definition: motion.cpp:263
do_blocking_move_to
void do_blocking_move_to(const float rx, const float ry, const float rz, const feedRate_t &fr_mm_s)
Definition: motion.cpp:344
sync_plan_position
void sync_plan_position()
Definition: motion.cpp:216
isnan
#define isnan
Definition: Arduino.h:55
position_is_reachable_by_probe
FORCE_INLINE bool position_is_reachable_by_probe(const xy_int_t &pos)
Definition: motion.h:358
probe_min_x
float probe_min_x()
Definition: probe.h:103
WRITE
#define WRITE(IO, V)
Definition: fastio.h:96
XY_PROBE_FEEDRATE_MM_S
#define XY_PROBE_FEEDRATE_MM_S
Definition: motion.h:77
Z_MIN_PROBE_ENDSTOP_INVERTING
#define Z_MIN_PROBE_ENDSTOP_INVERTING
Definition: Configuration_A3ides_2209_MINI.h:611
feedrate_mm_s
feedRate_t feedrate_mm_s
Definition: motion.cpp:138
HOMING_FEEDRATE_Z
#define HOMING_FEEDRATE_Z
Definition: Configuration_A3ides_2209_MINI.h:1269
XYval
Definition: types.h:99
probe_max_x
float probe_max_x()
Definition: probe.h:104
TemporaryGlobalEndstopsState
Definition: endstops.h:184
axis_known_position
uint8_t axis_known_position
Definition: motion.cpp:91
XYval::x
T x
Definition: types.h:185
DEBUG_POS
#define DEBUG_POS(...)
Definition: debug_out.h:87
probe_min_y
float probe_min_y()
Definition: probe.h:105
uint8_t
const uint8_t[]
Definition: 404_html.c:3
axis_unhomed_error
bool axis_unhomed_error(uint8_t axis_bits)
Definition: motion.cpp:1054
ui
MarlinUI ui
_BV
#define _BV(bit)
Definition: wiring_constants.h:99
XYZval::y
T y
Definition: types.h:286
MIN_PROBE_EDGE_FRONT
#define MIN_PROBE_EDGE_FRONT
Definition: Conditionals_post.h:1463
Y_MAX_BED
#define Y_MAX_BED
Definition: Conditionals_post.h:84
do_blocking_move_to_x
void do_blocking_move_to_x(const float &rx, const feedRate_t &fr_mm_s)
Definition: motion.cpp:444
MIN_PROBE_EDGE_LEFT
#define MIN_PROBE_EDGE_LEFT
Definition: Conditionals_post.h:1457
SERIAL_ERROR_MSG
#define SERIAL_ERROR_MSG(S)
Definition: serial.h:184
X_MAX_POS
#define X_MAX_POS
Definition: Configuration_A3ides_2209_MINI.h:987
disable_X
#define disable_X()
Definition: Marlin.h:77
NOZZLE_TO_PROBE_OFFSET
#define NOZZLE_TO_PROBE_OFFSET
Definition: Configuration_A3ides_2209_MINI.h:858
Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN
Definition: pins_RAMPS_LINUX.h:86
Z_AXIS
Definition: types.h:39
DEBUGGING
#define DEBUGGING(F)
Definition: serial.h:47
SERIAL_ECHOPAIR_F
#define SERIAL_ECHOPAIR_F(S, V...)
Definition: serial.h:176
Z_MIN
Definition: endstops.h:32
SERIAL_EOL
#define SERIAL_EOL()
Definition: serial.h:181
STOW_PROBE
#define STOW_PROBE()
Definition: probe.h:61
MSG_ERR_PROBING_FAILED
#define MSG_ERR_PROBING_FAILED
Definition: language.h:297
TEST
#define TEST(n, b)
Definition: macros.h:81
LOGICAL_X_POSITION
#define LOGICAL_X_POSITION(POS)
Definition: motion.h:278
MMM_TO_MMS
#define MMM_TO_MMS(MM_M)
Definition: types.h:83
XYval::y
T y
Definition: types.h:185
safe_delay
void safe_delay(millis_t ms)
Definition: utility.cpp:28
XYZval< float >
X_MIN_BED
#define X_MIN_BED
Definition: Conditionals_post.h:81
Z_CLEARANCE_DEPLOY_PROBE
#define Z_CLEARANCE_DEPLOY_PROBE
Definition: Configuration_A3ides_2209_MINI.h:892
serialprintPGM
void serialprintPGM(PGM_P str)
Definition: serial.cpp:35
idle
void idle()
Definition: Marlin.cpp:629
READ
#define READ(IO)
Definition: fastio.h:95
MSG_STOP_UNHOMED
#define MSG_STOP_UNHOMED
Definition: language.h:256
probe.h
Z_PROBE_LOW_POINT
#define Z_PROBE_LOW_POINT
Definition: Configuration_A3ides_2209_MINI.h:897
Y_MIN
Definition: endstops.h:32
thermalManager
Temperature thermalManager
Definition: temperature.cpp:89
UNUSED
#define UNUSED(X)
Definition: stm32f4xx_hal_def.h:74
endstops
Endstops endstops
Definition: endstops.cpp:51
X_MAX_BED
#define X_MAX_BED
Definition: Conditionals_post.h:82
Endstops::hit_on_purpose
static FORCE_INLINE void hit_on_purpose()
Definition: endstops.h:148
do_blocking_move_to_y
void do_blocking_move_to_y(const float &ry, const feedRate_t &fr_mm_s)
Definition: motion.cpp:447
BUZZ
#define BUZZ(d, f)
Definition: buzzer.h:126
Endstops::trigger_state
static FORCE_INLINE uint8_t trigger_state()
Definition: endstops.h:106
ENABLED
#define ENABLED(V...)
Definition: macros.h:177
probe_max_y
float probe_max_y()
Definition: probe.h:106
BLTouch::stow
static FORCE_INLINE bool stow()
Definition: bltouch.h:73