diff options
Diffstat (limited to 'src/scanout.c')
-rw-r--r-- | src/scanout.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/scanout.c b/src/scanout.c index 49c6b6b..a12094f 100644 --- a/src/scanout.c +++ b/src/scanout.c @@ -34,6 +34,7 @@ int scanout_all(struct nanolight *nl) int i; int dmx[512]; char str[8200]; + signed int universe = -1; /* Start from zero */ for ( i=0; i<512; i++ ) dmx[i] = 0; @@ -45,6 +46,11 @@ int scanout_all(struct nanolight *nl) 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 ) { dmx[pos] = (fix->attr_vals[j] & 0xff00) >> 8; dmx[pos+1] = fix->attr_vals[j] & 0xff; @@ -54,8 +60,10 @@ int scanout_all(struct nanolight *nl) } } + if ( universe == -1 ) return 0; /* Nothing to do! */ + /* Loop over DMX channels and prepare request */ - strcpy(str, "u=1&d="); + snprintf(str, 16, "u=%i&d=", universe); for ( i=0; i<512; i++ ) { char tmp[6]; snprintf(tmp, 5, "%i,", dmx[i]); |