|
From: <j-...@us...> - 2012-11-14 17:54:28
|
Revision: 1142
http://openautomation.svn.sourceforge.net/openautomation/?rev=1142&view=rev
Author: j-n-k
Date: 2012-11-14 17:54:16 +0000 (Wed, 14 Nov 2012)
Log Message:
-----------
Fixed some bugs, added patch function
Modified Paths:
--------------
tools/knxdmxd/knxdmxd
tools/knxdmxd/knxdmxd.conf
tools/knxdmxd/src/cue.cc
tools/knxdmxd/src/cue.h
tools/knxdmxd/src/dmxsender.cc
tools/knxdmxd/src/dmxsender.h
tools/knxdmxd/src/knxdmxd.cc
tools/knxdmxd/src/knxdmxd.h
tools/knxdmxd/src/trigger.cc
Modified: tools/knxdmxd/knxdmxd
===================================================================
(Binary files differ)
Modified: tools/knxdmxd/knxdmxd.conf
===================================================================
--- tools/knxdmxd/knxdmxd.conf 2012-11-14 14:32:26 UTC (rev 1141)
+++ tools/knxdmxd/knxdmxd.conf 2012-11-14 17:54:16 UTC (rev 1142)
@@ -1,35 +1,73 @@
// CAUTION : never uses names starting with _ !!! These are used internally !
{
"channels" : [
- { "name" : "treppe_01", "dmx" : "1.1" },
- { "name" : "treppe_02", "dmx" : "1.2" },
- { "name" : "treppe_03", "dmx" : "1.3" },
- { "name" : "treppe_04", "dmx" : "1.4" },
- { "name" : "treppe_05", "dmx" : "1.5" },
- { "name" : "treppe_06", "dmx" : "1.6" },
- { "name" : "treppe_07", "dmx" : "1.7" },
- { "name" : "treppe_08", "dmx" : "1.8" },
- { "name" : "treppe_09", "dmx" : "1.16" },
- { "name" : "treppe_10", "dmx" : "1.17" },
- { "name" : "treppe_11", "dmx" : "1.18" },
- { "name" : "treppe_12", "dmx" : "1.19" },
- { "name" : "treppe_13", "dmx" : "1.20" },
- { "name" : "kueche_r", "dmx" : "1.40", "statusga" : "12/1/20"},
- { "name" : "kueche_g", "dmx" : "1.41", "statusga" : "12/1/21"},
- { "name" : "kueche_b", "dmx" : "1.42", "statusga" : "12/1/22"}
+ { "name" : "treppe_01", "dmx" : "1.5", "statusga" : "0/3/1" },
+ { "name" : "treppe_02", "dmx" : "1.6", "statusga" : "0/3/2" },
+ { "name" : "treppe_03", "dmx" : "1.7", "statusga" : "0/3/3" },
+ { "name" : "treppe_04", "dmx" : "1.8", "statusga" : "0/3/4" },
+ { "name" : "treppe_05", "dmx" : "1.9", "statusga" : "0/3/5" },
+ { "name" : "treppe_06", "dmx" : "1.14", "statusga" : "0/3/6" },
+ { "name" : "treppe_07", "dmx" : "1.15", "statusga" : "0/3/7" },
+ { "name" : "treppe_08", "dmx" : "1.16", "statusga" : "0/3/8" },
+ { "name" : "treppe_09", "dmx" : "1.17", "statusga" : "0/3/9" },
+ { "name" : "treppe_10", "dmx" : "1.18", "statusga" : "0/3/10" },
+ { "name" : "treppe_11", "dmx" : "1.19", "statusga" : "0/3/11" },
+ { "name" : "treppe_12", "dmx" : "1.20", "statusga" : "0/3/12" },
+ { "name" : "treppe_13", "dmx" : "1.21", "statusga" : "0/3/13" },
+ { "name" : "kueche_r", "dmx" : "1.41", "statusga" : "0/3/20"},
+ { "name" : "kueche_g", "dmx" : "1.42", "statusga" : "0/3/21"},
+ { "name" : "kueche_b", "dmx" : "1.43", "statusga" : "0/3/22"}
],
"dimmers": [ // all dimmer definitions, name is optional (default is _d_<number>), knx-like dimming: fading is calculated for 0-100%
- { "name" : "Treppe01", "channel" : "treppe_01", "ga" : "12/0/1", "fading" : 1, "fadingga" : "1/6/170" },
- { "name" : "Treppe02", "channel" : "treppe_02", "ga" : "12/0/2", "fading" : 1, "fadingga" : "1/6/170" },
- { "name" : "Treppe03", "channel" : "treppe_03", "ga" : "12/0/3", "fading" : 1, "fadingga" : "1/6/170" },
- { "name" : "KuecheR", "channel" : "kueche_r", "ga" : "12/0/20" },
- { "name" : "KuecheG", "channel" : "kueche_g", "ga" : "12/0/21" },
- { "name" : "KuecheB", "channel" : "kueche_b", "ga" : "12/0/22" }
+ { "name" : "Treppe01", "channel" : "treppe_01", "ga" : "0/2/1", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe02", "channel" : "treppe_02", "ga" : "0/2/2", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe03", "channel" : "treppe_03", "ga" : "0/2/3", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe04", "channel" : "treppe_04", "ga" : "0/2/4", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe05", "channel" : "treppe_05", "ga" : "0/2/5", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe06", "channel" : "treppe_06", "ga" : "0/2/6", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe07", "channel" : "treppe_07", "ga" : "0/2/7", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe08", "channel" : "treppe_08", "ga" : "0/2/8", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe09", "channel" : "treppe_09", "ga" : "0/2/9", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe10", "channel" : "treppe_10", "ga" : "0/2/10", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe11", "channel" : "treppe_11", "ga" : "0/2/11", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe12", "channel" : "treppe_12", "ga" : "0/2/12", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "Treppe13", "channel" : "treppe_13", "ga" : "0/2/13", "fading" : 1, "fadingga" : "1/6/170" },
+ { "name" : "KuecheR", "channel" : "kueche_r", "ga" : "0/2/20" },
+ { "name" : "KuecheG", "channel" : "kueche_g", "ga" : "0/2/21" },
+ { "name" : "KuecheB", "channel" : "kueche_b", "ga" : "0/2/22" }
],
-"scenes": [ // all scene definitions
+"scenes": [ // all scene definitions
+ { "name" : "Kueche_Nacht_an",
+ "trigger" : {
+ "go" : {"knx" : "6/3/140", "value" : 1 }
+ },
+ "data" : [
+ { "channel" : "kueche_r", "value" : 180 },
+ { "channel" : "kueche_g", "value" : 180 },
+ { "channel" : "kueche_b", "value" : 180 }
+ ],
+ "fading" : { // all fading times used on scene call !
+ "in" : 1.0, // for increasing intensity
+ "out": 1.0, // for decreasing intensity
+ }
+ },
+ { "name" : "Kueche_Nacht_aus",
+ "trigger" : {
+ "go" : {"knx" : "6/3/140", "value" : 0 }
+ },
+ "data" : [
+ { "channel" : "kueche_r", "value" : 0 },
+ { "channel" : "kueche_g", "value" : 0 },
+ { "channel" : "kueche_b", "value" : 0 }
+ ],
+ "fading" : { // all fading times used on scene call !
+ "in" : 1.0, // for increasing intensity
+ "out": 1.0, // for decreasing intensity
+ }
+ },
{ "name" : "Treppe_Full_On", // name is optional, default is _s_<number>
"trigger" : {
- "go" : { "knx" : "1/0/170", "value" : 1 }, // if value is omitted, scene is called on any value
+ "go" : { "knx" : "1/0/171", "value" : 1 }, // if value is omitted, scene is called on any value
},
"data" : [ // definition of each channel in scene
{ "channel" : "treppe_01", "value" : 255 },
@@ -53,7 +91,7 @@
},
{ "name" : "Treppe_Blackout",
"trigger" : {
- "go" : { "knx" : "1/0/170", "value" : 0 },
+ "go" : { "knx" : "1/0/171", "value" : 0 },
},
"data" : [
{ "channel" : "treppe_01", "value" : 0 },
@@ -89,54 +127,298 @@
}
],
"cuelists": [ // all cuelists
- { "name" : "Treppe Disco",
- "priority" : 100,
- "release_on_halt" : true,
+ { "name" : "Treppe An",
+ "release_on_halt" : false, // release only when explicitely requested (default)
+ "proceed_on_go" : false, // proceed to next steo on go trigger (default)
"trigger" : {
- "go" : { "knx" : "1/0/172", "value" : 1 },
- "halt" : { "knx" : "1/0/172", "value" : 0 },
- "direct" : { "knx" : "1/0/173" }, // direct call of a cue (first is 0)
+ "go" : { "knx" : "1/0/170", "value" : 1 },
+ "halt" : { "knx" : "1/0/173", "value" : 1 },
+ "release" : { "knx" : "1/0/170", "value" : 0 },
+ "direct" : { "knx" : "1/0/174" }, // direct call of a cue (first is 0)
},
"cues" : [ // cues are like scenes, just without individual triggers
{ "name" : "start",
"data" : [
- { "channel" : "treppe_01", "value" : 0 },
+ { "channel" : "treppe_01", "value" : 255 },
{ "channel" : "treppe_02", "value" : 0 },
- { "channel" : "treppe_03", "value" : 0 }
+ { "channel" : "treppe_03", "value" : 0 },
+ { "channel" : "treppe_04", "value" : 0 },
+ { "channel" : "treppe_05", "value" : 0 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 0 },
+ { "channel" : "treppe_10", "value" : 0 },
+ { "channel" : "treppe_11", "value" : 0 },
+ { "channel" : "treppe_12", "value" : 0 },
+ { "channel" : "treppe_13", "value" : 255 },
],
- "waittime" : 3.1, // only relevant for loops
- "delay" : 5,
- "fading" : { "time" : 3 }
+ "waittime" : 0, // only relevant for loops
+ "delay" : 0,
+ "fading" : { "time" : 0.5 }
},
{ "name" : "c1",
"data" : [
{ "channel" : "treppe_01", "value" : 255 },
- { "channel" : "treppe_02", "value" : 0 },
- { "channel" : "treppe_03", "value" : 0 }
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 0 },
+ { "channel" : "treppe_04", "value" : 0 },
+ { "channel" : "treppe_05", "value" : 0 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 0 },
+ { "channel" : "treppe_10", "value" : 0 },
+ { "channel" : "treppe_11", "value" : 0 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
],
- "waittime" : 8.1,
- "fading" : { "time" : 3 }
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
},
{ "name" : "c2",
"data" : [
- { "channel" : "treppe_01", "value" : 0 },
+ { "channel" : "treppe_01", "value" : 255 },
{ "channel" : "treppe_02", "value" : 255 },
- { "channel" : "treppe_03", "value" : 0 }
+ { "channel" : "treppe_03", "value" : 255 },
+ { "channel" : "treppe_04", "value" : 0 },
+ { "channel" : "treppe_05", "value" : 0 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 0 },
+ { "channel" : "treppe_10", "value" : 0 },
+ { "channel" : "treppe_11", "value" : 255 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
],
- "waittime" : 3.1, // waittime start after calling previous cue !
- "fading" : { "time" : 3 }
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
},
{ "name" : "c3",
"data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 255 },
+ { "channel" : "treppe_04", "value" : 255 },
+ { "channel" : "treppe_05", "value" : 0 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 0 },
+ { "channel" : "treppe_10", "value" : 255 },
+ { "channel" : "treppe_11", "value" : 255 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
+ },
+ { "name" : "c4",
+ "data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 255 },
+ { "channel" : "treppe_04", "value" : 255},
+ { "channel" : "treppe_05", "value" : 255 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 255 },
+ { "channel" : "treppe_10", "value" : 255 },
+ { "channel" : "treppe_11", "value" : 255 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5}
+ },
+ { "name" : "c5",
+ "data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 255 },
+ { "channel" : "treppe_04", "value" : 255 },
+ { "channel" : "treppe_05", "value" : 255 },
+ { "channel" : "treppe_06", "value" : 255 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 255 },
+ { "channel" : "treppe_09", "value" : 255 },
+ { "channel" : "treppe_10", "value" : 255 },
+ { "channel" : "treppe_11", "value" : 255 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
+ },
+ { "name" : "c6",
+ "data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 255 },
+ { "channel" : "treppe_04", "value" : 255 },
+ { "channel" : "treppe_05", "value" : 255 },
+ { "channel" : "treppe_06", "value" : 255 },
+ { "channel" : "treppe_07", "value" : 255 },
+ { "channel" : "treppe_08", "value" : 255 },
+ { "channel" : "treppe_09", "value" : 255 },
+ { "channel" : "treppe_10", "value" : 255 },
+ { "channel" : "treppe_11", "value" : 255 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
+ }
+
+ ]
+ },
+ { "name" : "Treppe Aus",
+ "release_on_halt" : false,
+ "proceed_on_go" : false,
+ "trigger" : {
+ "go" : { "knx" : "1/0/170", "value" : 0 },
+ "halt" : { "knx" : "1/0/173", "value" : 0 },
+ "direct" : { "knx" : "1/0/175" }, // direct call of a cue (first is 0)
+ "release" : { "knx" : "1/0/170", "value" : 1 }
+ },
+ "cues" : [ // cues are like scenes, just without individual triggers
+ { "name" : "start",
+ "data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 255 },
+ { "channel" : "treppe_04", "value" : 255 },
+ { "channel" : "treppe_05", "value" : 255 },
+ { "channel" : "treppe_06", "value" : 255 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 255 },
+ { "channel" : "treppe_09", "value" : 255 },
+ { "channel" : "treppe_10", "value" : 255 },
+ { "channel" : "treppe_11", "value" : 255 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0, // only relevant for loops
+ "delay" : 0,
+ "fading" : { "time" : 0.5 }
+ },
+ { "name" : "c1",
+ "data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 255 },
+ { "channel" : "treppe_04", "value" : 255 },
+ { "channel" : "treppe_05", "value" : 255 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 255 },
+ { "channel" : "treppe_10", "value" : 255 },
+ { "channel" : "treppe_11", "value" : 255 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
+ },
+ { "name" : "c2",
+ "data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 255 },
+ { "channel" : "treppe_04", "value" : 255 },
+ { "channel" : "treppe_05", "value" : 0 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 0 },
+ { "channel" : "treppe_10", "value" : 255 },
+ { "channel" : "treppe_11", "value" : 255 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
+ },
+ { "name" : "c3",
+ "data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 255 },
+ { "channel" : "treppe_04", "value" : 0 },
+ { "channel" : "treppe_05", "value" : 0 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 0 },
+ { "channel" : "treppe_10", "value" : 0 },
+ { "channel" : "treppe_11", "value" : 255 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
+ },
+ { "name" : "c4",
+ "data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 255 },
+ { "channel" : "treppe_03", "value" : 0 },
+ { "channel" : "treppe_04", "value" : 0 },
+ { "channel" : "treppe_05", "value" : 0 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 0 },
+ { "channel" : "treppe_10", "value" : 0 },
+ { "channel" : "treppe_11", "value" : 0 },
+ { "channel" : "treppe_12", "value" : 255 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5}
+ },
+ { "name" : "c5",
+ "data" : [
+ { "channel" : "treppe_01", "value" : 255 },
+ { "channel" : "treppe_02", "value" : 0 },
+ { "channel" : "treppe_03", "value" : 0 },
+ { "channel" : "treppe_04", "value" : 0 },
+ { "channel" : "treppe_05", "value" : 0 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 0 },
+ { "channel" : "treppe_10", "value" : 0 },
+ { "channel" : "treppe_11", "value" : 0 },
+ { "channel" : "treppe_12", "value" : 0 },
+ { "channel" : "treppe_13", "value" : 255 },
+ ],
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
+ },
+ { "name" : "c6",
+ "data" : [
{ "channel" : "treppe_01", "value" : 0 },
{ "channel" : "treppe_02", "value" : 0 },
- { "channel" : "treppe_03", "value" : 255 }
+ { "channel" : "treppe_03", "value" : 0 },
+ { "channel" : "treppe_04", "value" : 0 },
+ { "channel" : "treppe_05", "value" : 0 },
+ { "channel" : "treppe_06", "value" : 0 },
+ { "channel" : "treppe_07", "value" : 0 },
+ { "channel" : "treppe_08", "value" : 0 },
+ { "channel" : "treppe_09", "value" : 0 },
+ { "channel" : "treppe_10", "value" : 0 },
+ { "channel" : "treppe_11", "value" : 0 },
+ { "channel" : "treppe_12", "value" : 0 },
+ { "channel" : "treppe_13", "value" : 0 },
],
- "waittime" : 3.1, // waittime start after calling previous cue !
- "fading" : { "time" : 3 }
- },
- { "link" : "start"
+ "waittime" : 0.52,
+ "fading" : { "time" : 0.5 }
}
+
]
},
{ "name" : "KuecheFarbwechsler",
Modified: tools/knxdmxd/src/cue.cc
===================================================================
--- tools/knxdmxd/src/cue.cc 2012-11-14 14:32:26 UTC (rev 1141)
+++ tools/knxdmxd/src/cue.cc 2012-11-14 17:54:16 UTC (rev 1142)
@@ -80,6 +80,7 @@
was_direct_ = false;
cue_halted_ = true;
release_on_halt_ = true;
+ proceed_on_go_ = true;
max_cue_ = 0;
@@ -106,6 +107,30 @@
}
void
+ Cuelist::Go()
+ {
+ std::clog << kLogDebug << "Cue " << _name << ": go ";
+ if ((cue_halted_) && ((current_cue_+1) < max_cue_))
+ {
+ std::clog << "was halted before" << std::endl;
+ cue_halted_ = false;
+ NextCue(-1);
+ }
+ else
+ {
+ if (proceed_on_go_)
+ {
+ std::clog << "was running, next step" << std::endl;
+ NextCue(-2);
+ }
+ else
+ {
+ std::clog << "ignored" << std::endl;
+ }
+ }
+
+ }
+ void
Cuelist::NextCue(const int direct)
{
if (was_direct_)
@@ -167,10 +192,12 @@
(int) (waittime * 1000.),
ola::NewSingleCallback(this, &Cuelist::NextCue, -1));
}
- } else {
- // last cue halts automatically
- Halt();
}
+ else
+ {
+ // last cue halts automatically
+ Halt();
+ }
}
catch (char *str)
{
Modified: tools/knxdmxd/src/cue.h
===================================================================
--- tools/knxdmxd/src/cue.h 2012-11-14 14:32:26 UTC (rev 1141)
+++ tools/knxdmxd/src/cue.h 2012-11-14 17:54:16 UTC (rev 1142)
@@ -99,7 +99,7 @@
{
int current_cue_, max_cue_;
bool cue_halted_, was_direct_;
- bool release_on_halt_;
+ bool release_on_halt_, proceed_on_go_;
// fixture_lock_t lock_;
std::vector<knxdmxd::Cue> cue_data_;
std::map<std::string, int> cue_names_;
@@ -115,25 +115,30 @@
Cuelist(const std::string name);
void
- AddCue(knxdmxd::Cue& cue);
+ SetReleaseOnHalt(const bool release_on_halt)
+ {
+ release_on_halt_ = release_on_halt;
+ std::clog << kLogDebug << "Cue " << _name << ": set release_on_halt to "
+ << release_on_halt << std::endl;
+ }
void
- Go()
+ SetProceedOnGo(const bool proceed_on_go)
{
- if (cue_halted_)
- {
- cue_halted_ = false;
- NextCue(-1);
- }
- else
- {
- NextCue(-2);
- }
+ proceed_on_go_ = proceed_on_go;
+ std::clog << kLogDebug << "Cue " << _name << ": set proceed_on_go to "
+ << proceed_on_go << std::endl;
+ }
- }
- ;
void
+ AddCue(knxdmxd::Cue& cue);
+
+ void
+ Go();
+
+ void
Halt()
{
+ std::clog << kLogDebug << "Cue " << _name << ": halt " << std::endl;
cue_halted_ = true;
if (release_on_halt_)
{
@@ -150,7 +155,7 @@
void
Release()
{
- cue_halted_ = true;
+ std::clog << kLogDebug << "Cue " << _name << ": release " << std::endl;
current_cue_ = -1;
}
;
Modified: tools/knxdmxd/src/dmxsender.cc
===================================================================
--- tools/knxdmxd/src/dmxsender.cc 2012-11-14 14:32:26 UTC (rev 1141)
+++ tools/knxdmxd/src/dmxsender.cc 2012-11-14 17:54:16 UTC (rev 1142)
@@ -17,12 +17,15 @@
int universe, channel;
std::string c(addr);
sscanf((char*) c.c_str(), "%d.%d", &universe, &channel);
- return (channel == -1) ? (universe + 512) : ((((unsigned) universe) << 9) + channel);
+ return
+ (channel == -1) ?
+ (universe + 512) : ((((unsigned) universe) << 9) + channel);
}
// initalize static variables of DMX class
ola::OlaCallbackClientWrapper DMX::m_client;
std::map<char, knxdmxd::pUniverse> DMX::output;
+ std::list<patch_table_t> DMX::patchTable;
bool
DMXSender::Init()
@@ -33,6 +36,22 @@
<< std::endl;
return false;
}
+ if (patchTable.size())
+ {
+ for (std::list<patch_table_t>::const_iterator iterator =
+ patchTable.begin(), end = patchTable.end(); iterator != end;
+ ++iterator)
+ {
+ patch_table_t pEntry = *iterator;
+
+ m_client.GetClient()->Patch(pEntry.device, pEntry.port,
+ ola::OUTPUT_PORT, ola::PATCH, pEntry.universe,
+ ola::NewSingleCallback(this, &DMXSender::PatchComplete));
+
+ }
+
+ }
+
return true;
}
@@ -64,13 +83,15 @@
if (currenttime > fadeend_[i])
{
current_[i] = old_[i] = new_[i];
- std::clog << kLogDebug << "DMXSender: Finished crossfading universe "
+ std::clog << kLogDebug
+ << "DMXSender: Finished crossfading universe "
<< (int) universe_ << " channel " << i << " to "
<< (int) current_[i] << std::endl;
- dmx_addr_t dmx = (universe_ << 9) + i; // calculate dmx-addr
+ dmx_addr_t dmx = (universe_ << 9) + i + 1; // calculate dmx-addr
if (knxdmxd::statusmap.count(dmx))
{
- std::clog << kLogDebug << "DMXSender: writing status update to KNX "
+ std::clog << kLogDebug
+ << "DMXSender: writing status update to KNX "
<< std::endl;
knxdmxd::eib_message_t message;
message.value = (long) new_[i];
Modified: tools/knxdmxd/src/dmxsender.h
===================================================================
--- tools/knxdmxd/src/dmxsender.h 2012-11-14 14:32:26 UTC (rev 1141)
+++ tools/knxdmxd/src/dmxsender.h 2012-11-14 17:54:16 UTC (rev 1142)
@@ -16,10 +16,18 @@
#include <ola/OlaClientWrapper.h>
#include <trigger.h>
#include <map>
+#include <list>
namespace knxdmxd
{
+ typedef struct
+ {
+ unsigned int device;
+ unsigned int port;
+ unsigned int universe;
+ } patch_table_t;
+
class Universe
{
protected:
@@ -29,7 +37,7 @@
ola::thread::Mutex data_mutex;
char universe_;
public:
- Universe(char universe )
+ Universe(char universe)
{
universe_ = universe; // universe should now it's own number
ola::thread::MutexLocker locker(&data_mutex);
@@ -50,13 +58,12 @@
old_[ch] = current_[ch];
float fadeTime = (new_[ch] > current_[ch]) ? fade_in : fade_out;
fadestart_[ch] = Timer::Get();
- fadeend_[ch] = fadestart_[ch]
- + (unsigned long) (fadeTime * 1000.0);
+ fadeend_[ch] = fadestart_[ch] + (unsigned long) (fadeTime * 1000.0);
}
unsigned char
Get(const unsigned channel)
{
- return current_[channel-1];
+ return current_[channel - 1];
}
ola::DmxBuffer &
GetBuffer()
@@ -76,12 +83,12 @@
protected:
static std::map<char, pUniverse> output;
static ola::OlaCallbackClientWrapper m_client;
-
+ static std::list<patch_table_t> patchTable;
public:
DMX()
{
}
- ;
+
static void
SetDMXChannel(const dmx_addr_t channel, const unsigned char value,
const float fade_in = 1.e-4, const float fade_out = 1.e-4)
@@ -89,23 +96,36 @@
int dmxuniverse = (int) (channel / 512), dmxchannel = channel % 512;
output[dmxuniverse]->Set(dmxchannel, value, fade_in, fade_out);
}
- ;
+
char
GetDMXChannel(int channel);
static dmx_addr_t
Address(const std::string &addr);
+
static ola::OlaCallbackClientWrapper&
GetOLAClient()
{
return m_client;
}
- ;
+ static void
+ Patch(unsigned int device, unsigned int port, unsigned int universe)
+ {
+ patch_table_t p;
+ p.device = device;
+ p.port = port;
+ p.universe = universe;
+ patchTable.push_back(p);
+ std::clog << kLogDebug << "Added d " << device << " / p " << port
+ << " / u " << universe << " to patch Table " << std::endl;
+ }
+
};
class DMXSender : private DMX
{
+ private:
bool sender_running_;
public:
@@ -130,71 +150,79 @@
{
return sender_running_;
}
- ;
void
+ PatchComplete(const std::string &error)
+ {
+ std::clog << kLogDebug << "DMX: patch completed : " << error << std::endl;
+ (void) error;
+ }
+
+ void
AddUniverse(char universe)
{
if (!output.count(universe))
{ // only create if not already existing;
pUniverse new_universe = new Universe(universe);
output.insert(std::pair<char, pUniverse>(universe, new_universe));
- std::clog << kLogInfo << "DMXSender created universe " << (int) universe
- << std::endl;
+ std::clog << kLogInfo << "DMXSender created universe "
+ << (int) universe << std::endl;
}
+
}
;
};
class Dimmer : public TriggerHandler
+ {
+ std::string name_;
+ dmx_addr_t dmx_;
+ float fade_time_;
+ eibaddr_t ga_, ga_fading_;
+ public:
+ Dimmer()
{
- std::string name_;
- dmx_addr_t dmx_;
- float fade_time_;
- eibaddr_t ga_, ga_fading_;
- public:
- Dimmer()
- {
- }
- ;
- Dimmer(const std::string name, eibaddr_t ga, dmx_addr_t dmx)
- {
- name_ = name;
- dmx_ = dmx;
- ga_ = ga;
- fade_time_ = 1.e-4;
- std::clog << kLogDebug << "Created dimmer '" << name << "' for " << dmx << std::endl;
- }
- void
- SetFadeTime(float fade_time)
- {
- fade_time_ = fade_time;
- }
- void
- SetFadeKNX(eibaddr_t ga)
- {
- ga_fading_ = ga;
- }
- void
- Process(const Trigger& trigger)
- {
- eibaddr_t ga = trigger.GetKNX();
- std::clog << kLogDebug << "Checking trigger " << trigger << " for " << name_
- << " (GA: " << ga_ << ")" << std::endl;
- if (ga == ga_)
- {
- DMX::SetDMXChannel(dmx_, trigger.GetValue(), fade_time_, fade_time_);
- std::clog << kLogDebug << "Dimmer/Process: Updating value for " << name_ << " to "
- << trigger.GetValue() << std::endl;
- }
- if (ga == ga_fading_)
- {
- std::clog << kLogDebug << "Dimmer/Process: Updating (tba) fading for " << name_
- << " to " << trigger.GetValue() << std::endl;
- }
- }
- };
+ }
+ ;
+ Dimmer(const std::string name, eibaddr_t ga, dmx_addr_t dmx)
+ {
+ name_ = name;
+ dmx_ = dmx;
+ ga_ = ga;
+ fade_time_ = 1.e-4;
+ std::clog << kLogDebug << "Created dimmer '" << name << "' for " << dmx
+ << std::endl;
+ }
+ void
+ SetFadeTime(float fade_time)
+ {
+ fade_time_ = fade_time;
+ }
+ void
+ SetFadeKNX(eibaddr_t ga)
+ {
+ ga_fading_ = ga;
+ }
+ void
+ Process(const Trigger& trigger)
+ {
+ eibaddr_t ga = trigger.GetKNX();
+ std::clog << kLogDebug << "Checking trigger " << trigger << " for "
+ << name_ << " (GA: " << ga_ << ")" << std::endl;
+ if (ga == ga_)
+ {
+ DMX::SetDMXChannel(dmx_, trigger.GetValue(), fade_time_, fade_time_);
+ std::clog << kLogDebug << "Dimmer/Process: Updating value for "
+ << name_ << " to " << trigger.GetValue() << std::endl;
+ }
+ if (ga == ga_fading_)
+ {
+ std::clog << kLogDebug << "Dimmer/Process: Updating (tba) fading for "
+ << name_ << " to " << trigger.GetValue() << std::endl;
+ }
+ }
+ };
}
Modified: tools/knxdmxd/src/knxdmxd.cc
===================================================================
--- tools/knxdmxd/src/knxdmxd.cc 2012-11-14 14:32:26 UTC (rev 1141)
+++ tools/knxdmxd/src/knxdmxd.cc 2012-11-14 17:54:16 UTC (rev 1142)
@@ -179,24 +179,27 @@
len = EIBSendAPDU(con, len, buf);
if (len == -1)
{
- std::clog << kLogDebug << "KNXSender: failed to sent " << (int) message.value
- << " to " << message.ga << " (DPT: " << (int) message.dpt
- << ")" << std::endl;
+ std::clog << kLogDebug << "KNXSender: failed to sent "
+ << (int) message.value << " to " << message.ga << " (DPT: "
+ << (int) message.dpt << ")" << std::endl;
}
else
{
- std::clog << kLogDebug << "KNXSender: sent " << (int) message.value << " to "
- << message.ga << " (DPT: " << (int) message.dpt << ")"
- << std::endl;
+ std::clog << kLogDebug << "KNXSender: sent "
+ << (int) message.value << " to " << message.ga << " (DPT: "
+ << (int) message.dpt << ")" << std::endl;
}
usleep(25000); // wait 25 ms, max. 40 tps
EIBClose(con);
- } else {
- std::clog << kLogDebug << "KNX sender waiting for message" << std::endl;
- KNXSender::condition_toKNX.Wait(&KNXSender::mutex_toKNX);
- std::clog << kLogDebug << "KNX sender resumed" << std::endl;
+ }
+ else
+ {
+ std::clog << kLogDebug << "KNX sender waiting for message"
+ << std::endl;
+ KNXSender::condition_toKNX.Wait(&KNXSender::mutex_toKNX);
+ std::clog << kLogDebug << "KNX sender resumed" << std::endl;
}
}
@@ -271,8 +274,8 @@
val = (len == 2) ? buf[1] & 0x3F : buf[2];
if (KNXHandler::listenGA.count(dest))
{ // keep queue clean from unwanted messages
- std::clog << kLogDebug << "KNXHandler: " << dest << " "
- << (int) val << std::endl;
+ std::clog << kLogDebug << "KNXHandler: " << dest
+ << " " << (int) val << std::endl;
knxdmxd::Trigger trigger(knxdmxd::kTriggerAll, dest,
val);
ola::thread::MutexLocker locker(
@@ -532,13 +535,37 @@
<< " while trying to parse config file " << std::endl;
exit(EXIT_FAILURE);
}
+ /*
+ * patch table
+ */
+ struct json_object *in_data = json_object_object_get(config, "patch");
+ int in_length = (in_data) ? json_object_array_length(in_data) : 0;
+ if (in_length>0) {
+ std::clog << "Trying to import " << in_length << " patche(s)" << std::endl;
+ } else {
+ std::clog << kLogInfo << "No patches defined, manual output patch needed" << std::endl;
+ }
+ for (int i = 0; i < in_length; i++)
+ { // read all
+ struct json_object *element = json_object_array_get_idx(in_data, i);
+ struct json_object *d = json_object_object_get(element, "device");
+ struct json_object *p = json_object_object_get(element, "port");
+ struct json_object *u = json_object_object_get(element, "universe");
+
+ if ((!d) || (!p) || (!u)) { std::clog << kLogInfo << "Skipping errorneous patch " << i+1 << std::endl;
+ continue;
+ }
+
+ knxdmxd::DMX::Patch(json_object_get_int(d), json_object_get_int(p), json_object_get_int(u));
+ }
+
/*
* channel definitions
*/
- struct json_object *in_data = json_object_object_get(config, "channels");
- int in_length = json_object_array_length(in_data);
+ in_data = json_object_object_get(config, "channels");
+ in_length = json_object_array_length(in_data);
std::clog << "Trying to import " << in_length << " channel(s)" << std::endl;
for (int i = 0; i < in_length; i++)
@@ -584,7 +611,8 @@
in_data = json_object_object_get(config, "dimmers");
in_length = json_object_array_length(in_data);
- std::clog << kLogDebug << "Trying to import " << in_length << " dimmer(s)" << std::endl;
+ std::clog << kLogDebug << "Trying to import " << in_length << " dimmer(s)"
+ << std::endl;
for (int i = 0; i < in_length; i++)
{ // read all
@@ -665,7 +693,8 @@
struct json_object *cuelists = json_object_object_get(config, "cuelists");
int cuelistnum = json_object_array_length(cuelists);
- std::clog << kLogDebug << "Trying to import " << cuelistnum << " cuelist(s)" << std::endl;
+ std::clog << kLogDebug << "Trying to import " << cuelistnum << " cuelist(s)"
+ << std::endl;
for (int i = 0; i < cuelistnum; i++)
{ // read all
@@ -677,9 +706,18 @@
(name) ? json_object_get_string(name) : "_c_" + t_to_string(i);
knxdmxd::Cuelist *c = new knxdmxd::Cuelist(cname);
- //struct json_object *lprio = json_object_object_get(cuelist, "priority");
- //int prio = (lprio) ? json_object_get_int(lprio) : 0;
+ struct json_object *roh = json_object_object_get(cuelist, "release_on_halt");
+ if (roh) {
+ bool rohval = json_object_get_boolean(roh);
+ c->SetReleaseOnHalt(rohval);
+ }
+ struct json_object *pog = json_object_object_get(cuelist, "proceed_on_go");
+ if (pog) {
+ bool pogval = json_object_get_boolean(roh);
+ c->SetProceedOnGo(pogval);
+ }
+
// get cues
struct json_object *cues = json_object_object_get(cuelist, "cues");
for (int i = 0; i < json_object_array_length(cues); i++)
@@ -721,6 +759,13 @@
{
triggerList.Add(*trigger, c);
}
+
+ trigger = json_get_trigger(json_object_object_get(triggers, "release"),
+ knxdmxd::kTriggerRelease);
+ if (trigger)
+ {
+ triggerList.Add(*trigger, c);
+ }
}
return;
@@ -777,8 +822,8 @@
std::clog.rdbuf(
new Log(DAEMON_NAME, LOG_CONS | LOG_NDELAY | LOG_PERROR | LOG_PID,
LOG_USER));
- std::clog << kLogDebug << "startup with debug; pidfile: " << pidfilename << ", eibd: "
- << knxhandler.GetEIBDURL() << std::endl;
+ std::clog << kLogDebug << "startup with debug; pidfile: " << pidfilename
+ << ", eibd: " << knxhandler.GetEIBDURL() << std::endl;
}
else
{
Modified: tools/knxdmxd/src/knxdmxd.h
===================================================================
--- tools/knxdmxd/src/knxdmxd.h 2012-11-14 14:32:26 UTC (rev 1141)
+++ tools/knxdmxd/src/knxdmxd.h 2012-11-14 17:54:16 UTC (rev 1142)
@@ -21,6 +21,7 @@
#include <sys/time.h>
#define DMX_INTERVAL 50 // in ms
+
namespace knxdmxd
{
const int kFixture = 1;
Modified: tools/knxdmxd/src/trigger.cc
===================================================================
--- tools/knxdmxd/src/trigger.cc 2012-11-14 14:32:26 UTC (rev 1141)
+++ tools/knxdmxd/src/trigger.cc 2012-11-14 17:54:16 UTC (rev 1142)
@@ -46,43 +46,48 @@
{
_triggers.push_back(trigger);
_handlers.push_back(handler);
- std::clog << kLogDebug << "Added Trigger " << trigger << " for handler " << (*handler)
- << std::endl;
+ std::clog << kLogDebug << "Added Trigger " << trigger << " for handler "
+ << (*handler) << std::endl;
}
void
TriggerList::Process()
{
- if (KNXHandler::fromKNX.empty())
- return;
- Trigger trigger;
+ while (!KNXHandler::fromKNX.empty())
{
- ola::thread::MutexLocker locker(&KNXHandler::mutex_fromKNX);
- trigger = KNXHandler::fromKNX.front();
- KNXHandler::fromKNX.pop();
- }
- for (unsigned i = 0; i < _triggers.size(); i++)
- {
- knxdmxd::Trigger tr = _triggers[i];
- if (tr == trigger)
+ Trigger trigger;
{
- switch (tr.GetType())
+ ola::thread::MutexLocker locker(&KNXHandler::mutex_fromKNX);
+ trigger = KNXHandler::fromKNX.front();
+ KNXHandler::fromKNX.pop();
+ }
+
+ for (unsigned i = 0; i < _triggers.size(); i++)
+ {
+ knxdmxd::Trigger tr = _triggers[i];
+ if (tr == trigger)
{
- case kTriggerGo:
- _handlers[i]->Go();
- break;
- case kTriggerHalt:
- _handlers[i]->Halt();
- break;
- case kTriggerDirect:
- _handlers[i]->Direct(trigger.GetValue());
- break;
- case kTriggerProcess:
- _handlers[i]->Process(trigger);
- break;
- default:
- break;
+ switch (tr.GetType())
+ {
+ case kTriggerGo:
+ _handlers[i]->Go();
+ break;
+ case kTriggerHalt:
+ _handlers[i]->Halt();
+ break;
+ case kTriggerDirect:
+ _handlers[i]->Direct(trigger.GetValue());
+ break;
+ case kTriggerRelease:
+ _handlers[i]->Release();
+ break;
+ case kTriggerProcess:
+ _handlers[i]->Process(trigger);
+ break;
+ default:
+ break;
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|