Prusa MINI Firmware overview
Endstops Class Reference

#include <endstops.h>

Collaboration diagram for Endstops:

Public Types

typedef uint16_t esbits_t
 

Public Member Functions

 Endstops ()
 

Static Public Member Functions

static void init ()
 
static FORCE_INLINE bool abort_enabled ()
 
static bool global_enabled ()
 
static void poll ()
 
static void update ()
 
static FORCE_INLINE uint8_t trigger_state ()
 
static FORCE_INLINE esbits_t state ()
 
static void event_handler ()
 
static void M119 ()
 
static void enable_globally (const bool onoff=true)
 
static void enable (const bool onoff=true)
 
static void not_homing ()
 
static FORCE_INLINE void validate_homing_move ()
 
static FORCE_INLINE void hit_on_purpose ()
 
static void resync ()
 

Static Public Attributes

static float z2_endstop_adj
 

Member Typedef Documentation

◆ esbits_t

typedef uint16_t Endstops::esbits_t

Constructor & Destructor Documentation

◆ Endstops()

Endstops::Endstops ( )
71 {};

Member Function Documentation

◆ init()

void Endstops::init ( )
static

Initialize the endstop pins

Class and Instance Methods

94  {
95 
96  #if HAS_X_MIN
97  #if ENABLED(ENDSTOPPULLUP_XMIN)
99  #elif ENABLED(ENDSTOPPULLDOWN_XMIN)
101  #else
103  #endif
104  #endif
105 
106  #if HAS_X2_MIN
107  #if ENABLED(ENDSTOPPULLUP_XMIN)
108  SET_INPUT_PULLUP(X2_MIN_PIN);
109  #elif ENABLED(ENDSTOPPULLDOWN_XMIN)
110  SET_INPUT_PULLDOWN(X2_MIN_PIN);
111  #else
112  SET_INPUT(X2_MIN_PIN);
113  #endif
114  #endif
115 
116  #if HAS_Y_MIN
117  #if ENABLED(ENDSTOPPULLUP_YMIN)
119  #elif ENABLED(ENDSTOPPULLDOWN_YMIN)
121  #else
123  #endif
124  #endif
125 
126  #if HAS_Y2_MIN
127  #if ENABLED(ENDSTOPPULLUP_YMIN)
128  SET_INPUT_PULLUP(Y2_MIN_PIN);
129  #elif ENABLED(ENDSTOPPULLDOWN_YMIN)
130  SET_INPUT_PULLDOWN(Y2_MIN_PIN);
131  #else
132  SET_INPUT(Y2_MIN_PIN);
133  #endif
134  #endif
135 
136  #if HAS_Z_MIN
137  #if ENABLED(ENDSTOPPULLUP_ZMIN)
139  #elif ENABLED(ENDSTOPPULLDOWN_ZMIN)
141  #else
143  #endif
144  #endif
145 
146  #if HAS_Z2_MIN
147  #if ENABLED(ENDSTOPPULLUP_ZMIN)
148  SET_INPUT_PULLUP(Z2_MIN_PIN);
149  #elif ENABLED(ENDSTOPPULLDOWN_ZMIN)
150  SET_INPUT_PULLDOWN(Z2_MIN_PIN);
151  #else
152  SET_INPUT(Z2_MIN_PIN);
153  #endif
154  #endif
155 
156  #if HAS_Z3_MIN
157  #if ENABLED(ENDSTOPPULLUP_ZMIN)
158  SET_INPUT_PULLUP(Z3_MIN_PIN);
159  #elif ENABLED(ENDSTOPPULLDOWN_ZMIN)
160  SET_INPUT_PULLDOWN(Z3_MIN_PIN);
161  #else
162  SET_INPUT(Z3_MIN_PIN);
163  #endif
164  #endif
165 
166  #if HAS_X_MAX
167  #if ENABLED(ENDSTOPPULLUP_XMAX)
169  #elif ENABLED(ENDSTOPPULLDOWN_XMAX)
171  #else
173  #endif
174  #endif
175 
176  #if HAS_X2_MAX
177  #if ENABLED(ENDSTOPPULLUP_XMAX)
178  SET_INPUT_PULLUP(X2_MAX_PIN);
179  #elif ENABLED(ENDSTOPPULLDOWN_XMAX)
180  SET_INPUT_PULLDOWN(X2_MAX_PIN);
181  #else
182  SET_INPUT(X2_MAX_PIN);
183  #endif
184  #endif
185 
186  #if HAS_Y_MAX
187  #if ENABLED(ENDSTOPPULLUP_YMAX)
189  #elif ENABLED(ENDSTOPPULLDOWN_YMAX)
191  #else
193  #endif
194  #endif
195 
196  #if HAS_Y2_MAX
197  #if ENABLED(ENDSTOPPULLUP_YMAX)
198  SET_INPUT_PULLUP(Y2_MAX_PIN);
199  #elif ENABLED(ENDSTOPPULLDOWN_YMAX)
200  SET_INPUT_PULLDOWN(Y2_MAX_PIN);
201  #else
202  SET_INPUT(Y2_MAX_PIN);
203  #endif
204  #endif
205 
206  #if HAS_Z_MAX
207  #if ENABLED(ENDSTOPPULLUP_ZMAX)
209  #elif ENABLED(ENDSTOPPULLDOWN_ZMAX)
211  #else
213  #endif
214  #endif
215 
216  #if HAS_Z2_MAX
217  #if ENABLED(ENDSTOPPULLUP_ZMAX)
218  SET_INPUT_PULLUP(Z2_MAX_PIN);
219  #elif ENABLED(ENDSTOPPULLDOWN_ZMAX)
220  SET_INPUT_PULLDOWN(Z2_MAX_PIN);
221  #else
222  SET_INPUT(Z2_MAX_PIN);
223  #endif
224  #endif
225 
226  #if HAS_Z3_MAX
227  #if ENABLED(ENDSTOPPULLUP_ZMAX)
228  SET_INPUT_PULLUP(Z3_MAX_PIN);
229  #elif ENABLED(ENDSTOPPULLDOWN_ZMAX)
230  SET_INPUT_PULLDOWN(Z3_MAX_PIN);
231  #else
232  SET_INPUT(Z3_MAX_PIN);
233  #endif
234  #endif
235 
236  #if HAS_CALIBRATION_PIN
237  #if ENABLED(CALIBRATION_PIN_PULLUP)
238  SET_INPUT_PULLUP(CALIBRATION_PIN);
239  #elif ENABLED(CALIBRATION_PIN_PULLDOWN)
240  SET_INPUT_PULLDOWN(CALIBRATION_PIN);
241  #else
242  SET_INPUT(CALIBRATION_PIN);
243  #endif
244  #endif
245 
246  #if HAS_CUSTOM_PROBE_PIN
247  #if ENABLED(ENDSTOPPULLUP_ZMIN_PROBE)
249  #elif ENABLED(ENDSTOPPULLDOWN_ZMIN_PROBE)
251  #else
253  #endif
254  #endif
255 
256  #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
258  #endif
259 
260  // Enable endstops
262  #if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
263  true
264  #else
265  false
266  #endif
267  );
268 
269 } // Endstops::init
Here is the call graph for this function:
Here is the caller graph for this function:

◆ abort_enabled()

static FORCE_INLINE bool Endstops::abort_enabled ( )
static

Are endstops or the probe set to abort the move?

81  {
82  return (enabled
83  #if HAS_BED_PROBE
84  || z_probe_enabled
85  #endif
86  );
87  }
Here is the caller graph for this function:

◆ global_enabled()

static bool Endstops::global_enabled ( )
static
89 { return enabled_globally; }

◆ poll()

void Endstops::poll ( )
static

Periodic call to poll endstops if required. Called from temperature ISR

272  {
273 
274  #if ENABLED(PINS_DEBUGGING)
275  run_monitor(); // report changes in endstop status
276  #endif
277 
278  #if DISABLED(ENDSTOP_INTERRUPTS_FEATURE)
279  update();
280  #elif ENDSTOP_NOISE_THRESHOLD
281  if (endstop_poll_count) update();
282  #endif
283 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void Endstops::update ( )
static

Update endstops bits from the pins. Apply filtering to get a verified state. If abort_enabled() and moving towards a triggered switch, abort the current move. Called from ISR contexts.

Check and update endstops

496  {
497 
498  #if !ENDSTOP_NOISE_THRESHOLD
499  if (!abort_enabled()) return;
500  #endif
501 
502  #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
503  #define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
504 
505  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
506  // If G38 command is active check Z_MIN_PROBE for ALL movement
507  if (G38_move) UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
508  #endif
509 
510  // With Dual X, endstops are only checked in the homing direction for the active extruder
511  #if ENABLED(DUAL_X_CARRIAGE)
512  #define E0_ACTIVE stepper.movement_extruder() == 0
513  #define X_MIN_TEST ((X_HOME_DIR < 0 && E0_ACTIVE) || (X2_HOME_DIR < 0 && !E0_ACTIVE))
514  #define X_MAX_TEST ((X_HOME_DIR > 0 && E0_ACTIVE) || (X2_HOME_DIR > 0 && !E0_ACTIVE))
515  #else
516  #define X_MIN_TEST true
517  #define X_MAX_TEST true
518  #endif
519 
520  // Use HEAD for core axes, AXIS for others
521  #if CORE_IS_XY || CORE_IS_XZ
522  #define X_AXIS_HEAD X_HEAD
523  #else
524  #define X_AXIS_HEAD X_AXIS
525  #endif
526  #if CORE_IS_XY || CORE_IS_YZ
527  #define Y_AXIS_HEAD Y_HEAD
528  #else
529  #define Y_AXIS_HEAD Y_AXIS
530  #endif
531  #if CORE_IS_XZ || CORE_IS_YZ
532  #define Z_AXIS_HEAD Z_HEAD
533  #else
534  #define Z_AXIS_HEAD Z_AXIS
535  #endif
536 
537  /**
538  * Check and update endstops
539  */
540  #if HAS_X_MIN && !X_SPI_SENSORLESS
542  #if ENABLED(X_DUAL_ENDSTOPS)
543  #if HAS_X2_MIN
545  #else
547  #endif
548  #endif
549  #endif
550 
551  #if HAS_X_MAX && !X_SPI_SENSORLESS
553  #if ENABLED(X_DUAL_ENDSTOPS)
554  #if HAS_X2_MAX
556  #else
558  #endif
559  #endif
560  #endif
561 
562  #if HAS_Y_MIN && !Y_SPI_SENSORLESS
564  #if ENABLED(Y_DUAL_ENDSTOPS)
565  #if HAS_Y2_MIN
567  #else
569  #endif
570  #endif
571  #endif
572 
573  #if HAS_Y_MAX && !Y_SPI_SENSORLESS
575  #if ENABLED(Y_DUAL_ENDSTOPS)
576  #if HAS_Y2_MAX
578  #else
580  #endif
581  #endif
582  #endif
583 
584  #if HAS_Z_MIN && !Z_SPI_SENSORLESS
586  #if Z_MULTI_ENDSTOPS
587  #if HAS_Z2_MIN
589  #else
591  #endif
592  #if ENABLED(Z_TRIPLE_ENDSTOPS)
593  #if HAS_Z3_MIN
595  #else
597  #endif
598  #endif
599  #endif
600  #endif
601 
602  // When closing the gap check the enabled probe
603  #if HAS_CUSTOM_PROBE_PIN
604  UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
605  #endif
606 
607  #if HAS_Z_MAX && !Z_SPI_SENSORLESS
608  // Check both Z dual endstops
609  #if Z_MULTI_ENDSTOPS
611  #if HAS_Z2_MAX
613  #else
615  #endif
616  #if ENABLED(Z_TRIPLE_ENDSTOPS)
617  #if HAS_Z3_MAX
619  #else
621  #endif
622  #endif
623  #elif !HAS_CUSTOM_PROBE_PIN || Z_MAX_PIN != Z_MIN_PROBE_PIN
624  // If this pin isn't the bed probe it's the Z endstop
626  #endif
627  #endif
628 
629  #if ENDSTOP_NOISE_THRESHOLD
630 
631  /**
632  * Filtering out noise on endstops requires a delayed decision. Let's assume, due to noise,
633  * that 50% of endstop signal samples are good and 50% are bad (assuming normal distribution
634  * of random noise). Then the first sample has a 50% chance to be good or bad. The 2nd sample
635  * also has a 50% chance to be good or bad. The chances of 2 samples both being bad becomes
636  * 50% of 50%, or 25%. That was the previous implementation of Marlin endstop handling. It
637  * reduces chances of bad readings in half, at the cost of 1 extra sample period, but chances
638  * still exist. The only way to reduce them further is to increase the number of samples.
639  * To reduce the chance to 1% (1/128th) requires 7 samples (adding 7ms of delay).
640  */
641  static esbits_t old_live_state;
642  if (old_live_state != live_state) {
643  endstop_poll_count = ENDSTOP_NOISE_THRESHOLD;
644  old_live_state = live_state;
645  }
646  else if (endstop_poll_count && !--endstop_poll_count)
647  validated_live_state = live_state;
648 
649  if (!abort_enabled()) return;
650 
651  #endif
652 
653  // Test the current status of an endstop
654  #define TEST_ENDSTOP(ENDSTOP) (TEST(state(), ENDSTOP))
655 
656  // Record endstop was hit
657  #define _ENDSTOP_HIT(AXIS, MINMAX) SBI(hit_state, _ENDSTOP(AXIS, MINMAX))
658 
659  // Call the endstop triggered routine for single endstops
660  #define PROCESS_ENDSTOP(AXIS,MINMAX) do { \
661  if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX))) { \
662  _ENDSTOP_HIT(AXIS, MINMAX); \
663  planner.endstop_triggered(_AXIS(AXIS)); \
664  } \
665  }while(0)
666 
667  // Call the endstop triggered routine for dual endstops
668  #define PROCESS_DUAL_ENDSTOP(AXIS1, AXIS2, MINMAX) do { \
669  const byte dual_hit = TEST_ENDSTOP(_ENDSTOP(AXIS1, MINMAX)) | (TEST_ENDSTOP(_ENDSTOP(AXIS2, MINMAX)) << 1); \
670  if (dual_hit) { \
671  _ENDSTOP_HIT(AXIS1, MINMAX); \
672  /* if not performing home or if both endstops were trigged during homing... */ \
673  if (!stepper.separate_multi_axis || dual_hit == 0b11) \
674  planner.endstop_triggered(_AXIS(AXIS1)); \
675  } \
676  }while(0)
677 
678  #define PROCESS_TRIPLE_ENDSTOP(AXIS1, AXIS2, AXIS3, MINMAX) do { \
679  const byte triple_hit = TEST_ENDSTOP(_ENDSTOP(AXIS1, MINMAX)) | (TEST_ENDSTOP(_ENDSTOP(AXIS2, MINMAX)) << 1) | (TEST_ENDSTOP(_ENDSTOP(AXIS3, MINMAX)) << 2); \
680  if (triple_hit) { \
681  _ENDSTOP_HIT(AXIS1, MINMAX); \
682  /* if not performing home or if both endstops were trigged during homing... */ \
683  if (!stepper.separate_multi_axis || triple_hit == 0b111) \
684  planner.endstop_triggered(_AXIS(AXIS1)); \
685  } \
686  }while(0)
687 
688  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
689  #if ENABLED(G38_PROBE_AWAY)
690  #define _G38_OPEN_STATE (G38_move >= 4)
691  #else
692  #define _G38_OPEN_STATE LOW
693  #endif
694  // If G38 command is active check Z_MIN_PROBE for ALL movement
695  if (G38_move && TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE)) != _G38_OPEN_STATE) {
699  G38_did_trigger = true;
700  }
701  #endif
702 
703  // Now, we must signal, after validation, if an endstop limit is pressed or not
705  if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction
706  #if HAS_X_MIN || (X_SPI_SENSORLESS && X_HOME_DIR < 0)
707  #if ENABLED(X_DUAL_ENDSTOPS)
709  #else
711  #endif
712  #endif
713  }
714  else { // +direction
715  #if HAS_X_MAX || (X_SPI_SENSORLESS && X_HOME_DIR > 0)
716  #if ENABLED(X_DUAL_ENDSTOPS)
718  #else
720  #endif
721  #endif
722  }
723  }
724 
726  if (stepper.motor_direction(Y_AXIS_HEAD)) { // -direction
727  #if HAS_Y_MIN || (Y_SPI_SENSORLESS && Y_HOME_DIR < 0)
728  #if ENABLED(Y_DUAL_ENDSTOPS)
730  #else
732  #endif
733  #endif
734  }
735  else { // +direction
736  #if HAS_Y_MAX || (Y_SPI_SENSORLESS && Y_HOME_DIR > 0)
737  #if ENABLED(Y_DUAL_ENDSTOPS)
739  #else
741  #endif
742  #endif
743  }
744  }
745 
747  if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
748  #if HAS_Z_MIN || (Z_SPI_SENSORLESS && Z_HOME_DIR < 0)
749  #if ENABLED(Z_TRIPLE_ENDSTOPS)
751  #elif ENABLED(Z_DUAL_ENDSTOPS)
753  #else
754  #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
755  if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN);
756  #elif HAS_CUSTOM_PROBE_PIN
757  if (!z_probe_enabled) PROCESS_ENDSTOP(Z, MIN);
758  #else
760  #endif
761  #endif
762  #endif
763 
764  // When closing the gap check the enabled probe
765  #if HAS_CUSTOM_PROBE_PIN
766  if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN_PROBE);
767  #endif
768  }
769  else { // Z +direction. Gantry up, bed down.
770  #if HAS_Z_MAX || (Z_SPI_SENSORLESS && Z_HOME_DIR > 0)
771  #if ENABLED(Z_TRIPLE_ENDSTOPS)
773  #elif ENABLED(Z_DUAL_ENDSTOPS)
775  #elif !HAS_CUSTOM_PROBE_PIN || Z_MAX_PIN != Z_MIN_PROBE_PIN
776  // If this pin is not hijacked for the bed probe
777  // then it belongs to the Z endstop
779  #endif
780  #endif
781  }
782  }
783 } // Endstops::update()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ trigger_state()

static FORCE_INLINE uint8_t Endstops::trigger_state ( )
static

Get Endstop hit state.

106 { return hit_state; }

◆ state()

static FORCE_INLINE esbits_t Endstops::state ( )
static

Get current endstops state

111  {
112  return
113  #if ENDSTOP_NOISE_THRESHOLD
114  validated_live_state
115  #else
116  live_state
117  #endif
118  ;
119  }

◆ event_handler()

void Endstops::event_handler ( )
static

Report endstop hits to serial. Called from loop().

341  {
342  static uint8_t prev_hit_state; // = 0
343  if (hit_state && hit_state != prev_hit_state) {
344  #if HAS_SPI_LCD
345  char chrX = ' ', chrY = ' ', chrZ = ' ', chrP = ' ';
346  #define _SET_STOP_CHAR(A,C) (chr## A = C)
347  #else
348  #define _SET_STOP_CHAR(A,C) ;
349  #endif
350 
351  #define _ENDSTOP_HIT_ECHO(A,C) do{ \
352  SERIAL_ECHOPAIR(" " STRINGIFY(A) ":", planner.triggered_position_mm(_AXIS(A))); \
353  _SET_STOP_CHAR(A,C); }while(0)
354 
355  #define _ENDSTOP_HIT_TEST(A,C) \
356  if (TEST(hit_state, A ##_MIN) || TEST(hit_state, A ##_MAX)) \
357  _ENDSTOP_HIT_ECHO(A,C)
358 
359  #define ENDSTOP_HIT_TEST_X() _ENDSTOP_HIT_TEST(X,'X')
360  #define ENDSTOP_HIT_TEST_Y() _ENDSTOP_HIT_TEST(Y,'Y')
361  #define ENDSTOP_HIT_TEST_Z() _ENDSTOP_HIT_TEST(Z,'Z')
362 
368 
369  #if HAS_CUSTOM_PROBE_PIN
370  #define P_AXIS Z_AXIS
371  if (TEST(hit_state, Z_MIN_PROBE)) _ENDSTOP_HIT_ECHO(P, 'P');
372  #endif
373  SERIAL_EOL();
374 
375  #if HAS_SPI_LCD
376  ui.status_printf_P(0, PSTR(S_FMT " %c %c %c %c"), GET_TEXT(MSG_LCD_ENDSTOPS), chrX, chrY, chrZ, chrP);
377  #endif
378 
379  #if BOTH(SD_ABORT_ON_ENDSTOP_HIT, SDSUPPORT)
380  if (planner.abort_on_endstop_hit) {
381  card.stopSDPrint();
385  }
386  #endif
387  }
388  prev_hit_state = hit_state;
389 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ M119()

void _O2 Endstops::M119 ( )
static

Report endstop positions in response to M119

398  {
399  #if ENABLED(BLTOUCH)
401  #endif
403  #define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(MSG_##S))
404  #if HAS_X_MIN
405  ES_REPORT(X_MIN);
406  #endif
407  #if HAS_X2_MIN
408  ES_REPORT(X2_MIN);
409  #endif
410  #if HAS_X_MAX
411  ES_REPORT(X_MAX);
412  #endif
413  #if HAS_X2_MAX
414  ES_REPORT(X2_MAX);
415  #endif
416  #if HAS_Y_MIN
417  ES_REPORT(Y_MIN);
418  #endif
419  #if HAS_Y2_MIN
420  ES_REPORT(Y2_MIN);
421  #endif
422  #if HAS_Y_MAX
423  ES_REPORT(Y_MAX);
424  #endif
425  #if HAS_Y2_MAX
426  ES_REPORT(Y2_MAX);
427  #endif
428  #if HAS_Z_MIN
429  ES_REPORT(Z_MIN);
430  #endif
431  #if HAS_Z2_MIN
432  ES_REPORT(Z2_MIN);
433  #endif
434  #if HAS_Z3_MIN
435  ES_REPORT(Z3_MIN);
436  #endif
437  #if HAS_Z_MAX
438  ES_REPORT(Z_MAX);
439  #endif
440  #if HAS_Z2_MAX
441  ES_REPORT(Z2_MAX);
442  #endif
443  #if HAS_Z3_MAX
444  ES_REPORT(Z3_MAX);
445  #endif
446  #if HAS_CUSTOM_PROBE_PIN
448  #endif
449  #if HAS_FILAMENT_SENSOR
450  #if NUM_RUNOUT_SENSORS == 1
452  #else
453  for (uint8_t i = 1; i <= NUM_RUNOUT_SENSORS; i++) {
454  pin_t pin;
455  switch (i) {
456  default: continue;
457  case 1: pin = FIL_RUNOUT_PIN; break;
458  case 2: pin = FIL_RUNOUT2_PIN; break;
459  #if NUM_RUNOUT_SENSORS > 2
460  case 3: pin = FIL_RUNOUT3_PIN; break;
461  #if NUM_RUNOUT_SENSORS > 3
462  case 4: pin = FIL_RUNOUT4_PIN; break;
463  #if NUM_RUNOUT_SENSORS > 4
464  case 5: pin = FIL_RUNOUT5_PIN; break;
465  #if NUM_RUNOUT_SENSORS > 5
466  case 6: pin = FIL_RUNOUT6_PIN; break;
467  #endif
468  #endif
469  #endif
470  #endif
471  }
473  if (i > 1) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + i); }
474  print_es_state(extDigitalRead(pin) != FIL_RUNOUT_INVERTING);
475  }
476  #endif
477  #endif
478  #if ENABLED(BLTOUCH)
480  #endif
481 
482  #if ENABLED(JOYSTICK_DEBUG)
483  joystick.report();
484  #endif
485 
486 } // Endstops::M119
Here is the call graph for this function:

◆ enable_globally()

void Endstops::enable_globally ( const bool  onoff = true)
static
285  {
286  enabled_globally = enabled = onoff;
287  resync();
288 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ enable()

void Endstops::enable ( const bool  onoff = true)
static
291  {
292  enabled = onoff;
293  resync();
294 }
Here is the call graph for this function:

◆ not_homing()

void Endstops::not_homing ( )
static
297  {
298  enabled = enabled_globally;
299 }

◆ validate_homing_move()

static FORCE_INLINE void Endstops::validate_homing_move ( )
static
144 { hit_on_purpose(); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hit_on_purpose()

static FORCE_INLINE void Endstops::hit_on_purpose ( )
static
148 { hit_state = 0; }
Here is the caller graph for this function:

◆ resync()

void Endstops::resync ( )
static
318  {
319  if (!abort_enabled()) return; // If endstops/probes are disabled the loop below can hang
320 
321  #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
322  update();
323  #else
324  safe_delay(2); // Wait for Temperature ISR to run at least once (runs at 1KHz)
325  #endif
326  #if ENDSTOP_NOISE_THRESHOLD
327  while (endstop_poll_count) safe_delay(1);
328  #endif
329 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ z2_endstop_adj

float Endstops::z2_endstop_adj
static
GET_TEXT
#define GET_TEXT(MSG)
Definition: multi_language.h:72
SERIAL_CHAR
#define SERIAL_CHAR(x)
Definition: serial.h:69
Z2_MIN
Definition: endstops.h:36
Endstops::resync
static void resync()
Definition: endstops.cpp:318
_ENDSTOP
#define _ENDSTOP(AXIS, MINMAX)
Definition: endstops.cpp:491
PROCESS_ENDSTOP
#define PROCESS_ENDSTOP(AXIS, MINMAX)
Z_AXIS_HEAD
#define Z_AXIS_HEAD
_ENDSTOP_HIT_ECHO
#define _ENDSTOP_HIT_ECHO(A, C)
MSG_Z_PROBE
#define MSG_Z_PROBE
Definition: language.h:198
Endstops::abort_enabled
static FORCE_INLINE bool abort_enabled()
Definition: endstops.h:81
Y_AXIS_HEAD
#define Y_AXIS_HEAD
SET_INPUT_PULLDOWN
#define SET_INPUT_PULLDOWN(IO)
set pin as input with pulldown wrapper
Definition: fastio.h:95
Stepper::axis_is_moving
static FORCE_INLINE bool axis_is_moving(const AxisEnum axis)
Definition: stepper.h:381
X_AXIS
Definition: types.h:37
stepper
Stepper stepper
Definition: stepper.cpp:82
MIN
#define MIN(a, b)
Definition: usbd_def.h:265
print_job_timer
Stopwatch print_job_timer
Definition: printcounter.cpp:63
Z2_MAX
Definition: endstops.h:36
MSG_ENDSTOPS_HIT
#define MSG_ENDSTOPS_HIT
Definition: language.h:241
extDigitalRead
#define extDigitalRead(IO)
Definition: fastio.h:92
Stepper::motor_direction
static FORCE_INLINE bool motor_direction(const AxisEnum axis)
Definition: stepper.h:378
X_MIN
Definition: endstops.h:32
X_MAX
Definition: endstops.h:33
i
uint8_t i
Definition: screen_test_graph.c:72
Y_MAX
Definition: endstops.h:33
Y
Definition: L6470_Marlin.h:30
FIL_RUNOUT2_PIN
#define FIL_RUNOUT2_PIN
Definition: pins_GT2560_V3.h:83
Y2_MIN
Definition: endstops.h:35
X_MIN_PIN
#define X_MIN_PIN
Definition: pins_ESP32.h:45
BLTouch::_reset_SW_mode
static FORCE_INLINE void _reset_SW_mode()
Definition: bltouch.h:82
PROCESS_TRIPLE_ENDSTOP
#define PROCESS_TRIPLE_ENDSTOP(AXIS1, AXIS2, AXIS3, MINMAX)
SERIAL_ECHO_START
#define SERIAL_ECHO_START()
Definition: serial.h:179
Stopwatch::stop
static bool stop()
Stop the stopwatch.
Definition: stopwatch.cpp:36
Planner::endstop_triggered
static void endstop_triggered(const AxisEnum axis)
Definition: planner.cpp:1508
Z3
Definition: L6470_Marlin.h:30
_ENDSTOP_HIT
#define _ENDSTOP_HIT(AXIS, MINMAX)
MAX
#define MAX(a, b)
Definition: usbd_def.h:266
Z
Definition: L6470_Marlin.h:30
BLTouch::_set_SW_mode
static FORCE_INLINE void _set_SW_mode()
Definition: bltouch.h:81
SET_INPUT_PULLUP
#define SET_INPUT_PULLUP(IO)
Definition: fastio.h:100
Y2_MAX
Definition: endstops.h:35
pin_t
int8_t pin_t
Definition: HAL.h:65
UPDATE_ENDSTOP_BIT
#define UPDATE_ENDSTOP_BIT(AXIS, MINMAX)
bltouch
BLTouch bltouch
Z3_MAX
Definition: endstops.h:37
PSTR
#define PSTR(str)
Definition: pgmspace.h:31
SET_INPUT
#define SET_INPUT(IO)
Definition: fastio.h:99
Z_MIN_PROBE
Definition: endstops.h:32
X2
Definition: L6470_Marlin.h:30
print_es_state
static void print_es_state(const bool is_hit, PGM_P const label=nullptr)
Definition: endstops.cpp:391
X2_MAX
Definition: endstops.h:34
Y_MIN_PIN
#define Y_MIN_PIN
Definition: pins_ESP32.h:46
X_MIN_TEST
#define X_MIN_TEST
Y_MAX_PIN
#define Y_MAX_PIN
Definition: pins_RAMPS_LINUX.h:78
ENDSTOP_HIT_TEST_Y
#define ENDSTOP_HIT_TEST_Y()
SERIAL_ECHOPGM
#define SERIAL_ECHOPGM(S)
Definition: serial.h:173
Z_MIN_PROBE_ENDSTOP_INVERTING
#define Z_MIN_PROBE_ENDSTOP_INVERTING
Definition: Configuration_A3ides_2209_MINI.h:611
ENDSTOP_HIT_TEST_Z
#define ENDSTOP_HIT_TEST_Z()
NUM_RUNOUT_SENSORS
#define NUM_RUNOUT_SENSORS
Definition: pins_FORMBOT_TREX3.h:132
Temperature::disable_all_heaters
static void disable_all_heaters()
Definition: temperature.cpp:1926
uint8_t
const uint8_t[]
Definition: 404_html.c:3
ES_REPORT
#define ES_REPORT(S)
ui
MarlinUI ui
Z2
Definition: L6470_Marlin.h:30
MSG_FILAMENT_RUNOUT_SENSOR
#define MSG_FILAMENT_RUNOUT_SENSOR
Definition: language.h:199
X_MAX_TEST
#define X_MAX_TEST
FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN
Definition: pins_RAMPS_LINUX.h:216
HAS_BED_PROBE
#define HAS_BED_PROBE
Definition: Conditionals_LCD.h:500
Y_AXIS
Definition: types.h:38
X_MAX_PIN
#define X_MAX_PIN
Definition: pins_RAMPS_LINUX.h:75
Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN
Definition: pins_RAMPS_LINUX.h:86
Z_AXIS
Definition: types.h:39
Z_MIN_PIN
#define Z_MIN_PIN
Definition: pins_ESP32.h:47
Z_MIN
Definition: endstops.h:32
COPY_LIVE_STATE
#define COPY_LIVE_STATE(SRC_BIT, DST_BIT)
Endstops::enable_globally
static void enable_globally(const bool onoff=true)
Definition: endstops.cpp:285
SERIAL_EOL
#define SERIAL_EOL()
Definition: serial.h:181
ENDSTOP_HIT_TEST_X
#define ENDSTOP_HIT_TEST_X()
quickstop_stepper
void quickstop_stepper()
Definition: Marlin.cpp:272
X2_MIN
Definition: endstops.h:34
joystick
Joystick joystick
TEST
#define TEST(n, b)
Definition: macros.h:81
safe_delay
void safe_delay(millis_t ms)
Definition: utility.cpp:28
X_AXIS_HEAD
#define X_AXIS_HEAD
Endstops::update
static void update()
Definition: endstops.cpp:496
PROCESS_DUAL_ENDSTOP
#define PROCESS_DUAL_ENDSTOP(AXIS1, AXIS2, MINMAX)
Z_MAX
Definition: endstops.h:33
Z3_MIN
Definition: endstops.h:37
S_FMT
#define S_FMT
Definition: macros.h:68
SERIAL_ECHOLNPGM
#define SERIAL_ECHOLNPGM(S)
Definition: serial.h:174
Endstops::esbits_t
uint16_t esbits_t
Definition: endstops.h:43
X
Definition: L6470_Marlin.h:30
TEST_ENDSTOP
#define TEST_ENDSTOP(ENDSTOP)
READ
#define READ(IO)
Definition: fastio.h:95
Y2
Definition: L6470_Marlin.h:30
Y_MIN
Definition: endstops.h:32
thermalManager
Temperature thermalManager
Definition: temperature.cpp:89
Endstops::hit_on_purpose
static FORCE_INLINE void hit_on_purpose()
Definition: endstops.h:148
MSG_M119_REPORT
#define MSG_M119_REPORT
Definition: language.h:212
setup_endstop_interrupts
void setup_endstop_interrupts()
Definition: endstop_interrupts.h:105
ENABLED
#define ENABLED(V...)
Definition: macros.h:177
planner
Planner planner
Definition: planner.cpp:111
Z_MAX_PIN
#define Z_MAX_PIN
Definition: pins_RAMPS_LINUX.h:80