Commit 97355a82 authored by D1plo1d's avatar D1plo1d

Adding 'set fan' and 'set motors' to prontserve.

parent da5d5afe
...@@ -25,7 +25,7 @@ A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/ ...@@ -25,7 +25,7 @@ A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/
## Linux ## Linux
### Ubuntu/Debian ### Ubuntu/Debian
You can run Printrun directly from source, as there are no packages available yet. Fetch and install the dependencies using You can run Printrun directly from source, as there are no packages available yet. Fetch and installx the dependencies using
1. `sudo apt-get install python-serial python-wxgtk2.8 python-pyglet python-tornado python-setuptools python-libxml2 python-gobject avahi-daemon libavahi-compat-libdnssd1` 1. `sudo apt-get install python-serial python-wxgtk2.8 python-pyglet python-tornado python-setuptools python-libxml2 python-gobject avahi-daemon libavahi-compat-libdnssd1`
2. `pip install -r requirements.txt` 2. `pip install -r requirements.txt`
......
...@@ -254,10 +254,13 @@ class ConstructSocketHandler(tornado.websocket.WebSocketHandler): ...@@ -254,10 +254,13 @@ class ConstructSocketHandler(tornado.websocket.WebSocketHandler):
""").strip() """).strip()
}, },
"set": { "set": {
'namespaced': True, # namespaced by the machine aspect (temp) 'namespaced': True, # namespaced by the machine aspect (temp/motors/fan)
'named_args': True, 'named_args': True,
'array_args': True,
'args_error': textwrap.dedent(""" 'args_error': textwrap.dedent("""
Set only accepts a namespace and a list of heater, value pairs. Set only accepts a namespace (temp, motors or fan) and a list of
heater, value pairs for the temp or on or off for the motor and fan
namespaces.
""").strip() """).strip()
}, },
"estop": { "estop": {
...@@ -415,11 +418,11 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -415,11 +418,11 @@ class Prontserve(pronsole.pronsole, EventEmitter):
print "Emergency Stop!" print "Emergency Stop!"
self.fire("estop") self.fire("estop")
def do_construct_set(self, subCmd, **kwargs): def do_construct_set(self, subCmd, *args, **kwargs):
method = "do_set_%s"%subCmd method = "do_set_%s"%subCmd
if not hasattr(self, method): if not hasattr(self, method):
raise Exception("%s is not a real namespace"%subCmd) raise Exception("%s is not a real namespace"%subCmd)
getattr(self, method)(**kwargs) getattr(self, method)(*args, **kwargs)
def do_set_temp(self, **kwargs): def do_set_temp(self, **kwargs):
# Setting each temperature individually # Setting each temperature individually
...@@ -433,6 +436,19 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -433,6 +436,19 @@ class Prontserve(pronsole.pronsole, EventEmitter):
self.target_values[k] = kwargs[k] self.target_values[k] = kwargs[k]
self.fire("target_temp_changed", {k: kwargs[k]}) self.fire("target_temp_changed", {k: kwargs[k]})
def do_set_fan(self, *args):
value = {"on": True, "off": False}[args[0].lower()]
if value:
self.p.send_now("M106 S255")
else:
self.p.send_now("M106 S0")
self.fire("fan_speed_changed", 255)
def do_set_motors(self, *args):
value = {"on": True, "off": False}[args[0].lower()]
self.p.send_now({True: "M17", False: "M18"}[value])
self.fire("motors_enabled_changed", value)
def do_set_feedrate(self, **kwargs): def do_set_feedrate(self, **kwargs):
# TODO: kwargs[xy] * 60 and kwargs[z] * 60 # TODO: kwargs[xy] * 60 and kwargs[z] * 60
pass pass
......
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