diff options
author | Thomas White <taw@physics.org> | 2019-06-15 11:14:29 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-06-15 11:14:29 +0200 |
commit | 1d36406d88766d5e54a1f4a27ce6f6d90e1d163a (patch) | |
tree | 5891f65ad2c3f8a691561743ce6a864843703fe2 /src/scanout.c | |
parent | 59bb7fe96b4448cbbca4d8f7d40c174eab8e8253 (diff) |
Add stop attributes
Diffstat (limited to 'src/scanout.c')
-rw-r--r-- | src/scanout.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/scanout.c b/src/scanout.c index a12094f..53d78c9 100644 --- a/src/scanout.c +++ b/src/scanout.c @@ -23,6 +23,7 @@ #include <string.h> #include <stdlib.h> +#include <assert.h> #include <libsoup/soup.h> #include "nanolight.h" @@ -44,14 +45,23 @@ int scanout_all(struct nanolight *nl) int j; struct fixture *fix = &nl->fixtures[i]; for ( j=0; j<fix->cls->n_attrs; j++ ) { + /* Minus one to convert DMX address to indexing in 'dmx' array */ int pos = fix->base_addr + fix->cls->attrs[j].addr_offset - 1; + if ( universe < 0 ) universe = fix->universe; if ( fix->universe != universe ) { fprintf(stderr, "Sorry, only one universe for now!\n"); abort(); } - if ( fix->cls->attrs[j].props & ATTR_16BIT ) { + + if ( fix->cls->attrs[j].props & ATTR_STOP ) { + + int v = fix->attr_vals[j]; + assert(!(fix->cls->attrs[j].props & ATTR_16BIT)); + dmx[pos] = fix->cls->attrs[j].stops[v]; + + } else if ( fix->cls->attrs[j].props & ATTR_16BIT ) { dmx[pos] = (fix->attr_vals[j] & 0xff00) >> 8; dmx[pos+1] = fix->attr_vals[j] & 0xff; } else { |