Skip to content

Commit

Permalink
feat: enable [exclude_object] by default
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerlz committed Jun 16, 2024
1 parent 42534ba commit 35a62df
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 19 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ See the [Danger Features document](https://dangerklipper.io/Danger_Features.html

- [respond: turn on by default](https://github.com/DangerKlippers/danger-klipper/pull/296)

- [exclude_object: turn on by default](https://github.com/DangerKlippers/danger-klipper/pull/306)

- [bed_mesh: add bed_mesh_default config option](https://github.com/DangerKlippers/danger-klipper/pull/143)

- [config: CONFIG_SAVE updates included files](https://github.com/DangerKlippers/danger-klipper/pull/153)
Expand Down
13 changes: 9 additions & 4 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1777,8 +1777,8 @@ using this feature may place the printer in an invalid state - see the
```
[force_move]
#enable_force_move: True
# Set to true to enable FORCE_MOVE and SET_KINEMATIC_POSITION
# extended G-Code commands. The default is true.
# Set to `True` to enable FORCE_MOVE and SET_KINEMATIC_POSITION
# extended G-Code commands. The default is `True`.
```

### [pause_resume]
Expand Down Expand Up @@ -1868,12 +1868,14 @@ Enable the "M118" and "RESPOND" extended
# Directly sets the default prefix. If present, this value will
# override the "default_type".
#enable_respond: True
# Set to true to enable M118 and RESPOND
# extended G-Code commands. The default is true.
# Set to `True` to enable M118 and RESPOND
# extended G-Code commands. The default is `True`.
```

### [exclude_object]

This module is enabled by default in DangerKlipper!

Enables support to exclude or cancel individual objects during the printing
process.

Expand All @@ -1885,6 +1887,9 @@ Marlin/RepRapFirmware compatible M486 G-Code macro.

```
[exclude_object]
#enable_exclude_object: True
# Set to `True` to enable `EXCLUDE_OBJECT_*` extended G-Code commands.
# The default is `True`.
```

## Resonance compensation
Expand Down
1 change: 1 addition & 0 deletions docs/Danger_Features.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [`[force_move]`](./Config_Reference.md#⚠-force_move) is enabled by default. Use `[force_move] enable_force_move: False` to disable it
- [`[respond]`](./Config_Reference.md#respond) is enabled by default. Use `[respond] enable_respond: False` to disable it
- [`[exclude_object]`](./Config_Reference.md#exclude_object) is enabled by default. Use `[exclude_object] enable_exclude_object: False` to disable it

## Additional configuration options

Expand Down
4 changes: 4 additions & 0 deletions klippy/extras/exclude_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def __init__(self, config):
self.printer = config.get_printer()
self.gcode = self.printer.lookup_object("gcode")
self.gcode_move = self.printer.load_object(config, "gcode_move")

if not config.getboolean("enable_exclude_object", True):
return

self.printer.register_event_handler(
"klippy:connect", self._handle_connect
)
Expand Down
20 changes: 11 additions & 9 deletions klippy/extras/force_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ def __init__(self, config):
self.cmd_STEPPER_BUZZ,
desc=self.cmd_STEPPER_BUZZ_help,
)
if config.getboolean("enable_force_move", True):
gcode.register_command(
"FORCE_MOVE", self.cmd_FORCE_MOVE, desc=self.cmd_FORCE_MOVE_help
)
gcode.register_command(
"SET_KINEMATIC_POSITION",
self.cmd_SET_KINEMATIC_POSITION,
desc=self.cmd_SET_KINEMATIC_POSITION_help,
)
if not config.getboolean("enable_force_move", True):
return

gcode.register_command(
"FORCE_MOVE", self.cmd_FORCE_MOVE, desc=self.cmd_FORCE_MOVE_help
)
gcode.register_command(
"SET_KINEMATIC_POSITION",
self.cmd_SET_KINEMATIC_POSITION,
desc=self.cmd_SET_KINEMATIC_POSITION_help,
)

def register_stepper(self, config, mcu_stepper):
self.steppers[mcu_stepper.get_name()] = mcu_stepper
Expand Down
13 changes: 8 additions & 5 deletions klippy/extras/respond.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ def __init__(self, config):
"default_type", respond_types, "echo"
)
self.default_prefix = config.get("default_prefix", self.default_prefix)

if not config.getboolean("enable_respond", True):
return

gcode = self.printer.lookup_object("gcode")
if config.getboolean("enable_respond", True):
gcode.register_command("M118", self.cmd_M118, True)
gcode.register_command(
"RESPOND", self.cmd_RESPOND, True, desc=self.cmd_RESPOND_help
)
gcode.register_command("M118", self.cmd_M118, True)
gcode.register_command(
"RESPOND", self.cmd_RESPOND, True, desc=self.cmd_RESPOND_help
)

def cmd_M118(self, gcmd):
msg = gcmd.get_raw_command_parameters()
Expand Down
2 changes: 1 addition & 1 deletion klippy/klippy.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def _read_config(self):
for section_config in config.get_prefix_sections(""):
self.load_object(config, section_config.get_name(), None)
# dangerklipper on-by-default extras
for section_config in ["force_move", "respond"]:
for section_config in ["force_move", "respond", "exclude_object"]:
self.load_object(config, section_config, None)
for m in [toolhead]:
m.add_printer_objects(config)
Expand Down

0 comments on commit 35a62df

Please sign in to comment.