exclude_objects: initial implementation

Adding Klipper functionality to support cancelling objects while
printing.

This module keeps track of motion in and out of objects and adjusts
movements as needed.  It also tracks object status and provides that to
clients.

The Klipper module is relatively simple, and only provides one piece of
the workflow. Moonraker already supports processing uploaded files to
insert the required gcode markers for cancelling objects, using
https://github.com/kageurufu/cancelobject-preprocessor. This library is
also available as an executable for use in slicers, and pip
installations also include the script as a callable.

Mainsail has integrated support, and code changes for Fluidd are
available. Support in other interfaces is planned, and we've spoken to
several other developers about integrating frontend support in their
projects.

Signed-off-by: Troy Jacobson <troy.d.jacobson@gmail.com>
Co-authored-by: Franklyn Tackitt <git@frank.af>
Co-authored-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Frank Tackitt 2022-03-01 13:04:08 -07:00 committed by KevinOConnor
parent 04952db1e8
commit 89c59b035e
3 changed files with 545 additions and 0 deletions

View file

@ -0,0 +1,117 @@
[stepper_x]
step_pin: PF0
dir_pin: PF1
enable_pin: !PD7
microsteps: 16
rotation_distance: 40
endstop_pin: ^PE5
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_y]
step_pin: PF6
dir_pin: !PF7
enable_pin: !PF2
microsteps: 16
rotation_distance: 40
endstop_pin: ^PJ1
position_endstop: 0
position_max: 200
homing_speed: 50
[stepper_z]
step_pin: PL3
dir_pin: PL1
enable_pin: !PK0
microsteps: 16
rotation_distance: 8
endstop_pin: ^PD3
position_endstop: 0.5
position_max: 200
[extruder]
step_pin: PA4
dir_pin: PA6
enable_pin: !PA2
microsteps: 16
rotation_distance: 33.5
nozzle_diameter: 0.500
filament_diameter: 3.500
heater_pin: PB4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PK5
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
max_temp: 210
[heater_bed]
heater_pin: PH5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PK6
control: watermark
min_temp: 0
max_temp: 110
[mcu]
serial: /dev/ttyACM0
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
# Test config for exclude_object
[exclude_object]
[gcode_macro M486]
gcode:
# Parameters known to M486 are as follows:
# [C<flag>] Cancel the current object
# [P<index>] Cancel the object with the given index
# [S<index>] Set the index of the current object.
# If the object with the given index has been canceled, this will cause
# the firmware to skip to the next object. The value -1 is used to
# indicate something that isnt an object and shouldnt be skipped.
# [T<count>] Reset the state and set the number of objects
# [U<index>] Un-cancel the object with the given index. This command will be
# ignored if the object has already been skipped
{% if 'exclude_object' not in printer %}
{action_raise_error("[exclude_object] is not enabled")}
{% endif %}
{% if 'T' in params %}
EXCLUDE_OBJECT RESET=1
{% for i in range(params.T | int) %}
EXCLUDE_OBJECT_DEFINE NAME={i}
{% endfor %}
{% endif %}
{% if 'C' in params %}
EXCLUDE_OBJECT CURRENT=1
{% endif %}
{% if 'P' in params %}
EXCLUDE_OBJECT NAME={params.P}
{% endif %}
{% if 'S' in params %}
{% if params.S == '-1' %}
{% if printer.exclude_object.current_object %}
EXCLUDE_OBJECT_END NAME={printer.exclude_object.current_object}
{% endif %}
{% else %}
EXCLUDE_OBJECT_START NAME={params.S}
{% endif %}
{% endif %}
{% if 'U' in params %}
EXCLUDE_OBJECT RESET=1 NAME={params.U}
{% endif %}

View file

@ -0,0 +1,126 @@
DICTIONARY atmega2560.dict
CONFIG exclude_object.cfg
G28
M83
M486 T3
M486 S0
G0 X10
M486 S-1
G0 X0
M486 S1
G0 X11
M486 C
# "Prime" the transform
G1 X140 E0.5
G1 X160 E0.5
G1 X140 E0.5
G1 X160 E0.5
G1 X140 E0.5
G1 X160 E0.5
G1 X140 E0.5
M486 S-1
G0 X0
M486 S2
G0 X13
M486 S0
G0 X10
M486 S-1
G0 X0
M486 S1
G0 X-11
M486 S-1
G0 X0
M486 S2
G0 X13
M486 P2
EXCLUDE_OBJECT
M486 S0
G0 X10
M486 S-1
G0 X0
M486 S1
G0 X-11
M486 S-1
G0 X0
M486 S2
G0 X-13
M486 U2
EXCLUDE_OBJECT
M486 S0
G0 X10
M486 S-1
G0 X0
M486 S1
G0 X-11
M486 S-1
G0 X0
M486 S2
G0 X13
M486 P0
M486 P1
M486 P2
EXCLUDE_OBJECT
M486 S0
G0 X-10
M486 S-1
G0 X0
M486 S1
G0 X-11
M486 S-1
G0 X0
M486 S2
G0 X-13
M486 S66
G0 X66
M486 S-1
G0 X0
M486 P66
M486 S66
G0 X-66
M486 T3
M486 S0
G0 X10
M486 S1
G0 X11
M486 S2
G0 X13