|
@@ -363,17 +363,52 @@ inline void do_probe_raise(const float z_raise) {
|
363
|
363
|
do_blocking_move_to_z(z_dest);
|
364
|
364
|
}
|
365
|
365
|
|
366
|
|
-// returns false for ok and true for failure
|
367
|
|
-bool set_probe_deployed(const bool deploy) {
|
|
366
|
+FORCE_INLINE void probe_specific_action(const bool deploy) {
|
|
367
|
+ #if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
|
368
|
368
|
|
369
|
|
- // Can be extended to servo probes, if needed.
|
370
|
|
- #if ENABLED(PROBE_IS_TRIGGERED_WHEN_STOWED_TEST)
|
371
|
|
- #if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
372
|
|
- #define _TRIGGERED_WHEN_STOWED_TEST (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING)
|
373
|
|
- #else
|
374
|
|
- #define _TRIGGERED_WHEN_STOWED_TEST (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)
|
|
369
|
+ BUZZ(100, 659);
|
|
370
|
+ BUZZ(100, 698);
|
|
371
|
+
|
|
372
|
+ PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW);
|
|
373
|
+ lcd_setstatusPGM(ds_str);
|
|
374
|
+ serialprintPGM(ds_str);
|
|
375
|
+ SERIAL_EOL();
|
|
376
|
+
|
|
377
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
378
|
+ wait_for_user = true;
|
|
379
|
+ while (wait_for_user) idle();
|
|
380
|
+ lcd_reset_status();
|
|
381
|
+ KEEPALIVE_STATE(IN_HANDLER);
|
|
382
|
+
|
|
383
|
+ #endif // PAUSE_BEFORE_DEPLOY_STOW
|
|
384
|
+
|
|
385
|
+ #if ENABLED(SOLENOID_PROBE)
|
|
386
|
+
|
|
387
|
+ #if HAS_SOLENOID_1
|
|
388
|
+ WRITE(SOL1_PIN, deploy);
|
375
|
389
|
#endif
|
|
390
|
+
|
|
391
|
+ #elif ENABLED(Z_PROBE_SLED)
|
|
392
|
+
|
|
393
|
+ dock_sled(!deploy);
|
|
394
|
+
|
|
395
|
+ #elif HAS_Z_SERVO_PROBE && DISABLED(BLTOUCH)
|
|
396
|
+
|
|
397
|
+ MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]);
|
|
398
|
+
|
|
399
|
+ #elif ENABLED(Z_PROBE_ALLEN_KEY)
|
|
400
|
+
|
|
401
|
+ deploy ? run_deploy_moves_script() : run_stow_moves_script();
|
|
402
|
+
|
|
403
|
+ #elif ENABLED(RACK_AND_PINION_PROBE)
|
|
404
|
+
|
|
405
|
+ do_blocking_move_to_x(deploy ? Z_PROBE_DEPLOY_X : Z_PROBE_RETRACT_X);
|
|
406
|
+
|
376
|
407
|
#endif
|
|
408
|
+}
|
|
409
|
+
|
|
410
|
+// returns false for ok and true for failure
|
|
411
|
+bool set_probe_deployed(const bool deploy) {
|
377
|
412
|
|
378
|
413
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
379
|
414
|
if (DEBUGGING(LEVELING)) {
|
|
@@ -420,65 +455,24 @@ bool set_probe_deployed(const bool deploy) {
|
420
|
455
|
const float oldXpos = current_position[X_AXIS],
|
421
|
456
|
oldYpos = current_position[Y_AXIS];
|
422
|
457
|
|
423
|
|
- #ifdef _TRIGGERED_WHEN_STOWED_TEST
|
|
458
|
+ #if ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST)
|
|
459
|
+ #if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
|
460
|
+ #define PROBE_STOWED() (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING)
|
|
461
|
+ #else
|
|
462
|
+ #define PROBE_STOWED() (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)
|
|
463
|
+ #endif
|
|
464
|
+ #endif
|
424
|
465
|
|
425
|
|
- // If endstop is already false, the Z probe is deployed
|
426
|
|
- if (_TRIGGERED_WHEN_STOWED_TEST == deploy) { // closed after the probe specific actions.
|
427
|
|
- // Would a goto be less ugly?
|
428
|
|
- //while (!_TRIGGERED_WHEN_STOWED_TEST) idle(); // would offer the opportunity
|
429
|
|
- // for a triggered when stowed manual probe.
|
|
466
|
+ #ifdef PROBE_STOWED
|
430
|
467
|
|
|
468
|
+ // Only deploy/stow if needed
|
|
469
|
+ if (PROBE_STOWED() == deploy) {
|
431
|
470
|
if (!deploy) endstops.enable_z_probe(false); // Switch off triggered when stowed probes early
|
432
|
471
|
// otherwise an Allen-Key probe can't be stowed.
|
433
|
|
- #endif
|
434
|
|
-
|
435
|
|
- #if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
|
436
|
|
-
|
437
|
|
- BUZZ(100, 659);
|
438
|
|
- BUZZ(100, 698);
|
439
|
|
-
|
440
|
|
- PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW);
|
441
|
|
- lcd_setstatusPGM(ds_str);
|
442
|
|
- serialprintPGM(ds_str);
|
443
|
|
- SERIAL_EOL();
|
444
|
|
-
|
445
|
|
- KEEPALIVE_STATE(PAUSED_FOR_USER);
|
446
|
|
- wait_for_user = true;
|
447
|
|
- while (wait_for_user) idle();
|
448
|
|
- lcd_reset_status();
|
449
|
|
- KEEPALIVE_STATE(IN_HANDLER);
|
450
|
|
-
|
451
|
|
- #endif // PAUSE_BEFORE_DEPLOY_STOW
|
452
|
|
-
|
453
|
|
- #if ENABLED(SOLENOID_PROBE)
|
454
|
|
-
|
455
|
|
- #if HAS_SOLENOID_1
|
456
|
|
- WRITE(SOL1_PIN, deploy);
|
457
|
|
- #endif
|
458
|
|
-
|
459
|
|
- #elif ENABLED(Z_PROBE_SLED)
|
460
|
|
-
|
461
|
|
- dock_sled(!deploy);
|
462
|
|
-
|
463
|
|
- #elif HAS_Z_SERVO_PROBE && DISABLED(BLTOUCH)
|
464
|
|
-
|
465
|
|
- MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]);
|
466
|
|
-
|
467
|
|
- #elif ENABLED(Z_PROBE_ALLEN_KEY)
|
468
|
|
-
|
469
|
|
- deploy ? run_deploy_moves_script() : run_stow_moves_script();
|
470
|
|
-
|
471
|
|
- #elif ENABLED(RACK_AND_PINION_PROBE)
|
472
|
|
-
|
473
|
|
- do_blocking_move_to_x(deploy ? Z_PROBE_DEPLOY_X : Z_PROBE_RETRACT_X);
|
474
|
|
-
|
475
|
|
- #endif
|
476
|
|
-
|
477
|
|
- #ifdef _TRIGGERED_WHEN_STOWED_TEST
|
478
|
|
- } // _TRIGGERED_WHEN_STOWED_TEST == deploy
|
479
|
|
-
|
480
|
|
- if (_TRIGGERED_WHEN_STOWED_TEST == deploy) { // State hasn't changed?
|
|
472
|
+ probe_specific_action(deploy);
|
|
473
|
+ }
|
481
|
474
|
|
|
475
|
+ if (PROBE_STOWED() == deploy) { // Unchanged after deploy/stow action?
|
482
|
476
|
if (IsRunning()) {
|
483
|
477
|
SERIAL_ERROR_START();
|
484
|
478
|
SERIAL_ERRORLNPGM("Z-Probe failed");
|
|
@@ -486,8 +480,11 @@ bool set_probe_deployed(const bool deploy) {
|
486
|
480
|
}
|
487
|
481
|
stop();
|
488
|
482
|
return true;
|
|
483
|
+ }
|
|
484
|
+
|
|
485
|
+ #else
|
489
|
486
|
|
490
|
|
- } // _TRIGGERED_WHEN_STOWED_TEST == deploy
|
|
487
|
+ probe_specific_action(deploy);
|
491
|
488
|
|
492
|
489
|
#endif
|
493
|
490
|
|