MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / set_deployed

Method set_deployed

Marlin/src/module/probe.cpp:535–599  ·  view source on GitHub ↗

* Attempt to deploy or stow the probe * * Return TRUE if the probe could not be deployed/stowed */

Source from the content-addressed store, hash-verified

533 * Return TRUE if the probe could not be deployed/stowed
534 */
535bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) {
536 if (DEBUGGING(LEVELING)) {
537 DEBUG_POS("Probe::set_deployed", current_position);
538 DEBUG_ECHOLNPGM("deploy=", deploy, " no_return=", no_return);
539 }
540
541 if (endstops.z_probe_enabled == deploy) return false;
542
543 // Make room for probe to deploy (or stow)
544 // Fix-mounted probe should only raise for deploy
545 // unless PAUSE_BEFORE_DEPLOY_STOW is enabled
546 #if ANY(FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE) && DISABLED(PAUSE_BEFORE_DEPLOY_STOW)
547 const bool z_raise_wanted = deploy;
548 #else
549 constexpr bool z_raise_wanted = true;
550 #endif
551
552 if (z_raise_wanted) {
553 const float zdest = DIFF_TERN(HAS_HOTEND_OFFSET, Z_CLEARANCE_DEPLOY_PROBE, hotend_offset[active_extruder].z);
554 if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Raise Z to ", zdest);
555 do_z_clearance(zdest);
556 }
557
558 #if ANY(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)
559 if (homing_needed_error(TERN_(Z_PROBE_SLED, _BV(X_AXIS)))) {
560 probe_error_stop();
561 return true;
562 }
563 #endif
564
565 const xy_pos_t old_xy = current_position; // Remember location before probe deployment
566
567 #if ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST)
568
569 // Only deploy/stow if needed
570 if (PROBE_TRIGGERED() == deploy || !deploy) {
571 if (!deploy) endstops.enable_z_probe(false); // Switch off triggered when stowed probes early
572 // otherwise an Allen-Key probe can't be stowed.
573 probe_specific_action(deploy);
574 }
575
576 if (PROBE_TRIGGERED() == deploy) { // Unchanged after deploy/stow action?
577 if (IsRunning()) {
578 SERIAL_ERROR_MSG("Z-Probe failed");
579 LCD_ALERTMESSAGE_F("Err: ZPROBE");
580 }
581 stop();
582 return true;
583 }
584
585 #else
586
587 probe_specific_action(deploy);
588
589 #endif
590
591 // If preheating is required before any probing...
592 // TODO: Consider skipping this for things like M401, G34, etc.

Callers 1

menuItemHandlerMethod · 0.45

Calls 9

probe_specific_actionFunction · 0.85
IsRunningFunction · 0.85
stopFunction · 0.85
do_blocking_move_toFunction · 0.85
enable_z_probeMethod · 0.80
do_z_clearanceFunction · 0.70
homing_needed_errorFunction · 0.70
DISABLEDFunction · 0.50
ifFunction · 0.50

Tested by

no test coverage detected