firmware_retract: Remove z_hop support

The current z_hop support did not work correctly with common slicers
that change Z height between retract and unretract, and it did not
work correctly with slicers that issue a retract at the end of a print
and then at the beginning of the next print.

The z_hop support is therefore being removed until these issues can be
fixed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-07-10 19:25:56 -04:00
parent 364c22fe84
commit 0343d0c73a
4 changed files with 17 additions and 31 deletions

View File

@ -1664,9 +1664,6 @@
# The length (in mm) of *additional* filament to add when unretracting. # The length (in mm) of *additional* filament to add when unretracting.
#unretract_speed: 10 #unretract_speed: 10
# The speed of unretraction, in mm/s. The default is 10 mm/s. # The speed of unretraction, in mm/s. The default is 10 mm/s.
#z_hop: 0
# The amount of lift applied to the Z axis (in mm) on retract and
# restored on unretract. The default is 0 mm.
# Include file support. One may include additional config file from # Include file support. One may include additional config file from

View File

@ -6,6 +6,10 @@ All dates in this document are approximate.
# Changes # Changes
20190710: The z_hop option was removed from the [firmware_retract]
config section. The z_hop support was incomplete and could cause
incorrect behavior with several common slicers.
20190710: The optional parameters of the PROBE_ACCURACY command have 20190710: The optional parameters of the PROBE_ACCURACY command have
changed. It may be necessary to update any macros or scripts that use changed. It may be necessary to update any macros or scripts that use
that command. that command.

View File

@ -457,18 +457,15 @@ stringing during non-extrusion moves from one part of the print to
another. Appropriately configuring pressure advance reduces the length another. Appropriately configuring pressure advance reduces the length
of retraction required. of retraction required.
- `SET_RETRACTION [RETRACT_LENGTH=<mm>] [RETRACT_SPEED=<mm/s>] - `SET_RETRACTION [RETRACT_LENGTH=<mm>] [RETRACT_SPEED=<mm/s>]
[UNRETRACT_EXTRA_LENGTH=<mm>] [UNRETRACT_SPEED=<mm/s>] [Z_HOP=<mm>]`: [UNRETRACT_EXTRA_LENGTH=<mm>] [UNRETRACT_SPEED=<mm/s>]`: Adjust the
Adjust the parameters used by firmware retraction. RETRACT_LENGTH parameters used by firmware retraction. RETRACT_LENGTH determines
determines the length of filament to retract and unretract. The the length of filament to retract and unretract. The speed of
speed of retraction is adjusted via RETRACT_SPEED, and is typically retraction is adjusted via RETRACT_SPEED, and is typically set
set relatively high. The speed of unretraction is adjusted via relatively high. The speed of unretraction is adjusted via
UNRETRACT_SPEED, and is not particularly critical, although often UNRETRACT_SPEED, and is not particularly critical, although often
lower than RETRACT_SPEED. In some cases it is useful to add a small lower than RETRACT_SPEED. In some cases it is useful to add a small
amount of additional length on unretraction, and this is set via amount of additional length on unretraction, and this is set via
UNRETRACT_EXTRA_LENGTH. It is possible to lift the Z axis by a small UNRETRACT_EXTRA_LENGTH. SET_RETRACTION is commonly set as part of
amount when in retracted state by setting Z_HOP, although this is
more commonly used for printers where fast Z movements are supported,
such as delta printers. SET_RETRACTION is commonly set as part of
slicer per-filament configuration, as different filaments require slicer per-filament configuration, as different filaments require
different parameter settings. different parameter settings.
- `GET_RETRACTION`: Queries the current parameters used by firmware - `GET_RETRACTION`: Queries the current parameters used by firmware

View File

@ -12,9 +12,8 @@ class FirmwareRetraction:
self.unretract_extra_length = config.getfloat( self.unretract_extra_length = config.getfloat(
'unretract_extra_length', 0., minval=0.) 'unretract_extra_length', 0., minval=0.)
self.unretract_speed = config.getfloat('unretract_speed', 10., minval=1) self.unretract_speed = config.getfloat('unretract_speed', 10., minval=1)
self.z_hop = config.getfloat('z_hop', 0., minval=0.)
self.unretract_length = (self.retract_length self.unretract_length = (self.retract_length
+ self.unretract_extra_length) + self.unretract_extra_length)
self.is_retracted = False self.is_retracted = False
self.gcode = self.printer.lookup_object('gcode') self.gcode = self.printer.lookup_object('gcode')
self.gcode.register_command('SET_RETRACTION', self.cmd_SET_RETRACTION) self.gcode.register_command('SET_RETRACTION', self.cmd_SET_RETRACTION)
@ -28,7 +27,6 @@ class FirmwareRetraction:
"retract_speed": self.retract_speed, "retract_speed": self.retract_speed,
"unretract_extra_length": self.unretract_extra_length, "unretract_extra_length": self.unretract_extra_length,
"unretract_speed": self.unretract_speed, "unretract_speed": self.unretract_speed,
"z_hop": self.z_hop
} }
def cmd_SET_RETRACTION(self, params): def cmd_SET_RETRACTION(self, params):
@ -44,46 +42,36 @@ class FirmwareRetraction:
self.unretract_speed = self.gcode.get_float( self.unretract_speed = self.gcode.get_float(
'UNRETRACT_SPEED', 'UNRETRACT_SPEED',
params, self.unretract_speed, minval=1) params, self.unretract_speed, minval=1)
self.z_hop = self.gcode.get_float(
'Z_HOP',
params, self.z_hop, minval=0.)
self.unretract_length = (self.retract_length self.unretract_length = (self.retract_length
+ self.unretract_extra_length) + self.unretract_extra_length)
self.is_retracted = False self.is_retracted = False
def cmd_GET_RETRACTION(self, params): def cmd_GET_RETRACTION(self, params):
msg = ("RETRACT_LENGTH=%.5f RETRACT_SPEED=%.5f " msg = ("RETRACT_LENGTH=%.5f RETRACT_SPEED=%.5f "
"UNRETRACT_EXTRA_LENGTH=%.5f UNRETRACT_SPEED=%.5f " "UNRETRACT_EXTRA_LENGTH=%.5f UNRETRACT_SPEED=%.5f"
"Z_HOP=%.5f"
% (self.retract_length, self.retract_speed, % (self.retract_length, self.retract_speed,
self.unretract_extra_length, self.unretract_speed, self.unretract_extra_length, self.unretract_speed))
self.z_hop))
self.gcode.respond_info(msg) self.gcode.respond_info(msg)
def cmd_G10(self, params): def cmd_G10(self, params):
if not self.is_retracted: if not self.is_retracted:
self.gcode.run_script_from_command( self.gcode.run_script_from_command(
"SAVE_GCODE_STATE NAME=_retract_state\n" "SAVE_GCODE_STATE NAME=_retract_state\n"
"G92 E0\n"
"G91\n" "G91\n"
"G1 E-%.5f F%d\n" "G1 E-%.5f F%d\n"
"G1 Z%.5f\n"
"RESTORE_GCODE_STATE NAME=_retract_state" "RESTORE_GCODE_STATE NAME=_retract_state"
% (self.retract_length, self.retract_speed*60, self.z_hop)) % (self.retract_length, self.retract_speed*60))
self.is_retracted = True self.is_retracted = True
def cmd_G11(self, params): def cmd_G11(self, params):
if self.is_retracted: if self.is_retracted:
self.gcode.run_script_from_command( self.gcode.run_script_from_command(
"SAVE_GCODE_STATE NAME=_retract_state\n" "SAVE_GCODE_STATE NAME=_retract_state\n"
"G92 E0\n"
"G91\n" "G91\n"
"G1 E%.5f F%d\n" "G1 E%.5f F%d\n"
"G1 Z-%.5f\n"
"RESTORE_GCODE_STATE NAME=_retract_state" "RESTORE_GCODE_STATE NAME=_retract_state"
% (self.unretract_length, self.unretract_speed*60, self.z_hop)) % (self.unretract_length, self.unretract_speed*60))
self.is_retracted = False self.is_retracted = False
def load_config(config): def load_config(config):
return FirmwareRetraction(config) return FirmwareRetraction(config)