changeset 1025:f58b5536f683

ipv6 and some refactor Ignore-this: 8ae5a78848fac996ad777eb74a48e656 darcs-hash:f0b1959fdda425f82cb1bb1581eb46dc909f3c36
author drewp <drewp@bigasterisk.com>
date Sun, 03 Jan 2016 02:32:46 -0800
parents fcd5ef7439ad
children 8e075449ba0a
files service/piNode/devices.py service/piNode/piNode.py
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/service/piNode/devices.py	Sun Jan 03 02:32:33 2016 -0800
+++ b/service/piNode/devices.py	Sun Jan 03 02:32:46 2016 -0800
@@ -125,6 +125,7 @@
 
 @register
 class RgbStrip(DeviceType):
+    """3 PWMs for r/g/b on a strip"""
     deviceType = ROOM['RgbStrip']
     
     @classmethod
@@ -159,13 +160,16 @@
 
     def outputPatterns(self):
         return [(self.uri, ROOM['color'], None)]
+
+    def _rgbFromHex(self, h):
+        rrggbb = h.lstrip('#')
+        return [int(x, 16) for x in [rrggbb[0:2], rrggbb[2:4], rrggbb[4:6]]]
     
     def sendOutput(self, statements):
         assert len(statements) == 1
         assert statements[0][:2] == (self.uri, ROOM['color'])
 
-        rrggbb = statements[0][2].lstrip('#')
-        rgb = [int(x, 16) for x in [rrggbb[0:2], rrggbb[2:4], rrggbb[4:6]]]
+        rgb = self._rgbFromHex(statements[0][2])
 
         for (i, v) in zip(self.rgb, rgb):
             self.pi.set_PWM_dutycycle(i, v)
--- a/service/piNode/piNode.py	Sun Jan 03 02:32:33 2016 -0800
+++ b/service/piNode/piNode.py	Sun Jan 03 02:32:46 2016 -0800
@@ -167,7 +167,7 @@
         (r'/output', OutputPage),
         (r'/boards', Boards),
         #(r'/dot', Dot),
-        ], config=config, board=board, debug=arg['-v']))
+        ], config=config, board=board, debug=arg['-v']), interface='::')
     reactor.run()
 
 main()