webui bugfixes

This commit is contained in:
nrhck 2018-12-18 02:45:23 +01:00
parent 4720922ed6
commit bcd45c9de5
27 changed files with 939 additions and 369 deletions

View File

@ -105,7 +105,7 @@ def rPolyLineOneColor(xy_list, c, PL , closed, xpos = 0, ypos =0, resize =0.7, r
# 0: point list / 1: Grid
def LinesPL(PL):
if r.set('/pl/'+str(PL), str(pl[PL])) == True:
if r.set('/pl/0/'+str(PL), str(pl[PL])) == True:
return True
else:
return False

View File

@ -83,8 +83,8 @@ console.log(pl0);
console.log(pl1);
// Send points lists to redis server
client.set("/pl/0",pl0);
client.set("/pl/1",pl1);
client.set("/pl/0/0",pl0);
client.set("/pl/0/1",pl1);
// Quit
client.quit()

View File

@ -26,12 +26,12 @@ def rgb2int(r,g,b):
pl1 = [(100,300,rgb2int(255,255,255)),(200,300,rgb2int(255,255,255)),(200,200,rgb2int(255,255,255)),(100,200,rgb2int(255,255,255))]
# Send to laser 0 (see mainy.conf)
r.set('/pl/0', str(pl0))
r.set('/pl/0/0', str(pl0))
# Send to laser 1 (see mainy.conf)
r.set('/pl/1', str(pl1))
r.set('/pl/2', str(pl1))
r.set('/pl/0/1', str(pl1))
# Send to laser 2 (see mainy.conf)
r.set('/pl/0/2', str(pl1))
'''
You can also use PolyLineOneColor or rPolylineOneColor to stack n point lists to build a "frame"

119
font1.py Executable file
View File

@ -0,0 +1,119 @@
# coding=UTF-8
"""
LJ Font 1
v0.7.0
LICENCE : CC
by Sam Neurohack
from /team/laser
"""
import gstt
def DigitsDots(number,color):
dots =[]
#print ASCII_GRAPHICS[ord(char) - 48]
for dot in ASCII_GRAPHICS[number]:
#print dot
dots.append((gstt.xy_center[0]+dot[0],gstt.xy_center[1]+dot[1],color))
#self.point_list.append((xy + (c,)))
return dots
ASCII_GRAPHICS = [
#implementé
[(-50,30), (-30,-30), (30,-30), (10,30), (-50,30)], #0
[(-20,30), (0,-30), (-20,30)], #1
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #2
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #3
[(30,10), (-30,10), (0,-30), (0,30)], #4
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #5
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #6
[(-30,-30), (30,-30), (-30,30)], #7
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30), (-30,0), (30,0)], #8
[(30,0), (-30,0), (-30,-10), (0,-30), (30,-30), (30,10), (0,30), (-30,30)], #9
# A implementer
[(-30,10), (30,-10), (30,10), (0,30), (-30,10), (-30,-10), (0,-30), (30,-10)], #:
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], #;
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #<
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #=
[(30,10), (-30,10), (0,-30), (0,30)], #>
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #?
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #@
# Implementé
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], #A
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], #A
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30), (-30,0), (30,0)], #B
[(30,30), (-30,30), (-30,-30), (30,-30)], #C
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30)], #D
[(30,30), (-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], #E
[(-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], #F
[(0,0), (30,0), (30,30), (-30,30), (-30,-30),(30,-30)], #G
[(-30,-30), (-30,30), (-30,0), (30,0), (30,30), (30,-30)], #H
[(0,30), (0,-30)], #I
[(-30,30), (0,-30), (0,-30), (-30,-30), (30,-30)], #J
[(-30,-30), (-30,30), (-30,0), (30,-30), (-30,0), (30,30)], #K
[(30,30), (-30,30), (-30,-30)], #L
[(-30,30), (-30,-30), (0,0), (30,-30), (30,30)], #M
[(-30,30), (-30,-30), (30,30), (30,-30)], #N
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30)], #O
[(-30,0), (30,0), (30,-30), (-30,-30), (-30,30)], #P
[(30,30), (30,-30), (-30,-30), (-30,30), (30,30),(35,35)], #Q
[(-30,30), (-30,-30), (30,-30), (30,0), (-30,0), (30,30)], #R
[(30,-30), (-30,-30), (-30,0), (30,0), (30,30), (-30,30)], #S
[(0,30), (0,-30), (-30,-30), (30,-30)], #T
[(-30,-30), (-30,30), (30,30), (30,-30)], #U
[(-30,-30), (0,30), (30,-30)], #V
[(-30,-30), (-30,30), (0,0), (30,30), (30,-30)], #W
[(-30,30), (30,-30)], [(-30,-30), (30,30)], #X
[(0,30), (0,0), (30,-30), (0,0), (-30,-30)], #Y
[(30,30), (-30,30), (30,-30), (-30,-30)], #Z
# A implementer
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], #[
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #\
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #]
[(30,10), (-30,10), (0,-30), (0,30)], #^
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #_
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #`
# Implementé
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], #a
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20), (-20,0), (20,0)], #b
[(20,20), (-20,20), (-20,-20), (20,-20)], #c
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], #d
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], #e
[(-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], #f
[(0,0), (20,0), (20,20), (-20,20), (-20,-20),(20,-20)], #g
[(-20,-20), (-20,20), (-20,0), (20,0), (20,20), (20,-20)], #H
[(0,20), (0,-20)], #I
[(-20,20), (0,-20), (0,-20), (-20,-20), (20,-20)], #J
[(-20,-20), (-20,20), (-20,0), (20,-20), (-20,0), (20,20)], #K
[(20,20), (-20,20), (-20,-20)], #L
[(-20,20), (-20,-20), (0,0), (20,-20), (20,20)], #M
[(-20,20), (-20,-20), (20,20), (20,-20)], #N
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], #O
[(-20,0), (20,0), (20,-20), (-20,-20), (-20,20)], #P
[(20,20), (20,-20), (-20,-20), (-20,20), (20,20),(25,25)], #Q
[(-20,20), (-20,-20), (20,-20), (20,0), (-20,0), (20,20)], #R
[(20,-20), (-20,-20), (-20,0), (20,0), (20,20), (-20,20)], #S
[(0,20), (0,-20), (-20,-20), (20,-20)], #T
[(-20,-20), (-20,20), (20,20), (20,-20)], #U
[(-20,-20), (0,20), (20,-20)], #V
[(-20,-20), (-20,20), (0,0), (20,20), (20,-20)], #W
[(-20,20), (20,-20)], [(-20,-20), (20,20)], #X
[(0,20), (0,0), (20,-20), (0,0), (-20,-20)], #Y
[(20,20), (-20,20), (20,-20), (-20,-20)], #Z
[(-2,15), (2,15)] # Point a la place de {
]

109
gstt.py
View File

@ -1,9 +1,14 @@
# coding=UTF-8
'''
Etat global (anciennement singleton de la classe GameState + autres VARIABLES nécessaires partout)"
'''
#from globalVars import *
LJ Global state
v0.8.0
LICENCE : CC
by Sam Neurohack, Loloster, pclf
from /team/laser
'''
#ConfigName = "setexample.conf"
ConfigName = "mainy.conf"
@ -24,15 +29,16 @@ nozoscip = '192.168.1.15'
# gstt.Laser select to what laser modifcation will occur.
# Can be changed with /noteon 16-23
Laser = 2
Laser = 0
# gstt.simuPL select what point list number to display in pygame simulator
# gstt.simuPL select what point list number to display in webUI simulator
# Can be changed with /noteon 24-31
simuPL = 1
# gstt.laserIPS. Will be overridden by the ConfigName (see below) file values
lasersIPS = ['192.168.1.5','192.168.1.6','192.168.1.3','192.168.1.4']
ClientNumber = 1
# gstt.kpps stores kpps for each laser.
# ** Will be overridden by the ConfigName (see below) file values **
@ -57,54 +63,19 @@ lstt_points = [[0], [0], [0], [0]]
swapX = [1,1,1,-1]
swapY = [1,1,1,-1]
maxCurvesByLaser = 4
# For glitch art : change position and decrease number of points added by newdac.py
# shortline for lines shorter than 4000 (in etherdream coordinates)
# i.e (0.25,3) means add 3 points at 25% on the line.
stepshortline = [(1.0, 8)]
stepslongline = [(0.25, 3), (0.75, 3), (1.0, 10)]
#curveColor = [255,0,0] * maxCurvesByLaser
#curveColor = [[0 for _ in range(3)] for _ in range(maxCurvesByLaser)]
curveColor = [[255 for _ in range(3)] for _ in range(maxCurvesByLaser)]
colorX = [[255 for _ in range(3)] for _ in range(maxCurvesByLaser)]
colorY = [[255 for _ in range(3)] for _ in range(maxCurvesByLaser)]
offsetX = [0] * maxCurvesByLaser
offsetY = [0] * maxCurvesByLaser
curveNumber = 0
Curve = curveNumber
XTimeAxe=30000
YTimeAxe=30000
#curveX = [255,255,255] * maxCurvesByLaser
#curveY = [255,255,255] * maxCurvesByLaser
point = [0,0,0]
# gstt.colormode select what to display. Can be changed with /noteon 57-64
colormode = 0
color = [255,255,255]
newcolor = 0
surpriseoff = 10
surpriseon = 50
surprisey = -10
surprisex = -10
cc = [0] * 256
lfo = [0] * 10
osc = [0] * 255
oscInUse = [0] * 255
knob = [0] * 33
stars0=[]
stars1=[]
stars2=[]
#stars3=[]
# Viewer distance (cc 21)
cc[21]=60
viewer_distance = cc[21] * 8
@ -116,33 +87,6 @@ fov = 4 * cc[22]
JumpFlag =0
# nice X (cc 5) Y (cc 6) curve at first
cc[5] = cc[6] = 60
# Dot mode start at middle screen
cc[1] = cc[2] = 63
note = 0
velocity = 0
WingHere = -1
BhorealHere = -1
LaunchHere = -1
BhorLeds = [0] * 64
oscx = 0
oscy = 0
oscz = 0
# Ai Parameters
aivelocity = 0.5
aiexpressivity = 0.5
aisensibility = 0.5
aibeauty = 0.5
# OSC ports
#temporaray fix hack : iport=nozoport
iport = 8001 #LJay (bhorosc) input port
@ -152,41 +96,10 @@ nozoport=8001 #nozosc.py sending port to LJay (main.py)
nozuport=0 #linux serial usb port connecting nozoid devices ACM0 by default
X = [0] * maxCurvesByLaser
Y = [0] * maxCurvesByLaser
# No rotation X (cc 29) Y (cc 30) Z (cc 31) at first
cc[29] = cc[30] = cc[31] = prev_cc29 = 0
prev_cc29 = prev_cc30 = prev_cc31 = -1
angleX = 0
angleY = 0
angleZ = 0
tomidi = False # currently tomidi bypass all other directions
todmx = False
toled = False
tolaser = True
tosynth = False
sernozoid = ""
nozoid = ""
serdmx = ""
newnumber = ""
oldnumber = ""
'''
# will be overrided but settings.conf values.
# legacy one laser only values
centerx = LASER_CENTER_X
centery = LASER_CENTER_Y
zoomx = LASER_ZOOM_X
zoomy = LASER_ZOOM_Y
sizex = LASER_SIZE_X
sizey = LASER_SIZE_Y
finangle = LASER_ANGLE
'''
# multilasers arrays
# will be overrided but settings.conf values.
centerX = [0,0,0,0]

View File

@ -174,17 +174,18 @@ def EDpoint(mylaser,(pygamex,pygamey)):
x = (gstt.xy_center[0] + ((XX * CosANGLE) - (YY * SinANGLE)) - gstt.xy_center[0]) * gstt.zoomX[mylaser] + gstt.centerX[mylaser]
y = (gstt.xy_center[1] + ((XX * SinANGLE) + (YY * CosANGLE)) - gstt.xy_center[1]) * gstt.zoomY[mylaser] + gstt.centerY[mylaser]
if gstt.debug >0:
if gstt.debug >1:
#print "global center :", xy_center
print "EDpoint computing..."
print "Laser :", mylaser, "center at : ", gstt.centerX[mylaser], gstt.centerY[mylaser]
print "Pygame point",pygamex,",",pygamey
'''
print "swaps : ", (gstt.swapX[mylaser]), str(gstt.swapY[mylaser])
print "zooms : ", gstt.zoomX[mylaser], gstt.zoomY[mylaser]
print "angles : ", gstt.finANGLE[mylaser]
'''
print "result : ", x * gstt.swapX[mylaser] , y * gstt.swapY[mylaser]
print "Result point : ", x * gstt.swapX[mylaser] , y * gstt.swapY[mylaser]
return [x * gstt.swapX[mylaser] , y * gstt.swapY[mylaser]]
'''

View File

@ -1,16 +1,10 @@
#!/bin/bash
sudo apt install python-pip
sudo apt install git
pip uninstall serial
pip uninstall rtmidi
pip install libasound2-dev python-dev libpython-dev libjack-dev
pip install pysimpledmx
sudo apt install redis
pip install numpy
pip install scipy
pip install mido
pip install python-rtmidi
git clone https://github.com/ptone/pyosc --depth 1 /tmp/pyosc && cd /tmp/pyosc && sudo ./setup.py install
pip install pyserial
pip install redis

74
las.py
View File

@ -41,6 +41,9 @@ def NewEDH(laser):
print "New EDH requested for laser ", laser
settings.Write()
print "Settings saving swapX ", gstt.swapX[laser]
print "Settings saving swapY ", gstt.swapY[laser]
homographyp.newEDH(laser)
#r.set('/order/'+str(laser), 1)
@ -79,14 +82,60 @@ def Resampler(laser,lsteps):
r.set('/order/'+str(laser), 4)
def LasClientChange(clientnumber):
#
if r.get("/pl/"+str(clientnumber)+"/0") != None:
print "Switching to laser client", clientnumber
gstt.ClientNumber = clientnumber
r.set('/clientkey', "/pl/"+str(clientnumber)+"/")
print "clientkey set to", "/pl/"+str(clientnumber)+"/"
for laserid in xrange(0,gstt.LaserNumber):
r.set('/order/'+str(laserid), 5)
else:
print "Error : new laser client",clientnumber,"must send points first to","/pl/"+str(clientnumber)+"/0"
def NoteOn(note):
print "NoteOn", note
# Change laser client
if note < 8:
LasClientChange(note)
# New PL displayed
if note > 23 and note < 32:
if note - 24 > gstt.LaserNumber -1:
print "Only",gstt.LaserNumber,"asked, you dum ass !"
else:
gstt.Laser = note -24
print "Current Laser switched to",gstt.Laser
#LasClientChange(gstt.Laser)
def handler(oscpath, args):
print ""
print "Handler"
if oscpath[1] == "client" or oscpath[1] =="noteon":
if oscpath[1] == "client":
LasClientChange(int(args[0]))
else:
NoteOn(int(args[0]))
else:
pathlength = len(oscpath)
if pathlength == 3:
laser = int(oscpath[2])
else:
laser = int(oscpath[3])
print "args[0] :",args[0]," ", type(args[0])
# /grid/lasernumber value (0 or 1)
if oscpath[1] == "grid":
@ -102,14 +151,13 @@ def handler(oscpath, args):
if oscpath[1] == "black":
if args[0] == "1":
print "Grid requested for laser ", laser
print "Black requested for laser ", laser
BlackOn(laser)
else:
print "No grid for laser ", laser
print "No black for laser ", laser
UserOn(laser)
# /ip/lasernumber value
if oscpath[1] == "ip":
print "New IP for laser ", laser
@ -120,19 +168,20 @@ def handler(oscpath, args):
# /kpps/lasernumber value
# Live change of kpps is not implemented in newdac.py. Change will effect next startup.
if oscpath[1] == "kpps":
print "New kpps for laser ", laser, " next startup", args[0]
print "New kpps for laser ", laser, " next startup", int(args[0])
gstt.kpps[laser]= int(args[0])
settings.Write()
# /angle/lasernumber value
if oscpath[1] == "angle":
print "New Angle modification for laser ", oscpath[2], ":", args[0]
gstt.finANGLE[laser] += int(args[0])
print "New Angle modification for laser ", oscpath[2], ":", float(args[0])
gstt.finANGLE[laser] += float(args[0])
NewEDH(laser)
"New angle", gstt.finANGLE[laser]
# /intens/lasernumber value
if oscpath[1] == "intens":
print "New intensity requested for laser ", laser, ":", args[0]
print "New intensity requested for laser ", laser, ":", int(args[0])
print "Change not implemented yet"
@ -156,24 +205,27 @@ def handler(oscpath, args):
# /swap/X/lasernumber value (0 or 1)
if oscpath[1] == "swap" and oscpath[2] == "X":
print "swapX was", gstt.swapX[laser]
if args[0] == "0":
print "swap X : -1 for laser ", laser
print "swap X -1 for laser ", laser
gstt.swapX[laser]= -1
NewEDH(laser)
else:
print "swap X : 1 for laser ", laser
print "swap X 1 for laser ", laser
gstt.swapX[laser]= 1
NewEDH(laser)
# /swap/Y/lasernumber value (0 or 1)
if oscpath[1] == "swap" and oscpath[2] == "Y":
print "swapY was", gstt.swapX[laser]
if args[0] == "0":
print "swap Y : -1 for laser ", laser
print "swap Y -1 for laser ", laser
gstt.swapY[laser]= -1
NewEDH(laser)
else:
print "swap Y : 1 for laser ", laser
print "swap Y 1 for laser ", laser
gstt.swapY[laser]= 1
NewEDH(laser)

View File

@ -1,8 +1,8 @@
[General]
set = 5
curve = 0
lasernumber = 1
debug = 1
lasernumber = 2
debug = 0
ljayserverip = 127.0.0.1
nozoscip = 127.0.0.1
bhoroscip = 127.0.0.1
@ -11,15 +11,15 @@ bhoroscip = 127.0.0.1
color = -1
ip = 192.168.1.4
kpps = 25000
centerx = 0
centery = -650
zoomx = 49.2
zoomy = 65.0
centerx = -695
centery = -2156
zoomx = 32.2
zoomy = 29.0
sizex = 31450
sizey = 32000
finangle = 0.0
finangle = 17.0
swapx = 1
swapy = 1
swapy = -1
lsteps = [ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
warpdest = [[-1500., 1500.],
[ 1500., 1500.],
@ -30,15 +30,15 @@ warpdest = [[-1500., 1500.],
color = -1
ip = 192.168.1.5
kpps = 25000
centerx = 0
centery = 0
zoomx = 48.5
centerx = -200
centery = -357
zoomx = 81.5
zoomy = 50.1
sizex = 32000
sizey = 32000
finangle = 0.0
swapx = 1
swapy = 1
swapx = -1
swapy = -1
lsteps = [ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
warpdest = [[-1500., 1500.],
[ 1500., 1500.],

View File

@ -33,6 +33,7 @@ import random, ast
import newdacp
import homographyp
import las
import font1
from OSC import OSCServer, OSCClient, OSCMessage
@ -43,6 +44,7 @@ import types, thread, time
r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0)
args =[0,0]
def dac_process(number, pl):
while True:
try:
@ -68,7 +70,7 @@ def dac_process(number, pl):
# webUI server
#
print "Laser client number :",gstt.ClientNumber
serverIP = gstt.LjayServerIP
print "Redis IP :", serverIP
@ -166,17 +168,20 @@ def sendnozosc(oscaddress,oscargs=''):
def handler(path, tags, args, source):
oscpath = path.split("/")
print "debug", gstt.debug
print ""
print "OSC said : ", path, oscpath, args
#print "debug", gstt.debug
if gstt.debug >0:
print ""
print "default handler"
print "Bhorosc said : ", path, oscpath, args
print "OSC said : ", path, oscpath, args
sendWSall(path + " " + str(args[0]))
las.handler(oscpath,args)
# RAW OSC Frame available ?
def osc_frame():
#print 'oscframe'
# clear timed_out flag
oscserver.timed_out = False
# handle all pending requests then return
@ -185,17 +190,9 @@ def osc_frame():
# OSC Thread. Bhorosc handler and Automated status sender to UI.
# OSC Thread. OSC handler and Automated status sender to UI.
def osc_thread():
#print "Will use Redis server IP ", serverIP
'''
r = redis.StrictRedis(host=serverIP, port=6379, db=0)
print "Connection to redis server.."
print "Running..."
'''
while True:
try:
while True:
@ -234,17 +231,8 @@ def osc_thread():
# last number of points sent to etherdream buffer
sendWSall("/points/" + str(laserid) + " " + str(r.get('/cap/'+str(laserid))))
sendWSall("/plframe/" + str(laserid) + " " + str(r.get('/pl/'+str(laserid))))
# WIP Too much packets -> flood webUI : Draw all PL point lists in JS canvas in WebUI
'''
for pl in range(0,1):
bhorosc.sendosc("/plframe/" + str(pl),"")
for plpoint in range(0,len(gstt.PL[pl])):
bhorosc.sendosc("/plpoint/" + str(pl),"")
'''
print "Sending simu frame from",'/pl/'+str(gstt.ClientNumber)+'/'+str(gstt.Laser)
sendWSall("/plframe" +" "+ r.get('/pl/'+str(gstt.ClientNumber)+'/'+str(gstt.Laser)))
except Exception as e:
@ -295,8 +283,9 @@ def message_received(client, server, message):
print ("")
print("WS Client(%d) said: %s" % (client['id'], message))
print("WS Client(%d) said: %s" % (client['id'], message))
oscpath = message.split(" ")
args[0] = float(oscpath[1])
args[0] = str(oscpath[1])
#print oscpath[0].split("/"),oscpath[1]
las.handler(oscpath[0].split("/"),args)
@ -306,10 +295,6 @@ def message_received(client, server, message):
sendbhorosc("/on")
else:
sendbhorosc("/off")
else:
print "sending to bhorosc",oscpath[0],oscpath[1]
sendbhorosc(oscpath[0],oscpath[1])
# if needed a loop back : WS Client -> server -> WS Client
#sendWSall("ws"+message)
@ -326,30 +311,23 @@ def sendWSall(message):
# Some random lists for all lasers at launch.
# Some random lists for all lasers at launch for laser client gstt.ClientNumber
print ""
print "Creating startup point lists..."
print "Creating startup point lists for client",gstt.ClientNumber,"..."
random_points = [(300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 0), (500.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280), (500.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280)]
if r.set('/pl/0', str(random_points)) == True:
print "/pl/0 ", ast.literal_eval(r.get('/pl/0'))
random_points = [(300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 0), (500.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280), (500.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280)]
if r.set('/pl/1', str(random_points)) == True:
print "/pl/1 ", ast.literal_eval(r.get('/pl/1'))
digit_points = font1.DigitsDots(gstt.ClientNumber,16711935)
random_points = [(300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 0), (500.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280), (500.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280)]
if r.set('/pl/2', str(random_points)) == True:
print "/pl/2 ", ast.literal_eval(r.get('/pl/2'))
random_points = [(300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 0), (500.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280), (500.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280)]
if r.set('/pl/3', str(random_points)) == True:
print "/pl/3 ", ast.literal_eval(r.get('/pl/3'))
# Order all lasers to show these random shapes at startup -> tell all 4 laser process to USER PLs
# Order all lasers to show the laser client number at startup -> tell all 4 laser process to USER PLs
for laserid in range(0,gstt.LaserNumber):
if r.set('/pl/'+str(gstt.ClientNumber)+'/'+str(laserid), str(digit_points)) == True:
print "/pl/"+str(gstt.ClientNumber)+"/"+str(laserid)+" ", ast.literal_eval(r.get('/pl/'+str(gstt.ClientNumber)+'/'+str(laserid)))
r.set('/order/'+str(laserid), 0)
if r.set("/clientkey","/pl/"+str(gstt.ClientNumber)+"/")==True:
print "sent clientkey : /pl/"+str(gstt.ClientNumber)+"/"
print ""
print "Etherdream connection check is NOT DISPLAYED"
@ -388,10 +366,12 @@ try:
print "Launching OSC server..."
print "at", bhoroscIPin, "port",str(bhoroscPORTin)
print "Will update webUI dac status every second"
thread.start_new_thread(osc_thread, ())
oscserver.addMsgHandler( "/noteon", las.NoteOn )
# Default OSC handler for all OSC incoming message
oscserver.addMsgHandler("default", handler)
thread.start_new_thread(osc_thread, ())
#print server
print ""
@ -430,6 +410,11 @@ finally:
print "Fin des haricots"
'''
Some code previously used, for reference :
random_points = [(300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 0), (500.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280), (500.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280)]
'''

View File

@ -235,6 +235,8 @@ class DAC(object):
#print "init"
self.mylaser = mylaser
self.clientkey = r.get("/clientkey")
#print "Laser",self.mylaser,"Got clientkey", self.clientkey
#print "DAC", self.mylaser, "Handler process, connecting to", gstt.lasersIPS[mylaser]
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.connstatus = self.conn.connect_ex((gstt.lasersIPS[mylaser], port))
@ -249,17 +251,18 @@ class DAC(object):
self.PL = PL
# Lower case pl is the actual point list coordinates
self.pl = ast.literal_eval(r.get('/pl/'+str(self.mylaser)))
print "Laser",self.mylaser,"asking for ckey", self.clientkey+str(self.mylaser)
self.pl = ast.literal_eval(r.get(self.clientkey + str(self.mylaser)))
#if self.mylaser ==0:
#print "DAC Init Laser", self.mylaser
#print "pl :", self.pl
#print "EDH/"+str(self.mylaser),r.get('/EDH/'+str(self.mylaser))
if r.get('/EDH/'+str(self.mylaser)) == None:
print "Laser",self.mylaser,"NO EDH !! Computing one..."
#print "Laser",self.mylaser,"NO EDH !! Computing one..."
homographyp.newEDH(self.mylaser)
else:
gstt.EDH[self.mylaser] = np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser))))
print "Laser",self.mylaser,"found its EDH in redis"
#print "Laser",self.mylaser,"found its EDH in redis"
#print gstt.EDH[self.mylaser]
'''
@ -355,7 +358,8 @@ class DAC(object):
if order == 0:
# USER point list
self.pl = ast.literal_eval(r.get('/pl/'+str(self.mylaser)))
self.pl = ast.literal_eval(r.get(self.clientkey+str(self.mylaser)))
else:
# Get the new EDH
@ -376,7 +380,7 @@ class DAC(object):
self.pl = grid_points
# Resampler Modification
# Resampler Change
if order == 4:
self.resampler = ast.literal_eval(r.get('/resampler/'+str(self.mylaser)))
print "newdacp resetting lsteps for", self.mylaser, ":",self.resampler
@ -384,6 +388,16 @@ class DAC(object):
gstt.stepslongline[0] = self.resampler[1]
gstt.stepslongline[1] = self.resampler[2]
gstt.stepslongline[2] = self.resampler[3]
# Back to user point list order
r.set('/order/'+str(self.mylaser), 0)
# Client Key change
if order == 5:
print "Laser",self.mylaser,"new clientkey",
self.clientkey = r.get('/clientkey')
# Back to user point list order
r.set('/order/'+str(self.mylaser), 0)
'''

View File

@ -40,7 +40,6 @@ def Write():
config.set(laser, 'swapx', str(gstt.swapX[i]))
config.set(laser, 'swapy', str(gstt.swapY[i]))
config.set(laser, 'warpdest', np.array2string(gstt.warpdest[i], precision=2, separator=',',suppress_small=True))
config.write(open(gstt.ConfigName,'w'))
@ -76,33 +75,3 @@ print "* Reading", gstt.ConfigName, "setup file.*"
config = ConfigParser.ConfigParser()
config.read(gstt.ConfigName)
# Save all points for a given "shape" (=['Windows','0']) shapecoord is a list
# in any section of the mapping conf file
def MappingWrite(sections, shape, shapecoord):
shapestr = " ".join(str(x) for x in shapecoord)
config.set(sections[gstt.CurrentSection], shape, shapestr.replace("] [","],["))
config.write(open(gstt.ConfigName,'w'))
def MappingWriteSection(sections, shape, shapecoord):
shapestr = " ".join(str(x) for x in shapecoord)
shapestr = "[" + shapestr.replace("] [","],[") + "]"
config.set(sections, shape, shapestr)
config.write(open(gstt.ConfigName,'w'))
# Get a list of all points (="Corners") for a given "shape" = [section,option] like ['Windows','0']
def MappingRead(shape):
archi = ast.literal_eval(config.get(shape[0], shape[1]))
return archi
# Get shape numbers (i.e of windows in Windows section)
def Mapping(shape):
return len(config.options(shape))
# Get a list of all sections
def MappingSections():
return config.sections()

243
webui/LJ.js Normal file
View File

@ -0,0 +1,243 @@
//
// LJ.js v0.7.0
//
// Web Audio buttons handler
// add a listener for each element.
var message="";
var log=[];
var knobs = document.getElementsByTagName('webaudio-knob');
for(var i = 0; i < knobs.length; i++){
knobs[i].addEventListener("input",Dump,false);
knobs[i].addEventListener("change",Dump,false);
}
var sliders = document.getElementsByTagName('webaudio-slider');
for(var i = 0; i < sliders.length; i++){
sliders[i].addEventListener("input",Dump,false);
sliders[i].addEventListener("change",Dump,false);
}
var switches = document.getElementsByTagName('webaudio-switch');
for(var i = 0; i < switches.length; i++) {
switches[i].addEventListener("change",Dump,false);
}
// Process button events
function Dump(e) {
var str="";
str=e.type + " : " + e.target.id + " : " + e.target.value + " ";
//console.log(str);
log.unshift(str);
log.length=1;
str="";
for(var i=19;i>=0;--i) {
if(log[i])
str+=log[i]+"<br/>";
}
var evview=document.getElementById("events");
evview.innerHTML=str;
if (e.target.id === "noteon" && e.type ==="input")
{
console.log("only noteon change are sent not input");
}
else
{
console.log(e.target.id)
_WS.send("/" + e.target.id + " " + e.target.value);
}
// for /scale : after a change (knob is released) reset knob value to 0
if (e.target.id.substring(0,5) === "scale" && e.type === "change") {
e.target.value = 0;
console.log(e.target.id + "set to 0")
_WS.send("/" + e.target.id + " " + e.target.value);
}
// for /loffset : after a change (knob is released) reset knob value to 0
if (e.target.id.substring(0,7) === "loffset" && e.type === "change") {
e.target.value = 0;
console.log(e.target.id + "set to 0")
_WS.send("/" + e.target.id + " " + e.target.value);
}
// for /angle : after a change (knob is released) reset knob value to 0
if (e.target.id.substring(0,5) === "angle" && e.type === "change") {
e.target.value = 0;
console.log(e.target.id + "set to 0")
_WS.send("/" + e.target.id + " " + e.target.value);
}
}
// Websocket Handler
var pl = "";
var pl2 = new Array();
var _WS = {
uri: 'ws://127.0.0.1:9001/',
ws: null,
init : function (e) {
_WS.s = new WebSocket(_WS.uri);
_WS.s.onopen = function (e) { _WS.onOpen(e); };
_WS.s.onclose = function (e) { _WS.onClose(e); };
_WS.s.onmessage = function (e) { _WS.onMessage(e); };
_WS.s.onerror = function (e) { _WS.onError(e); };
},
onOpen: function () {
_WS.showout(_WS.uri);
_WS.showout('CONNECTED');
},
onClose: function () {
_WS.showout('DISCONNECTED');
},
onMessage: function (e) {
var res = e.data.split(" ");
//console.log(e.data)
switch (res[0].substring(0,6)) {
case "/statu":
_WS.showstatus(e.data.slice(8));
break;
case "/plfra":
pl = e.data.slice(9);
//console.log(pl);
pl2 = eval(pl.replace(/[()]/g, ''));
//console.log(pl2);
break;
case "/plpoi":
console.log("plpoint");
break;
case "/clien":
console.log("New Client : "+res[1])
break
default:
//console.log(res[0] + " " + res[1])
//console.log(res[1])
document.getElementById(res[0].slice(1)).value = res[1];
_WS.showin(e.data);
}
//_WS.showin(e.data);
},
onError: function (e) {
_WS.showin('<span style="color: red;">ERROR:</span> ' + e.data);
},
showin: function (message) {
var divtext = document.getElementById('showin');
divtext.innerHTML="";
divtext.innerHTML= message.toString();
},
showout: function (message) {
var divtext = document.getElementById('showout');
divtext.innerHTML="";
divtext.innerHTML= message.toString();
},
showstatus: function (message) {
var divtext = document.getElementById('showstatus');
divtext.innerHTML="";
divtext.innerHTML= message.toString();
},
send: function (message) {
if (!message.length) {
alert('Empty message not allowed !');
} else {
_WS.showout(message);
_WS.s.send(message);
}
},
close: function () {
_WS.showout('GOODBYE !');
_WS.s.close();
}
};
window.addEventListener('load', _WS.init, false);
// Menu Handler
function noMenu() {
// Set all menu button with normal button style
var x = document.getElementById("showalign");
x.className = "button";
var x = document.getElementById("showrun");
x.className = "button";
var x = document.getElementById("showcanvas");
x.className = "button";
var x = document.getElementById("showlive");
x.className = "button";
// Hide all possible main central grids.
var x = document.getElementById("mgalign");
x.style.display = "none";
var x = document.getElementById("mgcanvas");
x.style.display = "none";
var x = document.getElementById("mgrun");
x.style.display = "none";
var x = document.getElementById("mglive");
x.style.display = "none";
}
function showAlign() {
noMenu();
var x = document.getElementById("mgalign");
x.style.display = "grid";
var x = document.getElementById("showalign");
x.className = "button:checked";
}
function showRun() {
noMenu();
var x = document.getElementById("mgrun");
x.style.display = "grid";
var x = document.getElementById("showrun");
x.className = "button:checked";
}
function showCanvas() {
noMenu();
var x = document.getElementById("mgcanvas");
x.style.display = "block";
var x = document.getElementById("showcanvas");
x.className = "button:checked";
}
function showLive() {
noMenu();
var x = document.getElementById("mglive");
x.style.display = "grid";
var x = document.getElementById("showlive");
x.className = "button:checked";
}
function buttonClicked(clicked_id) {
_WS.send("/" + clicked_id);
}
function onSubmit(clicked_id) {
var input = document.getElementById(clicked_id);
console.log("/" + clicked_id + " " + input.value);
_WS.send("/" + clicked_id + " " + input.value);
_WS.showout("/" + clicked_id + " " + input.value);
}

View File

@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8">
<title>LJay</title>
<title>LJ</title>
<!-- Web audio defaults -->
<script src="webcomponents-lite.js"></script>
@ -22,7 +22,8 @@
<!-- Webscoket handler -->
<script type="text/javascript">
var pl = "";
var pl2 = new Array();
var _WS = {
uri: 'ws://127.0.0.1:9001/',
ws: null,
@ -42,7 +43,6 @@
},
onMessage: function (e) {
var res = e.data.split(" ");
var pl = ""
//console.log(e.data)
//console.log(res[0].substring(0,6))
switch (res[0].substring(0,6)) {
@ -50,14 +50,17 @@
_WS.showstatus(e.data.slice(8));
break;
case "/plfra":
pl = e.data.slice(11)
console.log(pl);
console.log(e.data.slice(11));
pl = e.data.slice(9);
//console.log(pl);
pl2 = eval(pl.replace(/[()]/g, ''));
//console.log(pl2);
break;
case "/plpoi":
//console.log("plpoint");
break;
default:
console.log(res[0] + " " + res[1])
//console.log(res[0] + " " + res[1])
//console.log(res[1])
document.getElementById(res[0].slice(1)).value = res[1];
}
@ -204,7 +207,7 @@
<webaudio-switch id="swap/Y/0" value="0" height="25" width="21" tooltip="Switch-B" src="knobs/swapy.png"></webaudio-switch>
</div>
<!-- Lasergrid 0 -->
<div class="lasergrid" style="background-image: url(knobs/lasergrid0.png);">
<div class="lasergrid" style="background-image: url(lasergrid0.png);">
<div><webaudio-param id="kpps/0" link="kpps/0" ></webaudio-param></div>
<div><webaudio-param id="points/0" link="points/0"></webaudio-param></div>
@ -254,7 +257,7 @@
<webaudio-switch id="swap/Y/1" value="0" height="25" width="21" tooltip="Switch-B" src="knobs/swapy.png"></webaudio-switch>
</div>
<!-- Lasergrid 1 -->
<div class="lasergrid" style="background-image: url(knobs/lasergrid1.png);">
<div class="lasergrid" style="background-image: url(lasergrid1.png);">
<div><webaudio-param id="kpps/1" link="kpps/1"></webaudio-param></div>
<div><webaudio-param id="points/1" link="points/1"></webaudio-param></div>
<div class="lasertext">kPPS</div>
@ -303,7 +306,7 @@
<webaudio-switch id="swap/Y/2" value="0" height="25" width="21" tooltip="Switch-B" src="knobs/swapy.png"></webaudio-switch>
</div>
<!-- Laser 2 grid -->
<div class="lasergrid" style="background-image: url(knobs/lasergrid2.png)">
<div class="lasergrid" style="background-image: url(lasergrid2.png)">
<div><webaudio-param id="kpps/2" link="kpps/2"></webaudio-param></div>
<div><webaudio-param id="points/2" link="points/2"></webaudio-param></div>
<div class="lasertext">kPPS</div>
@ -352,7 +355,7 @@
<webaudio-switch id="swap/Y/3" value="0" height="25" width="21" tooltip="Switch-B" src="knobs/swapy.png"></webaudio-switch>
</div>
<!-- Laser 3 grid -->
<div class="lasergrid" style="background-image: url(knobs/lasergrid3.png)">
<div class="lasergrid" style="background-image: url(lasergrid3.png)">
<div><webaudio-param id="kpps/3" link="kpps/3" ></webaudio-param></div>
<div><webaudio-param id="points/3" link="points/3"></webaudio-param></div>
<div class="lasertext">kPPS</div>
@ -480,50 +483,49 @@
</div>
<!-- mg run icons grid -->
<div id="mgrun"class="mgrun">
<!-- Curve selection grid -->
<div><img src="img/iconljay2.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconljay2.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconastro.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconljay2.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconllstr.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconastro.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconljay2.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconpose.png" alt=" " class="icongrid" /></div>
<div><button id ="noteon 0" onclick ="buttonClicked(this.id)" class="button">Map.</button></div>
<div><button id ="noteon 1" onclick ="buttonClicked(this.id)" class="button">xPLS</button></div>
<div><button id ="noteon 2" onclick ="buttonClicked(this.id)" class="button">Orbits</button></div>
<div><button id ="noteon 3" onclick ="buttonClicked(this.id)" class="button">Dot</button></div>
<div><button id ="noteon 4" onclick ="buttonClicked(this.id)" class="button">Sine</button></div>
<div><button id ="noteon 5" onclick ="buttonClicked(this.id)" class="button">Astro</button></div>
<div><button id ="noteon 6" onclick ="buttonClicked(this.id)" class="button:checked">Text</button></div>
<div><button id ="noteon 7" onclick ="buttonClicked(this.id)" class="button">Pose</button></div>
<!-- Set selection grid -->
<div><img src="img/iconljay1.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconljay1.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconllstr.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconpose.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconljay1.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconljay1.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconljay1.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconljay1.png" alt=" " class="icongrid" /></div>
<div><button id ="noteon 8" onclick ="buttonClicked(this.id)" class="button:checked">Set 0</button></div>
<div><button id ="noteon 9" onclick ="buttonClicked(this.id)" class="button">Set 1</button></div>
<div><button id ="noteon 10" onclick ="buttonClicked(this.id)" class="button">LLSTR</button></div>
<div><button id ="noteon 11" onclick ="buttonClicked(this.id)" class="button">Franken</button></div>
<div><button id ="noteon 12" onclick ="buttonClicked(this.id)" class="button">Ex.</button></div>
<div><button id ="noteon 13" onclick ="buttonClicked(this.id)" class="button">5.</button></div>
<div><button id ="noteon 14" onclick ="buttonClicked(this.id)" class="button">6</button></div>
<div><button id ="noteon 15" onclick ="buttonClicked(this.id)" class="button">7</button></div>
<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><button id ="noteon 0" onclick ="buttonClicked(this.id)" class="button:checked">0</button></div>
<div><button id ="noteon 1" onclick ="buttonClicked(this.id)" class="button">1</button></div>
<div><button id ="noteon 2" onclick ="buttonClicked(this.id)" class="button">2</button></div>
<div><button id ="noteon 3" onclick ="buttonClicked(this.id)" class="button">3</button></div>
<div><button id ="noteon 4" onclick ="buttonClicked(this.id)" class="button">4</button></div>
<div><button id ="noteon 5" onclick ="buttonClicked(this.id)" class="button">5</button></div>
<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/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>
<div><img src="knobs/iconblack.png" alt=" " class="icongrid" /></div>
<div><button id ="noteon 24" onclick ="buttonClicked(this.id)" class="button:checked">PL 0</button></div>
<div><button id ="noteon 25" onclick ="buttonClicked(this.id)" class="button">PL 1</button></div>
<div><button id ="noteon 26" onclick ="buttonClicked(this.id)" class="button">PL 2</button></div>
<div><button id ="noteon 27" onclick ="buttonClicked(this.id)" class="button">PL 3</button></div>
<div></div>
<div></div>
<div></div>
<div></div>
<!-- Laser selection grid -->
<div><img src="img/iconlaser.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconlaser.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconlaser.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconlaser.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconblack.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconblack.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconblack.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconblack.png" alt=" " class="icongrid" /></div>
<div><img src="knobs/iconlaser.png" alt=" " class="icongrid" /></div>
<div><img src="knobs/iconlaser.png" alt=" " class="icongrid" /></div>
<div><img src="knobs/iconlaser.png" alt=" " class="icongrid" /></div>
<div><img src="knobs/iconlaser.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>
<div><img src="knobs/iconblack.png" alt=" " class="icongrid" /></div>
<div><button id ="noteon 16" onclick ="buttonClicked(this.id)" class="button:checked">0</button></div>
<div><button id ="noteon 17" onclick ="buttonClicked(this.id)" class="button">1</button></div>
<div><button id ="noteon 18" onclick ="buttonClicked(this.id)" class="button">2</button></div>
@ -532,19 +534,19 @@
<div></div>
<div></div>
<div></div>
<!-- Simulator PL selection grid -->
<div><img src="img/iconsimu.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconsimu.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconsimu.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconsimu.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconblack.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconblack.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconblack.png" alt=" " class="icongrid" /></div>
<div><img src="img/iconblack.png" alt=" " class="icongrid" /></div>
<div><button id ="noteon 24" onclick ="buttonClicked(this.id)" class="button:checked">PL 0</button></div>
<div><button id ="noteon 25" onclick ="buttonClicked(this.id)" class="button">PL 1</button></div>
<div><button id ="noteon 26" onclick ="buttonClicked(this.id)" class="button">PL 2</button></div>
<div><button id ="noteon 27" onclick ="buttonClicked(this.id)" class="button">PL 3</button></div>
<!-- Hidden grid -->
<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>
<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>
<div><img src="knobs/iconblack.png" alt=" " class="icongrid" /></div>
<div><img src="knobs/iconblack.png" alt=" " class="icongrid" /></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
@ -688,88 +690,42 @@
}
</script>
<!-- Point list draw -->
<script>
<script type="text/javascript">
// Store Reference To The Canvas & Set Context
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
//var re = document.getElementById('speed');
//re.addEventListener('change', function(){
// speed = re.value;
// });
var lastpoint = { x: 0, y: 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(Math.random() * 220, Math.random() * 220);
ctx.moveTo(lastpoint.x , lastpoint.y );
// var xA = new Array();
// var yA = new Array();
//for (var i=0; i<=100, i++){
//xA[i] = ;
//yA[i] = ;
//}
// Draw Additional Randomly Placed Lines
for (var i = 0; i < 25; i++) {
ctx.lineTo(Math.random() * 400, Math.random() * 400);
// 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 = "#888";
ctx.stroke();
// Call Draw Function Again To Continue
// Drawing To Canvas To Create Animation
lastpoint.x = pl2[i*3];
lastpoint.y = pl2[1+(i*3)];
}
// Call Draw Function Again To Create Animation
window.requestAnimationFrame(draw);
}
<!--
//var speed = 100;
var lastpoint = { x: 0, y: 0 };
var pt = { x: 0, y: 0 };
// fade background a bit...
ctx.globalAlpha = 0.1;
ctx.fillStyle = '#000';
ctx.fillRect(0, 0, 400, 400);
ctx.globalAlpha = 1.0;
for (var i=0; i<=100; i++){
//var pt = seg.points[point];
pt.x = Math.random() * 400;
pt.y = Math.random() * 400;
// console.log('draw', pt);
var newpoint = {
x: pt.x,
y: pt.y
//x: 200 + 190 * pt.x / 32768,
//y: 200 - 190 * pt.y / 32768
};
ctx.strokeStyle = "#888";
ctx.beginPath();
ctx.moveTo(lastpoint.x, lastpoint.y);
ctx.lineTo(newpoint.x, newpoint.y);
ctx.closePath();
ctx.stroke();
lastpoint.x = newpoint.x;
lastpoint.y = newpoint.y;
}
-->
// Initialize The Draw Function
draw();
</script>
</body>
<!-- non displayed items, for code reference

BIN
webui/knobs/client.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
webui/knobs/iconamiral.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
webui/knobs/iconastro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
webui/knobs/iconblack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

BIN
webui/knobs/iconlaser.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
webui/knobs/iconljay1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
webui/knobs/iconljay2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
webui/knobs/iconllstr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
webui/knobs/iconpl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
webui/knobs/iconpong.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
webui/knobs/iconpose.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
webui/knobs/iconsimu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

324
webui/ljaygrid.css Normal file
View File

@ -0,0 +1,324 @@
.maingrid {
display: grid;
grid-template-columns: 900px;
grid-template-raw: 1fr 1fr 1fr 1fr;
grid-gap: 1px;
background-color: #222;
padding: 5px;
padding-bottom: 0px;
}
.mgtitle {
display: grid;
height: 90px;
grid-template-columns: 130px 70px 80px 600px;
background-color: #111;
transition: all .3s ease;
padding-top: 10px;
border-color: #445;
border-style: groove;
border-width: 1px;
}
.mgstatus {
display: grid;
grid-template-columns: 250px 150px 1fr;
grid-template-raw: 30px;
grid-column-gap: 1px;
grid-row-gap: 1px;
border-color: #334;
border-style: groove;
border-width: 1px;
background-color: #111;
font-size: small;
color:#444;
font-family: sans-serif, Helvetica, Verdana, Arial;
justify-items: center;
align-items: center;
font-family: 'hobeaux-rococeaux-background', Helvetica;
}
.mgalign {
display: grid;
height: 400px;
grid-template-columns: 144px 144px 138px 138px 10px;
grid-template-rows: 1Fr;
background-color: #151515;
border-color: #445;
border-style: groove;
border-width: 1px;
}
.mgcanvas {
display: none;
height: 400px;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1Fr;
background-color: #151515;
border-color: #445;
border-style: groove;
border-width: 1px;
}
.mglive {
display: none;
height: 400px;
grid-template-columns: 138px 138px 512px 1Fr;
grid-template-rows: 1Fr;
background-color: #151515;
border-color: #445;
border-style: groove;
border-width: 1px;
}
.mgrun {
display: none;
height: 400px;
grid-template-columns: 66px 66px 66px 66px 66px 66px 66px 66px;
grid-template-rows: 66px 17px 69px 17px 66px 17px 66px 17px;
background-color: #000;
justify-items: center;
align-items: center;
border-color: #445;
border-style: groove;
border-width: 1px;
grid-gap: 1px;
transition: all .3s ease;
}
.mgfooter {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-raw: 25px;
grid-column-gap: 1px;
grid-row-gap: 1px;
border-color: #334;
border-style: groove;
border-width: 1px;
background-color: #111;
font-size: small;
font-family: sans-serif, Helvetica, Verdana, Arial;
justify-items: center;
align-items: center;
font-family: 'hobeaux-rococeaux-background', Helvetica;
}
.topgrid {
display: grid;
height: 80px;
grid-template-columns: 60px 75px 40px 60px 75px 60px 75px 60px 75px;
background-color: #111;
justify-items: center;
align-items: center;
grid-gap: 1px;
border-color: #445;
border-style: groove;
border-width: 1px;
transition: all .3s ease;
}
.laserbox {
display: grid;
height: 390px;
width: 132px;
grid-template-columns: 124px;
grid-template-rows: 15px 32px 325px;
background-color: #111;
line-height: 1;
padding: 4px;
justify-items: center;
align-items: center;
border-color: #334;
border-style: groove;
border-width: 1px;
}
.lasergrid {
display: grid;
height: 323px;
width: 124px;
grid-template-columns: 62px 62px;
grid-template-rows: 30px 19px 8px 55px 20px 19px 8px 55px 25px 19px 8px 55px 19px;
background-color: #111;
line-height: 1;
justify-items: center;
align-items: center;
color:#88c;
}
.lissabox {
display: grid;
height: 353px;
width: 126px;
grid-template-columns: 124px;
grid-template-rows: 15px 338px;
background-color: #111;
line-height: 1;
padding: 6px;
justify-items: center;
align-items: center;
border-color: #334;
border-style: groove;
border-width: 1px;
}
.spacer {
display: grid;
height: 8px;
}
.lissagrid {
display: grid;
height: 323px;
width: 124px;
grid-template-columns: 60px 60px ;
grid-template-rows: 55px 25px 15px 8px 55px 25px 15px 8px 55px 25px 15px;
background-color: #111;
line-height: 1;
justify-items: center;
align-items: center;
}
.withaibox {
display: grid;
height: 353px;
width: 126px;
grid-template-columns: 124px;
grid-template-rows: 15px 338px;
background-color: #111;
line-height: 1;
padding: 6px;
justify-items: center;
align-items: center;
border-color: #334;
border-style: groove;
border-width: 1px;
}
.withaigrid {
display: grid;
height: 323px;
width: 124px;
grid-template-columns: 60px 60px ;
grid-template-rows: 55px 25px 15px 8px 55px 25px 15px 8px 55px 25px 15px;
background-color: #111;
line-height: 1;
justify-items: center;
align-items: center;
}
.projgrid {
display: grid;
height: 140px;
width: 194px;
grid-template-columns: 1Fr 1Fr 1Fr;
grid-template-rows: 25px 8px 55px 25px 15px;
background-color: #111;
line-height: 1;
justify-items: center;
align-items: center;
border-color: #334;
border-style: groove;
border-width: 1px;
}
.lasertext {
font-size: small;
font-family: Helvetica, Verdana, Arial, sans-serif;
color: #bbb;
}
.lasertextxs {
font-size: x-small;
font-family: Helvetica, Verdana, Arial, sans-serif;
color: #bbb;
}
.lsttgrid {
display: grid;
height: 20px;
grid-template-columns: 10px 10px 25px 25px;
grid-template-rows: 15px 15px 15px 15px 15px;
grid-gap: 1px;
justify-items: center;
align-items: center;
transition: all .3s ease;
}
.onoffgrid {
display: grid;
height: 14px;
grid-template-columns: 1Fr;
grid-template-rows: 15px 110px;
justify-items: center;
transition: all .3s ease;
}
.icongrid {
padding: 2px;
width: 100%;
max-height: 100%;
}
#showin {
font-family: Helvetica, Verdana, Arial, sans-serif;
color :#444;
width: 150px;
height: 25px;
padding-top: 4px;
}
#showout {
font-family: Helvetica, Verdana, Arial, sans-serif;
color: #444;
width: 150px;
height: 25px;
padding-top: 4px;
}
#events {
font-family: Helvetica, Verdana, Arial, sans-serif;
color: #444;
width: 150px;
height: 25px;
padding-top: 4px;
}
.button {
display: inline-block;
text-align: center;
vertical-align: middle;
padding: 8px 5px;
border: 1px solid #404040;
background: #141414;
background: -webkit-gradient(linear, left top, left bottom, from(#141414), to(#141414));
background: -moz-linear-gradient(top, #141414, #141414);
background: linear-gradient(to bottom, #141414, #141414);
font: normal normal normal 11px arial;
color: #ffffff;
text-decoration: none;
}
.button:hover,
.button:focus {
padding: 8px 5px;
border: 1px solid #b6b6b6;
background: #181818;
background: -webkit-gradient(linear, left top, left bottom, from(#181818), to(#181818));
background: -moz-linear-gradient(top, #181818, #181818);
background: linear-gradient(to bottom, #181818, #181818);
color: #ffffff;
text-decoration: none;
}
.button:active {
padding: 8px 5px;
background: #0c0c0c;
background: -webkit-gradient(linear, left top, left bottom, from(#0c0c0c), to(#141414));
background: -moz-linear-gradient(top, #0c0c0c, #141414);
background: linear-gradient(to bottom, #0c0c0c, #141414);
border: 1px solid #6666B6;
}
.button:checked {
padding: 8px 5px;
background: #c0c0c0;
color: #0c0c0c;
border: 1px solid #6666B6;
display: inline-block;
text-align: center;
vertical-align: middle;
border-radius: 5px;
font: normal normal normal 11px arial;
text-decoration: none;
}
.submit {
background: #0c0c0c;
color: #c0c0c0;
width: 90px;
text-align: center;
vertical-align: middle;
height: 15px;
background: -webkit-gradient(linear, left top, left bottom, from(#0c0c0c), to(#141414));
background: -moz-linear-gradient(top, #0c0c0c, #141414);
background: linear-gradient(to bottom, #0c0c0c, #141414);
border: 1px solid #445;
}