Skip to content

Commit

Permalink
Testing run without register_lookahead_callback
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Pieper <[email protected]>
  • Loading branch information
Cirromulus committed Mar 15, 2021
1 parent 3ba62ab commit 40acc7c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions klippy/extras/output_pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

PIN_MIN_TIME = 0.100


class PrinterOutputPin:
def __init__(self, config):
self.printer = config.get_printer()
Expand Down Expand Up @@ -34,6 +35,7 @@ def __init__(self, config):
self.reactor = self.printer.get_reactor()
self.safety_timeout = config.getfloat('safety_timeout', 0,
minval=0.)
self.relax_margin = 0.1 * self.safety_timeout + PIN_MIN_TIME
self.mcu_pin.setup_max_duration(self.safety_timeout)
self.resend_timer = self.reactor.register_timer(
self._resend_current_val)
Expand Down Expand Up @@ -82,13 +84,11 @@ def cmd_SET_PIN(self, gcmd):
lambda print_time: self._set_pin(print_time, value, cycle_time))

def _resend_current_val(self, eventtime):
toolhead = self.printer.lookup_object('toolhead')
toolhead.register_lookahead_callback(lambda print_time:
self._set_pin(self.last_print_time + 0.8 * self.safety_timeout,
self.last_value, self.last_cycle_time, True)
)
self._set_pin(self.last_print_time + 0.8 * self.safety_timeout,
self.last_value, self.last_cycle_time, True)

if self.last_value != self.shutdown_value:
return eventtime + 0.7 * self.safety_timeout
return eventtime + (0.8 * self.safety_timeout) - self.relax_margin
return self.reactor.NEVER

def load_config_prefix(config):
Expand Down

0 comments on commit 40acc7c

Please sign in to comment.