Commit 6f7ecce7 authored by Guillaume Seguin's avatar Guillaume Seguin

Improve responsivity by reducing sleep times

parent 04060416
...@@ -94,7 +94,7 @@ class printcore(): ...@@ -94,7 +94,7 @@ class printcore():
self.baud = baud self.baud = baud
if self.port is not None and self.baud is not None: if self.port is not None and self.baud is not None:
disable_hup(self.port) disable_hup(self.port)
self.printer = Serial(port = self.port, baudrate = self.baud, timeout = 1) self.printer = Serial(port = self.port, baudrate = self.baud, timeout = 0.25)
self.stop_read_thread = False self.stop_read_thread = False
self.read_thread = Thread(target=self._listen) self.read_thread = Thread(target=self._listen)
self.read_thread.start() self.read_thread.start()
...@@ -146,7 +146,7 @@ class printcore(): ...@@ -146,7 +146,7 @@ class printcore():
except: pass except: pass
self.online = True self.online = True
return return
time.sleep(0.5) time.sleep(0.25)
def _listen(self): def _listen(self):
"""This function acts on messages from the firmware """This function acts on messages from the firmware
......
...@@ -1367,7 +1367,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -1367,7 +1367,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.auto_monitor_pattern = re.compile(r"(ok\s+)?T:[\d\.]+(\s+B:[\d\.]+)?(\s+@:[\d\.]+)?\s*") self.auto_monitor_pattern = re.compile(r"(ok\s+)?T:[\d\.]+(\s+B:[\d\.]+)?(\s+@:[\d\.]+)?\s*")
self.capture_skip[self.auto_monitor_pattern] = self.capture_skip.setdefault(self.auto_monitor_pattern, 0) + 1 self.capture_skip[self.auto_monitor_pattern] = self.capture_skip.setdefault(self.auto_monitor_pattern, 0) + 1
self.p.send_now("M105") self.p.send_now("M105")
time.sleep(self.monitor_interval) cur_time = time.time()
while time.time() < cur_time + self.monitor_interval:
if not self.statuscheck:
break
time.sleep(0.25)
while not self.sentlines.empty(): while not self.sentlines.empty():
try: try:
gc = self.sentlines.get_nowait() gc = self.sentlines.get_nowait()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment