From ec852df0bb8ffeeaef9e26ca0028cc8de4768100 Mon Sep 17 00:00:00 2001 From: Sebastian Wiedenroth Date: Sun, 30 Jul 2017 16:39:02 +0200 Subject: [PATCH] Add device definitions for oppsk-cob-uv-par and lixda-par12-led Always parse the config as JSON from now on --- devices.js | 52 +++++++++++++++++++++++++++++++++++++------- dmx-web-example.conf | 32 ++++++++++++++++++++++----- dmx-web.js | 3 ++- 3 files changed, 73 insertions(+), 14 deletions(-) diff --git a/devices.js b/devices.js index 99256e0..a07feea 100644 --- a/devices.js +++ b/devices.js @@ -52,13 +52,49 @@ module.exports = { } }, 'ultra-pro-24ch-rdm': { - channels: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24' ], - ranges: { - 'dimmer': { - 'type': 'slider', - 'min': 0, - 'max': 255 - } - } + channels: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24' ] + }, + 'oppsk-cob-uv-par': { + channels: ['dimmer', 'strobe', 'program-speed', 'sound-activity'] + }, + 'lixda-par12-led': { + channels: ['ctrl', 'static-color', 'speed', 'dimmer', 'red', 'green', 'blue', 'white'], + ranges: { + 'ctrl': { + 'type': 'option', + 'options': [ + {'value': 0, 'label': 'Off'}, + {'value': 11, 'label': 'Static Color'}, + {'value': 51, 'label': 'Jump'}, + {'value': 101, 'label': 'Gradual'}, + {'value': 151, 'label': 'Sound Activate'}, + {'value': 200, 'label': 'Strobe'} + ] + }, + 'static-color': { + 'type': 'option', + 'options': [ + {'value': 0, 'label': 'All Color'}, + {'value': 40, 'label': 'Red'}, + {'value': 50, 'label': 'Green'}, + {'value': 60, 'label': 'Blue'}, + {'value': 70, 'label': 'Yellow'}, + {'value': 80, 'label': 'Cyan'}, + {'value': 90, 'label': 'Purple'}, + {'value': 100, 'label': 'White'}, + {'value': 110, 'label': 'Red + Green'}, + {'value': 120, 'label': 'Red + Blue'}, + {'value': 130, 'label': 'Red + White'}, + {'value': 140, 'label': 'Green + Blue'}, + {'value': 150, 'label': 'Green + White'}, + {'value': 160, 'label': 'Blue + White'}, + {'value': 170, 'label': 'Red + Green + White'}, + {'value': 180, 'label': 'Red + Blue + White'}, + {'value': 190, 'label': 'Green + Blue + White'}, + {'value': 200, 'label': 'Red + Green + Blue'}, + {'value': 210, 'label': 'Red + Green + Blue + White'} + ] + } + } } } \ No newline at end of file diff --git a/dmx-web-example.conf b/dmx-web-example.conf index bde5ca0..5339d37 100644 --- a/dmx-web-example.conf +++ b/dmx-web-example.conf @@ -3,8 +3,10 @@ "listen_port": 8080, "listen_host": "::", - "comment1": "On linux drop privileges by adding the following lines: uid: www-data and gid: www-data", - "comment2": "On Macos uid and gid must be set in the launchd script." + "_uid": "www-data", + "_gid": "www-data", + "_comment1": "To drop privileges change the '_uid' and '_gid' keys to 'uid' and 'gid'.", + "_comment2": "On macOS uid and gid must be set in the launchd script." }, "presets": [ { @@ -42,7 +44,7 @@ "office": { "output": { "driver": "enttec-usb-dmx-pro", - "device": "/dev/cu.usbserial-6A1KQK87" + "device": "/dev/cu.usbserial-6AVNHXS8" }, "devices": [ { @@ -68,13 +70,33 @@ { "type": "stairville-led-par-56", "address": 76 + }, + { + "type": "oppsk-cob-uv-par", + "address": 99 + }, + { + "type": "lixda-par12-led", + "address": 109 + }, + { + "type": "lixda-par12-led", + "address": 119 + }, + { + "type": "lixda-par12-led", + "address": 129 + }, + { + "type": "lixda-par12-led", + "address": 139 } ] }, "bedroom": { "output": { "driver": "dmxking-ultra-dmx-pro", - "device": "/dev/cu.usbserial-6AVNHXS8", + "device": "/dev/cu.usbserial-6AVNHXS9", "options": { "port": "A" } @@ -109,7 +131,7 @@ "livingroom": { "output": { "driver": "dmxking-ultra-dmx-pro", - "device": "/dev/cu.usbserial-6AVNHXS8", + "device": "/dev/cu.usbserial-6AVNHXS4", "options": { "port": "B" } diff --git a/dmx-web.js b/dmx-web.js index 06073df..9ef849d 100755 --- a/dmx-web.js +++ b/dmx-web.js @@ -1,6 +1,7 @@ #!/usr/bin/env node "use strict" +var fs = require('fs') var http = require('http') var connect = require('connect') var express = require('express') @@ -15,7 +16,7 @@ program .parse(process.argv) -var config = require(program.config) +var config = JSON.parse(fs.readFileSync(program.config, 'utf8')) function DMXWeb() { var app = express()