Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(klippy, toolhead): add S<seconds> param to G4 command #6499

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/G-Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ commands that one may enter into the OctoPrint terminal tab.

Klipper supports the following standard G-Code commands:
- Move (G0 or G1): `G1 [X<pos>] [Y<pos>] [Z<pos>] [E<pos>] [F<speed>]`
- Dwell: `G4 P<milliseconds>`
- Dwell: `G4 P<milliseconds>` or `G4 S<seconds>` or `G4 S<seconds> P<milliseconds>`
- Move to origin: `G28 [X] [Y] [Z]`
- Turn off motors: `M18` or `M84`
- Wait for current moves to finish: `M400`
Expand Down
11 changes: 10 additions & 1 deletion klippy/toolhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,19 @@ def _calc_junction_deviation(self):
self.junction_deviation = scv2 * (math.sqrt(2.) - 1.) / self.max_accel
self.max_accel_to_decel = min(self.requested_accel_to_decel,
self.max_accel)

def cmd_G4(self, gcmd):
# Dwell
delay = gcmd.get_float('P', 0., minval=0.) / 1000.
delay_in_seconds = gcmd.get_float('S', None, minval=0.)
delay_in_milliseconds = gcmd.get_float('P', None, minval=0.)

if delay_in_seconds is None and delay_in_milliseconds is None:
logging.warning("neither S nor P argument given")
return

delay = (delay_in_seconds or 0) + (delay_in_milliseconds or 0) / 1000.
self.dwell(delay)

def cmd_M400(self, gcmd):
# Wait for current moves to finish
self.wait_moves()
Expand Down
Loading