-
Notifications
You must be signed in to change notification settings - Fork 0
/
nanodmx.html
149 lines (134 loc) · 6.52 KB
/
nanodmx.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<script type="text/javascript">
RED.nodes.registerType('nanodmx',{
category: 'DMX',
color: '#ffaaaa',
defaults: {
name: { value: "" },
config: { type: "nanodmx-config", required: true }
},
inputs: 1,
outputs: 1,
icon: "fa_sliders",
label: function() {
return this.name || "nanodmx";
}
});
RED.nodes.registerType('nanodmx-config',{
category: 'config',
defaults: {
name: { value: "" },
port: { value: "", required: true },
dmxStartingAddress: { value: 1 },
baudrate: { value: 38400 },
databits: { value: 8 },
stopbits: { value: 1 },
parity: { value: "none" }
},
label: function() {
return this.name || "nanodmx config";
}
});
</script>
<script type="text/x-red" data-template-name="nanodmx">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-config"><i class="fa fa-cog"></i> Settings</label>
<input type="text" id="node-input-config" placeholder="Add new serial-port...">
</div>
</script>
<script type="text/x-red" data-template-name="nanodmx-config">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-config-input-port"><i class="fa fa-random"></i> Port</label>
<input type="text" id="node-config-input-port" placeholder="something like COM3 or /dev/ttyACM0">
</div>
<div class="form-row">
<label for="node-config-input-baudrate"><i class="fa fa-random"></i> Baudrate</label>
<select type="text" id="node-config-input-baudrate" style="width:50%;">
<option value="19200">19200</option>
<option value="38400">38400</option>
</select>
</div>
<div class="form-row">
<label for="node-config-input-databits"><i class="fa fa-random"></i> Data Bits</label>
8
</div>
<div class="form-row">
<label for="node-config-input-stopbits"><i class="fa fa-random"></i> Stop Bits</label>
1
</div>
<div class="form-row">
<label for="node-config-input-parity"><i class="fa fa-random"></i> Parity</label>
none
</div>
<div class="form-tips" id="tip-waitfor">
<span>
<ul>
<li>The baud rate is generally 38400, but some older devices also support 19200.</li>
<li>Data bits is always 8.</li>
<li>Stopp bits is always 1.</li>
<li>Parity is always none.</li>
</ul>
</span>
</div>
<div class="form-row">
</div>
<div class="form-row">
<label for="node-config-input-dmxStartingAddress"><i class="fa fa-hashtag"></i> DMX Starting Address</label>
<input type="text" id="node-config-input-dmxStartingAddress" placeholder="1">
</div>
</script>
<script type="text/x-red" data-help-name="nanodmx">
<p>Sends DMX data through a DMX4ALL NanoDMX DMX USB device.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">array</span>
</dt>
<dd>nanodmx accepts an array of objects.</dd>
<dt class="optional">Port <span class="property-type">string</span></dt>
<dd>Specify your serial port, e.g. /dev/ttyACM0 or COM3</dd>
<dt class="optional">Baudrate <span class="property-type">number</span></dt>
<dd>Enter the baud rate of your DMX device, either 38400 or 19200. The latter value is only supported by older devices.</dd>
<dt class="optional">Data bits <span class="property-type">number</span></dt>
<dd>DMX4ALL NanoDMX supports 8 data bits. This setting cannot be changed..</dd>
<dt class="optional">Stop bits <span class="property-type">number</span></dt>
<dd>DMX4ALL NanoDMX supports 1 data bit. This setting cannot be changed.</dd>
<dt class="optional">Parity <span class="property-type">string</span></dt>
<dd>DMX4ALL NanoDMX supports <i>none</i> as parity. This setting cannot be changed.</dd>
<dt class="optional">DMX starting address <span class="property-type">number</span></dt>
<dd>The starting address of your universe. Defaults to 1.</dd>
<dt class="optional">Name <span class="property-type">string</span></dt>
<dd>Name this node(optional)</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">as per input</span>
</dt>
<dd>The output is what you have sent to the input, unless you send an empty object or an empty string to the node.</dd>
</dl>
<h3>Details</h3>
<p>nanodmx expects an objects containing simple key/value pairs with the DMX address as key and a value as value.</p>
<p>Looks like this:</p>
<p><code>msg.payload = { "1": 128, "2": 97, "8": 255, "7": 15 };</code></p>
<p>(DMX address 1 gets value 128, DMX address 2 gets value 97, DMX address 8 gets value 255 and DMX address 7 gets value 15)</p>
<p>There is no need to send the values of the entire universe. You can address up to 512 channels, or only one or two or how many you would like to.</p>
<p>If you send an empty payload, the node will return the current universe.</p>
<h3>Hints</h3>
<p>In all cases the setting for the NanoDMX device will be 8-N-1 (8 data bits, no parity, 1 stopbit). The baud rate is 38400, although older devices also support 19200.</p>
<p>If you have problems getting the DMX device to work, take a look at the Node Red log to see if the device could be initialized. Make sure that the user running Node Red is allowed to use the serial interface of your machine.</p>
<h3>Notice</h3>
<p>nanodmx needs the serialport library.</p>
<h3>Thanks</h3>
<p>This is a simplified port from the existing node-dmx (https://www.npmjs.com/package/dmx).
The original package has much more functionality than included here.</p>
<p>Thanks to blechdom who inspired me with her adaption for an Enntec USB interface.
You might find this useful, too (https://github.com/blechdom/node-red-contrib-dmxusbpro).<p>
</script>