gcode: Don't apply the SET_GCODE_OFFSET to the next g-code command

The SET_GCODE_OFFSET command could cause unwanted behavior when an
offset is applied to the following g-code command.  (In particular,
when the following command is an extrude only move - as in
issue #1289.)

Don't apply the offset immediately.  Instead, add support for a MOVE=1
parameter which will schedule a move to apply the given offset.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2019-05-20 22:36:57 -04:00
parent 500f37821d
commit d6b69938ab
3 changed files with 32 additions and 10 deletions

View File

@@ -90,15 +90,21 @@ The following standard commands are supported:
- `GET_POSITION`: Return information on the current location of the
toolhead.
- `SET_GCODE_OFFSET [X=<pos>|X_ADJUST=<adjust>]
[Y=<pos>|Y_ADJUST=<adjust>] [Z=<pos>|Z_ADJUST=<adjust>]`: Set a
positional offset to apply to future G-Code commands. This is
commonly used to virtually change the Z bed offset or to set nozzle
XY offsets when switching extruders. For example, if
"SET_GCODE_OFFSET Z=0.2" is sent, then future G-Code moves will
have 0.2mm added to their Z height. If the X_ADJUST style parameters
are used, then the adjustment will be added to any existing offset
(eg, "SET_GCODE_OFFSET Z=-0.2" followed by "SET_GCODE_OFFSET
Z_ADJUST=0.3" would result in a total Z offset of 0.1).
[Y=<pos>|Y_ADJUST=<adjust>] [Z=<pos>|Z_ADJUST=<adjust>]
[MOVE=1 [MOVE_SPEED=<speed>]]`: Set a positional offset to apply to
future G-Code commands. This is commonly used to virtually change
the Z bed offset or to set nozzle XY offsets when switching
extruders. For example, if "SET_GCODE_OFFSET Z=0.2" is sent, then
future G-Code moves will have 0.2mm added to their Z height. If the
X_ADJUST style parameters are used, then the adjustment will be
added to any existing offset (eg, "SET_GCODE_OFFSET Z=-0.2" followed
by "SET_GCODE_OFFSET Z_ADJUST=0.3" would result in a total Z offset
of 0.1). If "MOVE=1" is specified then a toolhead move will be
issued to apply the given offset (otherwise the offset will take
effect on the next absolute G-Code move that specifies the given
axis). If "MOVE_SPEED" is specified then the toolhead move will be
performed with the given speed (in mm/s); otherwise the toolhead
move will use the last specified G-Code speed.
- `PID_CALIBRATE HEATER=<config_name> TARGET=<temperature>
[WRITE_FILE=1]`: Perform a PID calibration test. The specified
heater will be enabled until the specified target temperature is