ctdo config

This commit is contained in:
hennieliminator 2013-01-11 15:29:38 +01:00
parent 6dcea928c1
commit 7041e718ed
6 changed files with 219 additions and 158 deletions

View File

@ -2,9 +2,12 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="72d93b4a-de8e-43f1-9d4b-34713e827c14" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/states.json" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/configs/hackcenter/index.html" />
<change type="DELETED" beforePath="$PROJECT_DIR$/oscMap.json" afterPath="" />
<change type="MOVED" beforePath="$PROJECT_DIR$/index.html" afterPath="$PROJECT_DIR$/configs/ctdo/index.html" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app.js" afterPath="$PROJECT_DIR$/app.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/states.json" afterPath="$PROJECT_DIR$/states.json" />
</list>
<ignored path="nodeartnet.iws" />
<ignored path=".idea/workspace.xml" />
@ -73,34 +76,25 @@
<file leaf-file-name="app.js" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor">
<state line="17" column="35" selection-start="646" selection-end="646" vertical-scroll-proportion="0.2628205">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="states.json" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/states.json">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="oscMap.json" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/oscMap.json">
<provider selected="true" editor-type-id="text-editor">
<state line="24" column="37" selection-start="496" selection-end="496" vertical-scroll-proportion="0.0">
<state line="87" column="34" selection-start="2608" selection-end="2608" vertical-scroll-proportion="0.74358976">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="index.html" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/index.html">
<entry file="file://$PROJECT_DIR$/configs/ctdo/index.html">
<provider selected="true" editor-type-id="text-editor">
<state line="80" column="74" selection-start="3859" selection-end="3859" vertical-scroll-proportion="-12.716216">
<state line="68" column="76" selection-start="3227" selection-end="3227" vertical-scroll-proportion="-14.375">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="oscMap.json" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/configs/ctdo/oscMap.json">
<provider selected="true" editor-type-id="text-editor">
<state line="9" column="25" selection-start="157" selection-end="157" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@ -132,6 +126,8 @@
<option value="$PROJECT_DIR$/bootstrap/css/style.css" />
<option value="$PROJECT_DIR$/index.html" />
<option value="$PROJECT_DIR$/oscMap.json" />
<option value="$PROJECT_DIR$/configs/ctdo/oscMap.json" />
<option value="$PROJECT_DIR$/configs/ctdo/index.html" />
<option value="$PROJECT_DIR$/app.js" />
</list>
</option>
@ -208,7 +204,11 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="node_modules" />
<option name="myItemId" value="configs" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="hackcenter" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@ -222,73 +222,11 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="node_modules" />
<option name="myItemId" value="configs" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="node-osc" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="nodeartnet" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="nodeartnet" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="node_modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="node-osc" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="lib" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="nodeartnet" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="nodeartnet" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="node_modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="artnet" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="nodeartnet" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="nodeartnet" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="node_modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="artnet" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="lib" />
<option name="myItemId" value="ctdo" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@ -308,7 +246,11 @@
<property name="MemberChooser.copyJavadoc" value="false" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/configs/ctdo" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/configs/hackcenter" />
<recent name="$PROJECT_DIR$/bootstrap/js" />
</key>
</component>
@ -494,12 +436,16 @@
<created>1357781130763</created>
<updated>1357781130763</updated>
</task>
<option name="localTasksCounter" value="7" />
<task id="LOCAL-00007" summary="update OSC Devices on every oscmessage with all states&#10;save states to file, to recover on restart">
<created>1357826790758</created>
<updated>1357826790758</updated>
</task>
<option name="localTasksCounter" value="8" />
<servers />
</component>
<component name="ToolWindowManager">
<frame x="2" y="18" width="1362" height="729" extended-state="0" />
<editor active="false" />
<editor active="true" />
<layout>
<window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.18616144" sideWeight="0.497426" order="7" side_tool="false" content_ui="tabs" />
@ -517,7 +463,7 @@
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24961948" sideWeight="0.81383854" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24961948" sideWeight="0.81383854" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
@ -565,7 +511,7 @@
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
<option name="LAST_COMMIT_MESSAGE" value="only devices in oscMap trigger dmxsend" />
<option name="LAST_COMMIT_MESSAGE" value="update OSC Devices on every oscmessage with all states&#10;save states to file, to recover on restart" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
@ -584,6 +530,7 @@
<MESSAGE value="bugfix" />
<MESSAGE value="round dmx value" />
<MESSAGE value="only devices in oscMap trigger dmxsend" />
<MESSAGE value="update OSC Devices on every oscmessage with all states&#10;save states to file, to recover on restart" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
@ -596,7 +543,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.html">
<entry file="file://$PROJECT_DIR$/configs/hackcenter/index.html">
<provider selected="true" editor-type-id="text-editor">
<state line="24" column="96" selection-start="672" selection-end="672" vertical-scroll-proportion="0.0">
<folding />
@ -645,13 +592,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.html">
<provider selected="true" editor-type-id="text-editor">
<state line="80" column="74" selection-start="3859" selection-end="3859" vertical-scroll-proportion="-12.716216">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/bootstrap/css/style.css">
<provider selected="true" editor-type-id="text-editor">
<state line="67" column="22" selection-start="1008" selection-end="1008" vertical-scroll-proportion="0.0">
@ -659,23 +599,30 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/oscMap.json">
<entry file="file://$PROJECT_DIR$/configs/hackcenter/index.html">
<provider selected="true" editor-type-id="text-editor">
<state line="24" column="37" selection-start="496" selection-end="496" vertical-scroll-proportion="0.0">
<state line="80" column="74" selection-start="3859" selection-end="3859" vertical-scroll-proportion="2.388325">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/states.json">
<entry file="file://$PROJECT_DIR$/configs/ctdo/oscMap.json">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<state line="9" column="25" selection-start="157" selection-end="157" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/configs/ctdo/index.html">
<provider selected="true" editor-type-id="text-editor">
<state line="68" column="76" selection-start="3227" selection-end="3227" vertical-scroll-proportion="-14.375">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor">
<state line="17" column="35" selection-start="646" selection-end="646" vertical-scroll-proportion="0.2628205">
<state line="87" column="34" selection-start="2608" selection-end="2608" vertical-scroll-proportion="0.74358976">
<folding />
</state>
</provider>

View File

@ -1,21 +1,22 @@
var config = "ctdo"
var express = require('express');
var app = express();
var server = require('http').createServer(app), io = require('socket.io').listen(server);
var osc = require('node-osc');
var oscMap = require('./oscMap.json');
var oscMap = require("./configs/" + config + "/oscMap.json");
var states = require("./configs/" + config + "/states.json");
var fs = require('fs');
var host = process.argv.length > 2 ? process.argv[2] : '192.168.8.101';
var host = process.argv.length > 2 ? process.argv[2] : '195.160.169.33'
var port = process.argv.length > 3 ? process.argv[3] : '9000';
var oscSender = new osc.Client(host, port);
var oscReceiver = new osc.Server(3333, '0.0.0.0');
var artnetclient = require('./node_modules/artnet/lib/artnet_client');
var dmxClient = artnetclient.createClient("192.168.8.255", 6454);
var dmxClient = artnetclient.createClient("195.160.169.15", 6454);
var states = require("./states.json");
var dmxData = new Array(512);
for(var i=0; i<512;i++) {
dmxData[i] = 0;
@ -25,7 +26,7 @@ server.listen(8081);
app.use(express.static('bootstrap'));
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
res.sendfile(__dirname + '/configs/' + config + '/index.html');
});
io.sockets.on('connection', function (socket) {
@ -72,14 +73,14 @@ function handleMessage(msg) {
// get mapped dmx channel
if(oscMap[chan] != null) {
dmxData[oscMap[chan]] = Math.round(value*255);
dmxData[oscMap[chan]-1] = Math.round(value*255);
console.log(Math.round(value*255));
dmxClient.send(dmxData);
}
// update osc devices to show the current state
// to be done in extra function (with whole states array?)
updateDevices();
fs.writeFile("./states.json", JSON.stringify(states, null, 4));
fs.writeFile("./configs/" + config + "/states.json", JSON.stringify(states, null, 4));
}
function updateDevices() {
for(var chan in states) {

View File

@ -0,0 +1,145 @@
<!DOCTYPE html>
<html>
<head>
<title>ctdo light control</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/style.css" rel="stylesheet" media="screen">
<script src="js/jquery-1.8.3.min.js"></script>
</head>
<body>
<div class="container left">
<h3>ctdo light control</h3>
<div class="row">
<div class="span3">
<div class="btn-group wabe-1-1-red" data-channel="/1/rgb1/1">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
<div class="btn-group wabe-1-1-green" data-channel="/1/rgb1/2">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
<div class="btn-group wabe-1-1-blue" data-channel="/1/rgb1/3">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
</div>
<div class="span3">
<div class="btn-group wabe-3-1-red" data-channel="/1/rgb2/1">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
<div class="btn-group wabe-3-1-green" data-channel="/1/rgb2/2">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
<div class="btn-group wabe-3-1-blue" data-channel="/1/rgb2/3">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
</div>
<div class="span3">
<div class="btn-group wabe-4-1-red" data-channel="/1/rgb3/1">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
<div class="btn-group wabe-4-1-green" data-channel="/1/rgb3/2">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
<div class="btn-group wabe-4-1-blue" data-channel="/1/rgb3/3">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
</div>
</div>
<div class="row">
<div class="span3">
<div class="btn-group wabe-5-1-red" data-channel="/1/rgb4/1">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
<div class="btn-group wabe-5-1-green" data-channel="/1/rgb4/2">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
<div class="btn-group wabe-5-1-blue" data-channel="/1/rgb4/3">
<button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button>
</div>
</div>
</div>
</div>
<!--
<div class="container right">
<div class="span2">
LED
</div>
</div>
<div class="container right">
<div class="span2">
<input type="range" name="right-slider" id="right-slider" min="0" max="100" value="0" />
</div>
</div>
-->
<br style="clear: both" />
<!--
<div class="container bottom">
<input type="range" name="bottom-slider" id="bottom-slider" min="0" max="100" value="0" />
</div> -->
<div class="footer">
from top to bottom: red/green/blue
</div>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://' + window.location.hostname + ":" + window.location.port);
socket.on('news', function (data) {
console.log(data);
//
//handleDMXData(data);
});
$(document).ready(function(evnt) {
$(document).delegate('.btn-success', 'click', function(event) {
var channel = $(this).parent().data('channel');
if(channel != null) {
socket.emit('oscmessage', { chan: channel, val: 1 });
}
});
$(document).delegate('.btn-danger', 'click', function(event) {
var channel = $(this).parent().data('channel');
if(channel != null) {
socket.emit('oscmessage', { chan: channel, val: 0 });
}
});
/*
$(document).delegate('#bottom-slider', 'change', function(event) {
socket.emit('oscmessage', { chan: '/1/fader1', val: })
}); */
});
</script>
<script src="js/bootstrap.min.js"></script>
<script src="js/html5slider.js"></script>
</body>
</html>

View File

@ -1,36 +0,0 @@
{
"/1/wabe1/1/1":1,
"/1/wabe1/2/1":2,
"/1/wabe1/1/2":3,
"/1/wabe2/1/1":4,
"/1/wabe2/2/1":5,
"/1/wabe2/1/2":6,
"/1/wabe3/1/1":7,
"/1/wabe3/2/1":8,
"/1/wabe3/1/2":9,
"/1/wabe4/1/1":10,
"/1/wabe4/2/1":11,
"/1/wabe4/1/2":12,
"/1/wabe5/1/1":13,
"/1/wabe5/2/1":14,
"/1/wabe5/1/2":15,
"/1/wabe6/1/1":16,
"/1/wabe6/2/1":17,
"/1/wabe6/1/2":18,
"/1/wabe7/1/1":19,
"/1/wabe7/2/1":20,
"/1/wabe7/1/2":21,
"/1/wabe8/1/1":22,
"/1/wabe8/2/1":23,
"/1/wabe8/1/2":24,
"/1/wabe9/1/1":25,
"/1/wabe9/2/1":26,
"/1/wabe9/1/2":27,
"/1/lamp1":28,
"/1/lamp2":29,
"/1/lamp3":30,
"/1/halogen1":31,
"/1/halogen2":32,
"/1/voucher1":33,
"/1/voucher2":34
}

View File

@ -1,12 +1,16 @@
{
"/1/lamp1/white": 1,
"/1/lamp2/white": 0,
"/1/voucher2": 1,
"/1/wabe9/2/2": 1,
"/1/wabe9/1/1": 1,
"/1/wabe2/2/2": 1,
"/1/wabe2/1/2": 1,
"/1/wabe6/1/1": 1,
"/1/wabe5/2/1": 1,
"/1/wabe7/1/1": 1
"/1/rgb1/1": 0,
"/1/rgb2/2": 0,
"/1/rgb3/3": 0,
"/1/wabe4/1/1": 1,
"/1/wabe2/1/1": 1,
"/1/rgb1/2": 0,
"/1/rgb1/3": 0,
"/1/rgb2/1": 0,
"/1/rgb2/3": 0,
"/1/rgb3/1": 0,
"/1/rgb3/2": 0,
"/1/rgb4/1": 0,
"/1/rgb4/2": 0,
"/1/rgb4/3": 0
}