Changeset - 8268224c1b23
[Not reviewed]
default
0 3 0
drewp@bigasterisk.com - 8 years ago 2017-06-02 06:58:49
drewp@bigasterisk.com
WIP support for choice/enum attrs
Ignore-this: e1a59eef744fa550f6612fdb037cb940
3 files changed with 14 insertions and 3 deletions:
0 comments (0 inline, 0 general)
bin/collector
Show inline comments
 
#!bin/python
 
"""
 
Collector receives device attrs from multiple senders, combines
 
them, and sends output attrs to hardware. The combining part has
 
custom code for some attributes.
 

	
 
Input can be over http or zmq.
 
"""
 

	
 
from __future__ import division
 
from rdflib import URIRef, Literal
 
from twisted.internet import reactor, utils
 
from txzmq import ZmqEndpoint, ZmqFactory, ZmqPullConnection
 
import json
 
import logging
light9/collector/device.py
Show inline comments
 
@@ -111,14 +111,14 @@ def toOutputAttrs(deviceType, deviceAttr
 
    elif deviceType == L9['Mini15']:
 
        out = {
 
            L9['rotationSpeed']: 0, # seems to have no effect
 
            L9['dimmer']: 255,
 
            L9['colorChange']: 0,
 
            L9['colorSpeed']: 0,
 
            L9['goboShake']: 0,
 
            L9['goboChoose']: 0,
 
            L9['goboShake']: _8bit(floatAttr(L9['goboShake'])),
 
            L9['goboChoose']: _8bit(floatAttr(L9['mini15GoboChoice'])),
 
        }
 
        out[L9['red']], out[L9['green']], out[L9['blue']] = rgbAttr(L9['color'])
 
        out[L9['xRotation']], out[L9['xFine']] = fine16Attr(L9['rx'], 1/540)
 
        out[L9['yRotation']], out[L9['yFine']] = fine16Attr(L9['ry'], 1/240)
 
        # didn't find docs on this, but from tests it looks like 64 fine steps takes you to the next coarse step
 

	
show/dance2017/deviceClass.n3
Show inline comments
 
@@ -14,12 +14,15 @@
 
:strobe             a :DeviceAttr; rdfs:label "strobe"; :dataType :scalar;
 
  rdfs:comment "0=none, 1=fastest" .
 
:goboSpeed          a :DeviceAttr; rdfs:label "goboSpeed"; :dataType :scalar ;
 
  rdfs:comment "0=stopped, 1=rotate the fastest".
 
:quantumGoboChoice  a :DeviceAttr; rdfs:label "quantumGoboChoice"; :dataType :choice;
 
  :choice :open, :spider, :windmill, :limbo, :brush, :whirlpool, :stars .
 
:mini15GoboChoice   a :DeviceAttr; :dataType :scalar;
 
  :choice :g1, :g2 .
 
  :goboShake  a :DeviceAttr; :dataType :scalar .
 

	
 

	
 
:SimpleDimmer a :DeviceClass;
 
  :deviceAttr :brightness;
 
  :attr
 
    [ :outputAttr :level; :dmxOffset 0 ] .
 
@@ -30,13 +33,13 @@
 
    [ :outputAttr :mode;  :dmxOffset 0 ],
 
    [ :outputAttr :red;   :dmxOffset 1 ],
 
    [ :outputAttr :green; :dmxOffset 2 ],
 
    [ :outputAttr :blue;  :dmxOffset 3 ] .
 

	
 
:Mini15 a :DeviceClass;
 
  :deviceAttr :color, :rx, :ry;
 
  :deviceAttr :color, :rx, :ry, :mini15GoboChoice, :goboShake ;
 
  :attr
 
    [ :outputAttr :xRotation;     :dmxOffset 0 ],
 
    [ :outputAttr :xFine;         :dmxOffset 1 ],
 
    [ :outputAttr :yRotation;     :dmxOffset 2 ],
 
    [ :outputAttr :yFine;         :dmxOffset 3 ],
 
    [ :outputAttr :rotationSpeed; :dmxOffset 4 ],
0 comments (0 inline, 0 general)