Simplify file names
This commit is contained in:
parent
b6909e4490
commit
a806fabf5c
@ -2,7 +2,7 @@
|
||||
set = 5
|
||||
curve = 0
|
||||
lasernumber = 3
|
||||
debug = 0
|
||||
debug = 1
|
||||
ljayserverip = 127.0.0.1
|
||||
nozoscip = 127.0.0.1
|
||||
bhoroscip = 127.0.0.1
|
@ -1,7 +1,7 @@
|
||||
# coding=UTF-8
|
||||
"""
|
||||
|
||||
LJ OSC handler
|
||||
LJ OSC and Websockets laser commands
|
||||
v0.7.0
|
||||
|
||||
|
2
gstt.py
2
gstt.py
@ -11,7 +11,7 @@ from /team/laser
|
||||
'''
|
||||
|
||||
#ConfigName = "setexample.conf"
|
||||
ConfigName = "mainy.conf"
|
||||
ConfigName = "LJ.conf"
|
||||
|
||||
debug = 2
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
'''
|
||||
LJ Servers v0.8
|
||||
LJ Laser Server v0.8
|
||||
|
||||
Laser server + webUI servers (ws + OSC)
|
||||
|
||||
@ -30,9 +30,9 @@ settings.Write()
|
||||
from multiprocessing import Process, Queue, TimeoutError
|
||||
import random, ast
|
||||
|
||||
import newdacp
|
||||
import tracer
|
||||
import homographyp
|
||||
import las
|
||||
import commands
|
||||
import font1
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ args =[0,0]
|
||||
def dac_process(number, pl):
|
||||
while True:
|
||||
try:
|
||||
d = newdacp.DAC(number,pl)
|
||||
d = tracer.DAC(number,pl)
|
||||
d.play_stream()
|
||||
except Exception as e:
|
||||
|
||||
@ -176,7 +176,7 @@ def handler(path, tags, args, source):
|
||||
print "default handler"
|
||||
print "OSC said : ", path, oscpath, args
|
||||
sendWSall(path + " " + str(args[0]))
|
||||
las.handler(oscpath,args)
|
||||
commands.handler(oscpath,args)
|
||||
|
||||
|
||||
# RAW OSC Frame available ?
|
||||
@ -288,7 +288,7 @@ def message_received(client, server, message):
|
||||
oscpath = message.split(" ")
|
||||
args[0] = str(oscpath[1])
|
||||
#print oscpath[0].split("/"),oscpath[1]
|
||||
las.handler(oscpath[0].split("/"),args)
|
||||
commands.handler(oscpath[0].split("/"),args)
|
||||
|
||||
# current UI has no dedicated off button so /on 0 trigs /off to bhorosc
|
||||
if oscpath[0] == "/on":
|
||||
@ -367,7 +367,7 @@ try:
|
||||
print "Launching OSC server..."
|
||||
print "at", bhoroscIPin, "port",str(bhoroscPORTin)
|
||||
print "Will update webUI dac status every second"
|
||||
oscserver.addMsgHandler( "/noteon", las.NoteOn )
|
||||
oscserver.addMsgHandler( "/noteon", commands.NoteOn )
|
||||
# Default OSC handler for all OSC incoming message
|
||||
oscserver.addMsgHandler("default", handler)
|
||||
thread.start_new_thread(osc_thread, ())
|
@ -1,12 +1,11 @@
|
||||
#!/usr/bin/python2.7
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
LJay/LJ v0.8.0
|
||||
|
||||
newdacp.py
|
||||
Enhanced version (redis and process style) of the etherdream python library from j4cDAC.
|
||||
tracer.py (was newdacp.py)
|
||||
Enhanced version (support for several lasers) of the etherdream python library from j4cDAC.
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack, pclf
|
||||
@ -18,6 +17,7 @@ Uses redis keys value for live inputs/outputs
|
||||
These redis keys are read and set at each main loop.
|
||||
|
||||
Live inputs :
|
||||
/order select some change to adjust
|
||||
/pl/lasernumber [(x,y,color),(x1,y1,color),...] A string of list of pygame points list.
|
||||
/resampler/lasernumber [(1.0,8), (0.25,3),(0.75,3),(1.0,10)] : a string for resampling rules.
|
||||
the first tuple (1.0,8) is for short line < 4000 in etherdream space
|
||||
@ -30,9 +30,6 @@ Live ouputs :
|
||||
/lack/lasernumber value "a": ACK "F": Full "I": invalid. 64 or 35 for no connection.
|
||||
Geometric corrections :
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
|
||||
import socket
|
@ -403,10 +403,10 @@
|
||||
|
||||
<!-- mg run icons grid -->
|
||||
<div id="mgrun"class="mgrun"> <!-- Laser Client selection grid -->
|
||||
<div><img src="knobs/iconljay2.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconljay2.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconljay2.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconljay2.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/client.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/client.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/client.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/client.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/client.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/client.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/client.png" alt=" " class="icongrid" /></div>
|
||||
@ -420,10 +420,10 @@
|
||||
<div><button id ="noteon 6" onclick ="buttonClicked(this.id)" class="button">6</button></div>
|
||||
<div><button id ="noteon 7" onclick ="buttonClicked(this.id)" class="button">7</button></div>
|
||||
<!-- Simulator PL selection grid -->
|
||||
<div><img src="knobs/iconpl.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconpl.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconpl.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconpl.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconljay2.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconljay2.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconljay2.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconljay2.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconblack.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconblack.png" alt=" " class="icongrid" /></div>
|
||||
<div><img src="knobs/iconblack.png" alt=" " class="icongrid" /></div>
|
||||
@ -546,37 +546,63 @@
|
||||
// Store Reference To The Canvas & Set Context
|
||||
var canvas = document.getElementById("canvas");
|
||||
var ctx = canvas.getContext("2d");
|
||||
var lastpoint = { x: 0, y: 0 };
|
||||
var lastpoint = { x: 0, y: 0, color: 0};
|
||||
|
||||
function draw() {
|
||||
|
||||
// Clear Canvas At The Start Of Every Frame
|
||||
ctx.clearRect(0,0,400,400);
|
||||
if (pl2.length > 0)
|
||||
{
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(lastpoint.x , lastpoint.y );
|
||||
// Todo : laser point will have black points to go from a polyline to another. Need to discard those black points.
|
||||
function draw() {
|
||||
|
||||
// Draw Lines
|
||||
for (var i = 0; i < pl2.length/3; i++) {
|
||||
ctx.lineTo(pl2[i*3]*0.7, pl2[1+(i*3)]*0.7);
|
||||
//ctx.strokeStyle = "#"+(pl2[2+(i*3)]).toString(16);
|
||||
// Clear Canvas At The Start Of Every Frame
|
||||
ctx.clearRect(0,0,400,400);
|
||||
if (pl2.length > 0)
|
||||
{
|
||||
|
||||
// Begin a new path
|
||||
// 0.7 reduces max coordinates in a more browser compatible resolution.
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(pl2[0]*0.7, pl2[1]*0.7);
|
||||
lastpoint.color = pl2[2];
|
||||
|
||||
// Draw n Lines
|
||||
for (var i = 0; i < pl2.length/3; i++)
|
||||
{
|
||||
|
||||
// New point has the same color -> add a new line to new point
|
||||
if (pl2[2+(i*3)] === lastpoint.color)
|
||||
{
|
||||
ctx.lineTo(pl2[i*3]*0.7, pl2[1+(i*3)]*0.7);
|
||||
}
|
||||
|
||||
// New point has different color -> stroke with previous color
|
||||
if (pl2[2+(i*3)] != lastpoint.color)
|
||||
{
|
||||
ctx.strokeStyle = "#"+(lastpoint.color + Math.pow(16, 6)).toString(16).slice(-6);
|
||||
ctx.stroke();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(pl2[i*3]*0.7, pl2[1+(i*3)]*0.7);
|
||||
}
|
||||
|
||||
// Last point -> stroke with current color
|
||||
if (i === (pl2.length/3)-1 )
|
||||
{
|
||||
ctx.moveTo(pl2[i*3]*0.7, pl2[1+(i*3)]*0.7);
|
||||
ctx.strokeStyle = "#"+((pl2[2+(i*3)]) + Math.pow(16, 6)).toString(16).slice(-6);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
//ctx.strokeStyle = "#888";
|
||||
//ctx.stroke();
|
||||
lastpoint.x = pl2[i*3];
|
||||
lastpoint.y = pl2[1+(i*3)];
|
||||
}
|
||||
// Call Draw Function Again To Create Animation
|
||||
window.requestAnimationFrame(draw);
|
||||
}
|
||||
// store point for comparison
|
||||
lastpoint.x = pl2[i*3];
|
||||
lastpoint.y = pl2[1+(i*3)];
|
||||
lastpoint.color = pl2[2+(i*3)];
|
||||
}
|
||||
|
||||
// Initialize The Draw Function
|
||||
draw();
|
||||
}
|
||||
// Call Draw Function Again To Create Animation
|
||||
window.requestAnimationFrame(draw);
|
||||
}
|
||||
|
||||
// Initialize The Draw Function
|
||||
draw();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
91
webui/indexgl.html
Normal file
91
webui/indexgl.html
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>LJ</title>
|
||||
</head>
|
||||
|
||||
<body style="background-color:#222;">
|
||||
|
||||
<!-- mg : canvas to display point list as laser simulator -->
|
||||
<div id = "mgcanvas" class="mgcanvas">
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
</div>
|
||||
|
||||
<!-- Point list draw -->
|
||||
<script type="text/javascript">
|
||||
|
||||
// Store Reference To The Canvas & Set Context
|
||||
var canvas = document.getElementById("canvas");
|
||||
var ctx = canvas.getContext("2d");
|
||||
var lastpoint = { x: 0, y: 0, color: 0};
|
||||
|
||||
// 2 different shapes, one blue one green.
|
||||
var LJ = "/plframe [(350, 330, 65280), (370, 270, 65280), (430, 270, 65280), (410, 330, 65280), (350, 330, 65280),(300, 300, 255), (350, 250, 255), (400, 250, 255), (400, 300, 255), (300, 300, 255)]";
|
||||
var pl ="";
|
||||
var pl2 = new Array();
|
||||
|
||||
pl = LJ.slice(9);
|
||||
pl2 = eval(pl.replace(/[()]/g, ''));
|
||||
|
||||
// Todo : laser point will have black points to go from a polyline to another. Need to discard those black points.
|
||||
function draw() {
|
||||
|
||||
// Clear Canvas At The Start Of Every Frame
|
||||
ctx.clearRect(0,0,400,400);
|
||||
if (pl2.length > 0)
|
||||
{
|
||||
|
||||
// Begin a new path
|
||||
// 0.7 reduces max coordinates in a more browser compatible resolution.
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(pl2[0]*0.7, pl2[1]*0.7);
|
||||
lastpoint.color = pl2[2];
|
||||
|
||||
// Draw n Lines
|
||||
for (var i = 0; i < pl2.length/3; i++)
|
||||
{
|
||||
|
||||
// New point has the same color -> add a new line to new point
|
||||
if (pl2[2+(i*3)] === lastpoint.color)
|
||||
{
|
||||
ctx.lineTo(pl2[i*3]*0.7, pl2[1+(i*3)]*0.7);
|
||||
}
|
||||
|
||||
// New point has different color -> stroke with previous color
|
||||
if (pl2[2+(i*3)] != lastpoint.color)
|
||||
{
|
||||
ctx.strokeStyle = "#"+(lastpoint.color + Math.pow(16, 6)).toString(16).slice(-6);
|
||||
ctx.stroke();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(pl2[i*3]*0.7, pl2[1+(i*3)]*0.7);
|
||||
}
|
||||
|
||||
// Last point -> stroke with current color
|
||||
if (i === (pl2.length/3)-1 )
|
||||
{
|
||||
ctx.moveTo(pl2[i*3]*0.7, pl2[1+(i*3)]*0.7);
|
||||
ctx.strokeStyle = "#"+((pl2[2+(i*3)]) + Math.pow(16, 6)).toString(16).slice(-6);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
// store point for comparison
|
||||
lastpoint.x = pl2[i*3];
|
||||
lastpoint.y = pl2[1+(i*3)];
|
||||
lastpoint.color = pl2[2+(i*3)];
|
||||
}
|
||||
|
||||
}
|
||||
// Call Draw Function Again To Create Animation
|
||||
window.requestAnimationFrame(draw);
|
||||
}
|
||||
|
||||
// Initialize The Draw Function
|
||||
draw();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user