Skip to content

Commit

Permalink
✨ Z_SERVO_DEACTIVATE_AFTER_STOW (MarlinFirmware#24215)
Browse files Browse the repository at this point in the history
  • Loading branch information
filippor authored and thinkyhead committed May 16, 2023
1 parent 02342c4 commit d8a80cf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
11 changes: 7 additions & 4 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1387,10 +1387,13 @@
/**
* Z Servo Probe, such as an endstop switch on a rotating arm.
*/
//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector.
//#define Z_SERVO_ANGLES { 70, 0 } // Z Servo Deploy and Stow angles
//#define Z_SERVO_MEASURE_ANGLE 45 // Use if the servo must move to a "free" position for measuring after deploy.
//#define Z_SERVO_INTERMEDIATE_STOW // Stow the probe between points.
//#define Z_PROBE_SERVO_NR 0
#ifdef Z_PROBE_SERVO_NR
//#define Z_SERVO_ANGLES { 70, 0 } // Z Servo Deploy and Stow angles
//#define Z_SERVO_MEASURE_ANGLE 45 // Use if the servo must move to a "free" position for measuring after deploy
//#define Z_SERVO_INTERMEDIATE_STOW // Stow the probe between points
//#define Z_SERVO_DEACTIVATE_AFTER_STOW // Deactivate the servo when probe is stowed
#endif

/**
* The BLTouch probe uses a Hall effect sensor and emulates a servo.
Expand Down
7 changes: 6 additions & 1 deletion Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,16 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {

#elif HAS_Z_SERVO_PROBE

// i.e., deploy ? DEPLOY_Z_SERVO() : STOW_Z_SERVO();
servo[Z_PROBE_SERVO_NR].move(servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]);

#ifdef Z_SERVO_MEASURE_ANGLE
// After deploy move back to the measure angle...
if (deploy) MOVE_SERVO(Z_PROBE_SERVO_NR, Z_SERVO_MEASURE_ANGLE);
if (deploy) servo[Z_PROBE_SERVO_NR].move(Z_SERVO_MEASURE_ANGLE);
#endif

if (TERN0(Z_SERVO_DEACTIVATE_AFTER_STOW, !deploy)) servo[Z_PROBE_SERVO_NR].detach();

#elif ANY(TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, MAG_MOUNTED_PROBE)

deploy ? run_deploy_moves() : run_stow_moves();
Expand Down Expand Up @@ -950,6 +953,8 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
* homing has been done - no homing with z-probe without init!
*/
STOW_Z_SERVO();

TERN_(Z_SERVO_DEACTIVATE_AFTER_STOW, servo[Z_PROBE_SERVO_NR].detach());
}

#endif // HAS_Z_SERVO_PROBE
Expand Down
4 changes: 2 additions & 2 deletions buildroot/tests/mega2560
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO NUM_SERVOS 1 \
NUM_RUNOUT_SENSORS 5 FIL_RUNOUT2_PIN 44 FIL_RUNOUT3_PIN 45 FIL_RUNOUT4_PIN 46 FIL_RUNOUT5_PIN 47 \
FIL_RUNOUT3_STATE HIGH FILAMENT_RUNOUT_SCRIPT '"M600 T%c"'
opt_enable VIKI2 BOOT_MARLIN_LOGO_ANIMATED SDSUPPORT AUTO_REPORT_SD_STATUS \
Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE \
Z_PROBE_SERVO_NR Z_SERVO_ANGLES Z_SERVO_MEASURE_ANGLE DEACTIVATE_SERVOS_AFTER_MOVE Z_SERVO_DEACTIVATE_AFTER_STOW \
AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE PROBE_PT_1 PROBE_PT_2 PROBE_PT_3 \
EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL AUTO_REPORT_POSITION \
NO_VOLUMETRICS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP G38_PROBE_TARGET JOYSTICK \
DIRECT_STEPPING DETECT_BROKEN_ENDSTOP \
FILAMENT_RUNOUT_SENSOR NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE Z_SAFE_HOMING FIL_RUNOUT3_PULLUP
exec_test $1 $2 "Multiple runout sensors (x5) | Distinct runout states" "$3"
exec_test $1 $2 "Z Servo Probe | Multiple runout sensors (x5)" "$3"


#
Expand Down

0 comments on commit d8a80cf

Please sign in to comment.