Fixed Number parsing

This commit is contained in:
Fabian Stamm 2017-06-22 15:53:00 +02:00
parent 7a67a0e436
commit f57001922f
4 changed files with 9 additions and 26 deletions

View File

@ -17,15 +17,7 @@ ioClient.on("connect", () => {
}); });
var ios = io(http); var ios = io(http);
const artnetp = require("artnet"); const artnetp = require("artnet");
const universe = 21;
var artnet = artnetp({ host: "192.168.1.255" }); var artnet = artnetp({ host: "192.168.1.255" });
function reset() {
for (var i = 1; i <= 512; i++) {
artnet.set(universe, i, 0);
}
artnet.set(universe, 1, 100);
}
reset();
class FrameTime { class FrameTime {
constructor(millis) { constructor(millis) {
this.lframe = 0; this.lframe = 0;
@ -132,7 +124,7 @@ class Timecode {
if (e.time.milliseconds <= d) { if (e.time.milliseconds <= d) {
console.log("u", e); console.log("u", e);
ios.emit("artnet", e.art); ios.emit("artnet", e.art);
artnet.set(universe, Number(e.art.subnet), Number(e.art.value)); artnet.set(Number(e.art.universe), Number(e.art.subnet), Number(e.art.value));
var i = this.toTrigger.indexOf(e); var i = this.toTrigger.indexOf(e);
this.toTrigger.splice(i, 1); this.toTrigger.splice(i, 1);
} }
@ -168,7 +160,7 @@ class Timecode {
this.filePlaying = track.file; this.filePlaying = track.file;
this.startTime = 0; this.startTime = 0;
if (this.activeTrack.load) { if (this.activeTrack.load) {
artnet(this.activeTrack.load.universe, this.activeTrack.load.subnet, this.activeTrack.load.value); artnet.set(Number(this.activeTrack.load.universe), Number(this.activeTrack.load.subnet), Number(this.activeTrack.load.value));
} }
} }
pause() { pause() {
@ -216,7 +208,6 @@ class Timecode {
this.playing = false; this.playing = false;
this.startTime = 0; this.startTime = 0;
}); });
reset();
} }
} }
class TrackEvent { class TrackEvent {
@ -296,7 +287,7 @@ ios.on("connection", socket => {
senddata(); senddata();
}); });
socket.on("fire", (data) => { socket.on("fire", (data) => {
artnet.set(data.universe, data.subnet, data.value); artnet.set(Number(data.universe), Number(data.subnet), Number(data.value));
}); });
socket.on("load_event", (data) => { socket.on("load_event", (data) => {
console.log(data); console.log(data);

File diff suppressed because one or more lines are too long

View File

@ -17,15 +17,7 @@ ioClient.on("connect", ()=>{
}); });
var ios = io(http); var ios = io(http);
const artnetp = require("artnet"); const artnetp = require("artnet");
const universe = 21;
var artnet = artnetp({host:"192.168.1.255"}); var artnet = artnetp({host:"192.168.1.255"});
function reset(){ //ToDO nachfragen bei Marvin / Alex
for(var i = 1; i <= 512; i++){
artnet.set(universe, i, 0);
}
artnet.set(universe, 1, 100);
}
reset();
class FrameTime{ class FrameTime{
lframe = 0; lframe = 0;
@ -152,7 +144,7 @@ class Timecode {
if(e.time.milliseconds <= d) { if(e.time.milliseconds <= d) {
console.log("u", e); console.log("u", e);
ios.emit("artnet", e.art); ios.emit("artnet", e.art);
artnet.set(universe, Number(e.art.subnet), Number(e.art.value)); artnet.set(Number(e.art.universe), Number(e.art.subnet), Number(e.art.value));
var i = this.toTrigger.indexOf(e); var i = this.toTrigger.indexOf(e);
this.toTrigger.splice(i, 1); this.toTrigger.splice(i, 1);
} }
@ -188,7 +180,7 @@ class Timecode {
this.filePlaying = track.file; this.filePlaying = track.file;
this.startTime = 0; this.startTime = 0;
if(this.activeTrack.load){ if(this.activeTrack.load){
artnet(this.activeTrack.load.universe, this.activeTrack.load.subnet, this.activeTrack.load.value) artnet.set(Number(this.activeTrack.load.universe), Number(this.activeTrack.load.subnet), Number(this.activeTrack.load.value));
} }
} }
@ -238,7 +230,6 @@ class Timecode {
this.playing = false; this.playing = false;
this.startTime = 0; this.startTime = 0;
}); });
reset();
} }
} }
@ -346,7 +337,7 @@ ios.on("connection", socket=>{
}); });
socket.on("fire", (data)=>{ socket.on("fire", (data)=>{
artnet.set(data.universe, data.subnet, data.value); artnet.set(Number(data.universe), Number(data.subnet), Number(data.value));
}); });
socket.on("load_event", (data)=>{ socket.on("load_event", (data)=>{

View File

@ -228,7 +228,8 @@
function fire(id){ function fire(id){
if(!selected) return; if(!selected) return;
selected.triggers.forEach(e=>{ selected.triggers.forEach(e=>{
if(e.id == id) socket.emit("fire", e.art); console.log(e);
if(e.id == id) socket.emit("fire", e.art);
}); });
} }