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

idle_timeout: let it be 0 #165

Merged
merged 2 commits into from
Mar 6, 2024
Merged
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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ If I want my printer to light itself on fire, I should be able to make my printe

- [kinematics: independent X & Y acceleration and velocity settings](https://github.com/DangerKlippers/danger-klipper/pull/4)

- [idle_timeout: allow the idle timeout to be disabled](https://github.com/DangerKlippers/danger-klipper/issues/165)

- [canbus: custom CAN bus uuid hash for deterministic uuids](https://github.com/DangerKlippers/danger-klipper/pull/156)

If you're feeling adventurous, take a peek at the extra features in the bleeding-edge branch [feature documentation](docs/Bleeding_Edge.md)
Expand Down
3 changes: 2 additions & 1 deletion docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,8 @@ explicit idle_timeout config section to change the default settings.
# "TURN_OFF_HEATERS" and "M84".
#timeout: 600
# Idle time (in seconds) to wait before running the above G-Code
# commands. The default is 600 seconds.
# commands. Set it to 0 to disable the timeout feature.
# The default is 600 seconds.
```

## Optional G-Code features
Expand Down
5 changes: 4 additions & 1 deletion klippy/extras/idle_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, config):
self.gcode = self.printer.lookup_object("gcode")
self.toolhead = self.timeout_timer = None
self.printer.register_event_handler("klippy:ready", self.handle_ready)
self.idle_timeout = config.getfloat("timeout", 600.0, above=0.0)
self.idle_timeout = config.getfloat("timeout", 600.0, minval=0)
gcode_macro = self.printer.load_object(config, "gcode_macro")
self.idle_gcode = gcode_macro.load_template(
config, "gcode", DEFAULT_IDLE_GCODE
Expand Down Expand Up @@ -64,6 +64,9 @@ def transition_idle_state(self, eventtime):
return self.reactor.NEVER

def check_idle_timeout(self, eventtime):
# timeout is disabled
if not self.idle_timeout > 0:
return eventtime + 60.0
# Make sure toolhead class isn't busy
print_time, est_print_time, lookahead_empty = self.toolhead.check_busy(
eventtime
Expand Down
Loading