diff options
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 { |