Commit d2c59593 authored by D1plo1d's avatar D1plo1d

Fixing prontserve's estop so it updates all the client's pushed values.

parent a33d62e6
...@@ -479,6 +479,21 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -479,6 +479,21 @@ class Prontserve(pronsole.pronsole, EventEmitter):
raise Exception("Continuous movement not supported") raise Exception("Continuous movement not supported")
def do_estop(self): def do_estop(self):
self.reset()
print "Emergency Stop!"
self.fire("estop")
# Updating the job progress
print self.print_progress()
self.update_job_progress(self.print_progress())
for k, v in self.target_values.iteritems():
self._set_target_temp(k, 0)
self.do_set_motors("off")
self.do_set_fan("off")
progress = {'eta': 0, 'percent': 100}
self.fire("target_temp_progress_changed", {'e0': progress})
def reset(self):
self.printing_jobs = False self.printing_jobs = False
self.current_job = None self.current_job = None
self.waiting_to_reach_temp = False self.waiting_to_reach_temp = False
...@@ -492,8 +507,9 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -492,8 +507,9 @@ class Prontserve(pronsole.pronsole, EventEmitter):
# restart the firmware # restart the firmware
pronsole.pronsole.do_reset(self, "") pronsole.pronsole.do_reset(self, "")
print "Emergency Stop!" self.p.printing = False
self.fire("estop")
def do_construct_set(self, subCmd, *args, **kwargs): def do_construct_set(self, subCmd, *args, **kwargs):
method = "do_set_%s"%subCmd method = "do_set_%s"%subCmd
...@@ -591,7 +607,7 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -591,7 +607,7 @@ class Prontserve(pronsole.pronsole, EventEmitter):
gen.Task(self.ioloop.add_timeout(next_timeout, self.run_print_queue_loop)) gen.Task(self.ioloop.add_timeout(next_timeout, self.run_print_queue_loop))
def update_job_progress(self, progress): def update_job_progress(self, progress):
if progress != self.previous_job_progress and self.current_job != None: if progress != self.previous_job_progress:
self.previous_job_progress = progress self.previous_job_progress = progress
self.fire("job_progress_changed", progress) self.fire("job_progress_changed", progress)
...@@ -600,7 +616,7 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -600,7 +616,7 @@ class Prontserve(pronsole.pronsole, EventEmitter):
return 100*float(self.p.queueindex)/len(self.p.mainqueue) return 100*float(self.p.queueindex)/len(self.p.mainqueue)
if(self.sdprinting): if(self.sdprinting):
return self.percentdone return self.percentdone
return "0" return 0
def run_sensor_loop(self): def run_sensor_loop(self):
# A number of conditions that must be met for us to send a temperature # A number of conditions that must be met for us to send a temperature
...@@ -821,7 +837,7 @@ if __name__ == "__main__": ...@@ -821,7 +837,7 @@ if __name__ == "__main__":
sys.exit(1) sys.exit(1)
time.sleep(2) time.sleep(2)
prontserve.do_estop() prontserve.reset()
prontserve.run_sensor_loop() prontserve.run_sensor_loop()
prontserve.run_print_queue_loop() prontserve.run_print_queue_loop()
......
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