Commit 96554b73 authored by D1plo1d's avatar D1plo1d

Preventing Prontserve's temperature polling from sending a new request until a...

Preventing Prontserve's temperature polling from sending a new request until a response is received for the previous request.
parent 38ffc996
...@@ -270,6 +270,7 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -270,6 +270,7 @@ class Prontserve(pronsole.pronsole, EventEmitter):
self.current_job = None self.current_job = None
self.previous_job_progress = 0 self.previous_job_progress = 0
self.silent = True self.silent = True
self._sensor_update_received = True
self.init_mdns() self.init_mdns()
self.jobs.listeners.add(self) self.jobs.listeners.add(self)
...@@ -403,7 +404,16 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -403,7 +404,16 @@ class Prontserve(pronsole.pronsole, EventEmitter):
self.previous_job_progress = progress self.previous_job_progress = progress
self.fire("job_progress_changed", progress) self.fire("job_progress_changed", progress)
def print_progress(self):
if(self.p.printing):
return 100*float(self.p.queueindex)/len(self.p.mainqueue)
if(self.sdprinting):
return self.percentdone
return 0
def run_sensor_loop(self): def run_sensor_loop(self):
if self._sensor_update_received:
self._sensor_update_received = False
if self.dry_run: if self.dry_run:
self._receive_sensor_update("ok T:%i"%random.randint(20, 50)) self._receive_sensor_update("ok T:%i"%random.randint(20, 50))
else: else:
...@@ -423,20 +433,11 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -423,20 +433,11 @@ class Prontserve(pronsole.pronsole, EventEmitter):
if l!="ok" and not l.startswith("ok T") and not l.startswith("T:"): if l!="ok" and not l.startswith("ok T") and not l.startswith("T:"):
self._receive_printer_error(l) self._receive_printer_error(l)
def print_progress(self):
if(self.p.printing):
return 100*float(self.p.queueindex)/len(self.p.mainqueue)
if(self.sdprinting):
return self.percentdone
return 0
def _receive_sensor_update(self, l): def _receive_sensor_update(self, l):
self._sensor_update_received = True
words = filter(lambda s: s.find(":") > 0, l.split(" ")) words = filter(lambda s: s.find(":") > 0, l.split(" "))
d = dict([ s.split(":") for s in words]) d = dict([ s.split(":") for s in words])
# print "sensor update received!"
for key, value in d.iteritems(): for key, value in d.iteritems():
self.__update_sensor(key, value) self.__update_sensor(key, value)
......
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