aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/toolhead.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-02-20 20:50:06 -0500
committerKevin O'Connor <kevin@koconnor.net>2018-03-06 11:30:46 -0500
commit08a5f8a5ffbc4a3aed825f8e9840702faab482d7 (patch)
tree97b469d56bfb04577187df0398f460f7165e3bbb /klippy/toolhead.py
parent43ac56766e39d9a85372cdf7c1926ffa049f9342 (diff)
downloadkutter-08a5f8a5ffbc4a3aed825f8e9840702faab482d7.tar.gz
kutter-08a5f8a5ffbc4a3aed825f8e9840702faab482d7.tar.xz
kutter-08a5f8a5ffbc4a3aed825f8e9840702faab482d7.zip
display: Add initial support for LCD screens attached to an MCU
Add support for displaying basic status information on ST7920 and HD44780 based LCDs that are attached directly to a micro-controller. Signed-off-by: Marcio Teixeira <marcio@alephobjects.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r--klippy/toolhead.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index 1b5021c0..d6b36cc9 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -205,6 +205,7 @@ class ToolHead:
self.move_flush_time = config.getfloat(
'move_flush_time', 0.050, above=0.)
self.print_time = 0.
+ self.last_print_start_time = 0.
self.need_check_stall = -1.
self.print_stall = 0
self.sync_print_time = True
@@ -236,8 +237,9 @@ class ToolHead:
self.sync_print_time = False
self.need_motor_off = True
est_print_time = self.mcu.estimated_print_time(self.reactor.monotonic())
- self.print_time = max(
- self.print_time, est_print_time + self.buffer_time_start)
+ if est_print_time + self.buffer_time_start > self.print_time:
+ self.print_time = est_print_time + self.buffer_time_start
+ self.last_print_start_time = self.print_time
self.reactor.update_timer(self.flush_timer, self.reactor.NOW)
return self.print_time
def _flush_lookahead(self, must_sync=False):
@@ -365,6 +367,16 @@ class ToolHead:
is_active = buffer_time > -60. or not self.sync_print_time
return is_active, "print_time=%.3f buffer_time=%.3f print_stall=%d" % (
self.print_time, max(buffer_time, 0.), self.print_stall)
+ def get_status(self, eventtime):
+ buffer_time = self.print_time - self.mcu.estimated_print_time(eventtime)
+ if buffer_time > -1. or not self.sync_print_time:
+ status = "Printing"
+ elif self.need_motor_off:
+ status = "Ready"
+ else:
+ status = "Idle"
+ printing_time = self.print_time - self.last_print_start_time
+ return {'status': status, 'printing_time': printing_time}
def printer_state(self, state):
if state == 'shutdown':
try: