Skip to content

Commit

Permalink
Makes BGFLUSH_EXTRA_TIME configurable (#176)
Browse files Browse the repository at this point in the history
* Makes BGFLUSH_EXTRA_TIME configurable

* Remove dockable probe PR refs

* Add test and missing dot
  • Loading branch information
fbeauKmi committed Mar 21, 2024
1 parent 6576242 commit a3cb2d6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ A collection of DangerKlipper-specific system options
# When set to true, SAVE_CONFIG will recursively read [include ...] blocks
# for conflicts to autosave data. Any configurations updated will be backed
# up to configs/config_backups.
#bgflush_extra_time: 0.250
# This allows to set extra flush time (in seconds). Under certain conditions,
# a low value will result in an error if message is not get flushed, a high value
# (0.250) will result in homing/probing latency. The default is 0.250
```

## Common kinematic settings
Expand Down
4 changes: 4 additions & 0 deletions klippy/extras/danger_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def __init__(self, config):
self.adc_ignore_limits = config.getboolean("adc_ignore_limits", False)
self.autosave_includes = config.getboolean("autosave_includes", False)

self.bgflush_extra_time = config.getfloat(
"bgflush_extra_time", 0.250, minval=0.0
)


def load_config(config):
return DangerOptions(config)
7 changes: 5 additions & 2 deletions klippy/toolhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ def add_move(self, move):
BUFFER_TIME_START = 0.250
BGFLUSH_LOW_TIME = 0.200
BGFLUSH_BATCH_TIME = 0.200
BGFLUSH_EXTRA_TIME = 0.250
MIN_KIN_TIME = 0.100
MOVE_BATCH_TIME = 0.500
STEPCOMPRESS_FLUSH_TIME = 0.050
Expand All @@ -249,6 +248,7 @@ class DripModeEndSignal(Exception):
class ToolHead:
def __init__(self, config):
self.printer = config.get_printer()
self.danger_options = self.printer.lookup_object("danger_options")
self.reactor = self.printer.get_reactor()
self.all_mcus = [
m for n, m in self.printer.lookup_objects(module="mcu")
Expand Down Expand Up @@ -533,7 +533,10 @@ def _flush_handler(self, eventtime):
self.check_stall_time = self.print_time
# In "NeedPrime"/"Priming" state - flush queues if needed
while 1:
end_flush = self.need_flush_time + BGFLUSH_EXTRA_TIME
end_flush = (
self.need_flush_time
+ self.danger_options.bgflush_extra_time
)
if self.last_flush_time >= end_flush:
self.do_kick_flush_timer = True
return self.reactor.NEVER
Expand Down
1 change: 1 addition & 0 deletions test/klippy/danger_options.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ allow_plugin_override: True
multi_mcu_trsync_timeout: 0.05
adc_ignore_limits: True
autosave_includes: True
bgflush_extra_time: 0.250

[stepper_x]
step_pin: PF0
Expand Down

0 comments on commit a3cb2d6

Please sign in to comment.