Gracefuler end.
This commit is contained in:
parent
3dff5d92af
commit
490dfb1af1
2
LJ.conf
2
LJ.conf
@ -1,5 +1,5 @@
|
||||
[General]
|
||||
lasernumber = 4
|
||||
lasernumber = 2
|
||||
debug = 0
|
||||
ljayserverip = 0.0.0.0
|
||||
wwwip = 192.168.2.43
|
||||
|
@ -354,7 +354,9 @@ About hardware setup, especially if you have several lasers : ILDA cables are in
|
||||
#
|
||||
|
||||
2 useful and *always working tools* from j4cdac github repository : sitter and talk.
|
||||
- Sitter will display all etherdreams available on the network and their state (playing, idle,...). python sitter.py or use the compiled version (for macOS). May need tkinter : pip3 install tk
|
||||
- Sitter will display all etherdreams available on the network and their state (playing, idle,...). python sitter.py or use the compiled version (for macOS). May need tkinter :
|
||||
pip3 install tk
|
||||
+/- : sudo apt install python-tk
|
||||
- Talk : will draw a 4 colors square. Try : python3 talk3.py -h
|
||||
|
||||
#
|
||||
|
@ -35,7 +35,7 @@ import sys
|
||||
|
||||
argsparser = argparse.ArgumentParser(description="Draw a square on a laser via Etherdream DAC")
|
||||
|
||||
argsparser.add_argument("-i","--ip",help="Etherdream IP (default : first etherdream broadcast received",default="True",type=str)
|
||||
argsparser.add_argument("-i","--ip",help="Etherdream IP (default : first etherdream broadcast received)",default="True",type=str)
|
||||
|
||||
|
||||
|
||||
|
@ -15,6 +15,7 @@ from /team/laser
|
||||
from libs3 import gstt
|
||||
import argparse
|
||||
import subprocess
|
||||
from libs3 import settings
|
||||
|
||||
def handle():
|
||||
|
||||
@ -112,8 +113,7 @@ def handle():
|
||||
# Lasers = number of laser connected otherwise will be autodetected with one minimum
|
||||
if args.Lasers != None:
|
||||
gstt.LaserNumber = args.Lasers
|
||||
else:
|
||||
gstt.LaserNumber = 1
|
||||
Settings.Write()
|
||||
|
||||
|
||||
if args.bhoroscIP != None:
|
||||
|
@ -92,7 +92,7 @@ Bob could use /pl/2/0 and /pl/2/1 and Lisa could use /pl/2/2 and /pl/2/3.
|
||||
import types, time, socket
|
||||
from libs3 import gstt
|
||||
import redis
|
||||
from libs3 import settings, plugins, homographyp
|
||||
from libs3 import settings, plugins, homographyp,log
|
||||
|
||||
|
||||
r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0)
|
||||
@ -333,6 +333,9 @@ def handler(oscpath, args):
|
||||
print()
|
||||
print("new laser number",args[0])
|
||||
print()
|
||||
gstt.LaserNumber = args[0]
|
||||
settings.Write()
|
||||
|
||||
|
||||
if oscpath[2] == "regen":
|
||||
print()
|
||||
@ -352,6 +355,7 @@ def handler(oscpath, args):
|
||||
print()
|
||||
gstt.debug = int(args[0])
|
||||
plugins.SendAll("/debug "+str(gstt.debug))
|
||||
settings.Write()
|
||||
|
||||
|
||||
if oscpath[2] == "rescan":
|
||||
@ -359,11 +363,13 @@ def handler(oscpath, args):
|
||||
DAChecks()
|
||||
print("Done.")
|
||||
|
||||
if oscpath[2] == "rstrt":
|
||||
if oscpath[2] == "restart":
|
||||
print()
|
||||
print("Restarting", args[0], "...")
|
||||
if args[0] == "lj":
|
||||
raise Restart(time.asctime())
|
||||
LJautokill()
|
||||
import os
|
||||
os.execv(sys.executable, ['python3'] + sys.argv)
|
||||
else:
|
||||
plugins.Restart(args[0])
|
||||
print()
|
||||
@ -586,6 +592,31 @@ def isconnected(IP):
|
||||
time.sleep(delay)
|
||||
return ipup
|
||||
'''
|
||||
def LJautokill():
|
||||
|
||||
log.warn("LJ stopping...")
|
||||
print(gstt.LaserNumber,"Tracers launched")
|
||||
lasernumber= gstt.LaserNumber -1
|
||||
log.warn("Killing tracer0...")
|
||||
worker0.join()
|
||||
if lasernumber >0:
|
||||
log.warn("Killing tracer1...")
|
||||
worker1.join()
|
||||
if lasernumber >1:
|
||||
log.warn("Killing tracer2...")
|
||||
worker2.join()
|
||||
if lasernumber >2:
|
||||
log.warn("Killing tracer3...")
|
||||
worker3.join()
|
||||
|
||||
log.warn("Laser feedbacks resetting...")
|
||||
for laserid in range(0,lasernumber+1):
|
||||
|
||||
r.set('/lack/'+str(laserid),64)
|
||||
r.set('/lstt/'+str(laserid),64)
|
||||
r.set('/cap/'+str(laserid),0)
|
||||
log.infog("LJ stopped.")
|
||||
|
||||
|
||||
# autodetect DACs in LJ.conf.
|
||||
def DAChecks():
|
||||
|
@ -23,7 +23,7 @@ ljpath=''
|
||||
anims= [[],[],[],[]]
|
||||
|
||||
# How many lasers are connected. Different that "currentlaser" and "dacnumber" (=autodetected)
|
||||
LaserNumber = -1
|
||||
LaserNumber = 4
|
||||
|
||||
# What laser client to listen at launch
|
||||
SceneNumber = 0
|
||||
|
12
main.py
12
main.py
@ -440,21 +440,25 @@ if __name__ == '__main__':
|
||||
# Launch one process (a newdacp instance) by etherdream
|
||||
dac_worker0= Process(target=dac_process, args=(0,0,))
|
||||
dac_worker0.start()
|
||||
commands.worker0 = dac_worker0
|
||||
print("Tracer 0 : name", dac_worker0.name , "pid", dac_worker0.pid )
|
||||
|
||||
if lasernumber >0:
|
||||
dac_worker1= Process(target=dac_process, args=(1,0,))
|
||||
commands.worker1 = dac_worker1
|
||||
print("Tracer 1 : name", dac_worker1.name , "pid", dac_worker1.pid )
|
||||
dac_worker1.start()
|
||||
|
||||
if lasernumber >1:
|
||||
dac_worker2= Process(target=dac_process, args=(2,0,))
|
||||
dac_worker2.start()
|
||||
commands.worker2 = dac_worker2
|
||||
print("Tracer 2 : name", dac_worker2.name , "pid", dac_worker2.pid )
|
||||
|
||||
if lasernumber >2:
|
||||
dac_worker3= Process(target=dac_process, args=(3,0,))
|
||||
print("Tracer 3 : name", dac_worker3.name , "pid", dac_worker3.pid )
|
||||
commands.worker3 = dac_worker3
|
||||
dac_worker3.start()
|
||||
print("")
|
||||
#def Run():
|
||||
@ -512,13 +516,12 @@ if __name__ == '__main__':
|
||||
log.err("Exception")
|
||||
traceback.print_exc()
|
||||
|
||||
except Restart(moment):
|
||||
print("Autokill asked at", moment)
|
||||
|
||||
# Gently stop on CTRL C
|
||||
|
||||
finally:
|
||||
|
||||
commands.LJautokill()
|
||||
'''
|
||||
dac_worker0.join()
|
||||
if lasernumber >0:
|
||||
dac_worker1.join()
|
||||
@ -533,8 +536,9 @@ if __name__ == '__main__':
|
||||
r.set('/lack/'+str(laserid),64)
|
||||
r.set('/lstt/'+str(laserid),64)
|
||||
r.set('/cap/'+str(laserid),0)
|
||||
'''
|
||||
|
||||
|
||||
print("Fin de LJ.")
|
||||
|
||||
#if __name__ == "__main__":
|
||||
# Run()
|
||||
|
Loading…
Reference in New Issue
Block a user