diff options
author | Thomas White <taw@physics.org> | 2019-06-14 23:49:28 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-06-14 23:49:28 +0200 |
commit | 6969eb14314ab89a100394a5f6f327e53258cc95 (patch) | |
tree | 01e971f5defff343c16c3153f4aa67445c3511cc /src/scanout.c | |
parent | 8fde1a64d48b1456520cc042a6121f29b72b866f (diff) |
Move DMX universe number into fixture
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]); |