force_move: Provide defaults for SET_KINEMATIC_POSITION parameters

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-08-01 15:40:35 -04:00
parent c5ecb37b4e
commit f2d232ef77
3 changed files with 18 additions and 14 deletions

View File

@ -157,9 +157,11 @@ the desired movement to the "custom g-code" section of your slicer.
If the printer requires some additional movement as part of the homing
process itself (or fundamentally does not have a homing process) then
consider using a homing_override section in the config file - see
[example-extras.cfg](../config/example-extras.cfg) for further
details.
consider using a homing_override section in the config file. If you
need to move a stepper for diagnostic or debugging purposes then
consider adding a force_move section to the config file. See
[example-extras.cfg](../config/example-extras.cfg) for further details
on these options.
### Why is the Z position_endstop set to 0.5 in the default configs?

View File

@ -195,10 +195,12 @@ section is enabled:
low-level kinematics in an incorrect state; issue a G28 afterwards
to reset the kinematics. This command is intended for low-level
diagnostics and debugging.
- `SET_KINEMATIC_POSITION X=<value> Y=<value> Z=<value>`: Force the
low-level kinematic code to believe the toolhead is at the given
position. This is a diagnostic and debugging command; use
SET_GCODE_OFFSET and/or G92 for regular axis transformations.
Setting an incorrect or invalid position may lead to internal
software errors. This command may invalidate future boundary checks;
issue a G28 afterwards to reset the kinematics.
- `SET_KINEMATIC_POSITION [X=<value>] [Y=<value>] [Z=<value>]`: Force
the low-level kinematic code to believe the toolhead is at the given
cartesian position. This is a diagnostic and debugging command; use
SET_GCODE_OFFSET and/or G92 for regular axis transformations. If an
axis is not specified then it will default to the position that the
head was last commanded to. Setting an incorrect or invalid position
may lead to internal software errors. This command may invalidate
future boundary checks; issue a G28 afterwards to reset the
kinematics.

View File

@ -89,13 +89,13 @@ class ForceMove:
self.restore_enable(stepper, True, was_ignore)
cmd_SET_KINEMATIC_POSITION_help = "Force a low-level kinematic position"
def cmd_SET_KINEMATIC_POSITION(self, params):
x = self.gcode.get_float('X', params)
y = self.gcode.get_float('Y', params)
z = self.gcode.get_float('Z', params)
logging.info("SET_KINEMATIC_POSITION pos=%.3f,%.3f,%.3f", x, y, z)
toolhead = self.printer.lookup_object('toolhead')
toolhead.get_last_move_time()
curpos = toolhead.get_position()
x = self.gcode.get_float('X', params, curpos[0])
y = self.gcode.get_float('Y', params, curpos[1])
z = self.gcode.get_float('Z', params, curpos[2])
logging.info("SET_KINEMATIC_POSITION pos=%.3f,%.3f,%.3f", x, y, z)
toolhead.set_position([x, y, z, curpos[3]], homing_axes=(0, 1, 2))
self.gcode.reset_last_position()