The codebase to run the *spark d-fuser controller www.sparkav.co.uk/dvimixer

Dependencies:   SPK-TVOne DMX DmxArtNet NetServicesMin OSC PinDetect mRotaryEncoder iniparser mbed spk_oled_ssd1305 filter

Files at this revision

API Documentation at this revision

Comitter:
tobyspark
Date:
Fri Jan 17 15:04:33 2014 +0000
Parent:
76:f56c2b955535
Child:
78:7517f0060611
Commit message:
ArtNet brought in line with .ini'd OSC + DMX.; Not compiling, but no errors and nothing obvious. Server issue?

Changed in this revision

SPKDF_ini.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
spk_settings.h Show annotated file Show diff for this revision Revisions of this file
--- a/SPKDF_ini.h	Tue Dec 10 15:51:54 2013 +0000
+++ b/SPKDF_ini.h	Fri Jan 17 15:04:33 2014 +0000
@@ -11,7 +11,8 @@
 # Parameters for the various network modes
 #
 # OSC: if DHCP is set to Yes, the IP address parameters will be ignored.
-# Artnet: Will use the channel mapping set in the DMX section.
+# DMX: no universe setting, it's the cable you plug in!
+# Artnet: Will use the channel mapping set in the DMX section, along with the universe set here.
 
 [OSC]
 
@@ -29,6 +30,7 @@
 
 ControllerAddress = 2.0.0.100
 BroadcastAddress = 2.255.255.255
+Universe = 0
 
 [DMX]
 
--- a/main.cpp	Tue Dec 10 15:51:54 2013 +0000
+++ b/main.cpp	Fri Jan 17 15:04:33 2014 +0000
@@ -305,8 +305,8 @@
 {
     if (artNet->Work()) 
     {
-        int xFadeDMX = artNet->DmxIn[0][0];
-        int fadeUpDMX = artNet->DmxIn[0][1];
+        int xFadeDMX = artNet->DmxIn[settings.artNet.universe][settings.dmx.inChannelXFade];
+        int fadeUpDMX = artNet->DmxIn[settings.artNet.universe][settings.dmx.inChannelFadeUp];
     
         commsXFade  = (float)xFadeDMX/255;
         commsFadeUp = (float)fadeUpDMX/255;
@@ -329,10 +329,19 @@
     int xFadeDMX = xFade*255;
     int fadeUpDMX = fadeUp*255;
     
-    // Universe 0, Channel 0 = xFade, Channel 1 = fadeUp
-    char dmxData[2] = {xFadeDMX, fadeUpDMX};
-    artNet->Send_ArtDmx(0, 0, dmxData, 2);
+    // Create array for all 512 DMX channels in the universe
+    char dmxData[512];
     
+    // Don't set every other channel to 0, rather channel values we already have
+    memcpy(dmxData, artNet->DmxIn[settings.artNet.universe], 512);
+        
+    // Set fade channels
+    dmxData[settings.dmx.outChannelXFade] = xFadeDMX;
+    dmxData[settings.dmx.outChannelFadeUp] = fadeUpDMX;
+    
+    // Send
+    artNet->Send_ArtDmx(settings.artNet.universe, 0, dmxData, 512);
+
     char statusMessageBuffer[kStringBufferLength];
     snprintf(statusMessageBuffer, kStringBufferLength, "A'Net Out: xF%3i fUp %3i", xFadeDMX, fadeUpDMX);
     screen.clearBufferRow(kCommsStatusLine);
--- a/spk_settings.h	Tue Dec 10 15:51:54 2013 +0000
+++ b/spk_settings.h	Fri Jan 17 15:04:33 2014 +0000
@@ -29,6 +29,7 @@
     struct {
         IpAddr controllerAddress;
         IpAddr broadcastAddress;
+        int universe;
     } artNet;
     
     struct {
@@ -60,6 +61,7 @@
         
         artNet.controllerAddress = IpAddr(2,0,0,100);
         artNet.broadcastAddress = IpAddr(2,255,255,255);
+        artNet.universe = 0;
         
         dmx.inChannelXFade = 0;
         dmx.inChannelFadeUp = 1;
@@ -248,6 +250,9 @@
             IpAddr artNetBroadcastAddress = ipAddrWithString(iniparser_getstring(settings, "ArtNet:BroadcastAddress", failString));
             netReadOK = netReadOK && !artNetBroadcastAddress.isNull();
             
+            int universe = iniparser_getint(settings, "ArtNet:Universe", failInt);
+            netReadOK = netReadOK && universe != failInt;
+            
             int inChannelXFade = iniparser_getint(settings, "DMX:InChannelXFade", failInt);
             netReadOK = netReadOK && inChannelXFade != failInt;
             
@@ -274,6 +279,7 @@
     
                 artNet.controllerAddress = artNetControllerAddress;
                 artNet.broadcastAddress = artNetBroadcastAddress;
+                artNet.universe = universe;
         
                 dmx.inChannelXFade = inChannelXFade;
                 dmx.inChannelFadeUp = inChannelFadeUp;