diff --git a/acabsl.py b/acabsl.py index 7ab8f9b..f30b387 100644 --- a/acabsl.py +++ b/acabsl.py @@ -1,11 +1,11 @@ import socket import sys, getopt -UDPHOST="localhost" -UDPPORT=6002 +UDPHOST="127.0.0.1" +UDPPORT=8002 -WALLSIZEX=16 -WALLSIZEY=16 +WALLSIZEX=6 +WALLSIZEY=6 NOOFWALLS=1 WALL=0 # Throws an error if an option is not recognized diff --git a/animations/blackAllTheThings.py b/animations/blackAllTheThings.py index dd16d1a..a33d67a 100755 --- a/animations/blackAllTheThings.py +++ b/animations/blackAllTheThings.py @@ -13,17 +13,17 @@ def set_all(r,g,b): def set_wall(r,g,b): acabsl.set_target("127.0.0.1",6002) - for w in range(acabsl.NOOFWALLS): - for x in range(acabsl.WALLSIZEX): - for y in range(acabsl.WALLSIZEY): + for w in range(1): + for x in range(6): + for y in range(8): acabsl.send(x,y,r,g,b,1,w) acabsl.update() def set_decke(r,g,b): acabsl.set_target("127.0.0.1",8002) - for w in range(acabsl.NOOFWALLS): - for x in range(acabsl.WALLSIZEX): - for y in range(acabsl.WALLSIZEY): + for w in range(2): + for x in range(12): + for y in range(12): acabsl.send(x,y,r,g,b,1,w) acabsl.update() diff --git a/animations/enerystar.py b/animations/enerystar.py index 288c92f..545e9de 100755 --- a/animations/enerystar.py +++ b/animations/enerystar.py @@ -26,8 +26,8 @@ def turn_off(): global turned_off turned_off = True -schedule.every().day.at("16:00").do(turn_on) -schedule.every().day.at("08:00").do(turn_off) +schedule.every().day.at("13:00").do(turn_on) +schedule.every().day.at("07:00").do(turn_off) while 1: schedule.run_pending() diff --git a/animations/s-color4-faster.py b/animations/s-color4-faster.py index e1eab9d..ac6ab97 100755 --- a/animations/s-color4-faster.py +++ b/animations/s-color4-faster.py @@ -9,7 +9,7 @@ import time import math -tick = 1.65 +tick = 1.65 / 10 def setcol(col, r, g, b, time): for i in range(0,6): diff --git a/playlist-wall.py b/playlist-wall.py index c9182cd..f6d0513 100644 --- a/playlist-wall.py +++ b/playlist-wall.py @@ -16,21 +16,24 @@ def getPlaylist(): #wall can be temporary blanked by issuing python black.py in a different screen window #[20, [["python","animations/black.py","--wall=0"]]], - [20, [["python","animations/screw.py","--wall=0"], ["python","animations/rainbowscroll.py","--wall=1"]]], - [20, [["python","animations/screw.py","--wall=0"]]], + #[20, [["python","animations/pride.py", "--wall=0"]]], + #[20, [["python","animations/green.py", "--wall=0"]]], + [20, [["python","animations/rc3-2021.py", "--wall=0"]]], + #[20, [["python","animations/screw.py","--wall=0"], ["python","animations/rainbowscroll.py","--wall=1"]]], + #[20, [["python","animations/screw.py","--wall=0"]]], #[20, [["python","animations/rainbowscroll.py","--wall=0"]]], - [20, [["python","animations/multiwall_rainbowscroll.py"]]], - [20, [["python","animations/s-color4-faster.py"]]], + #[20, [["python","animations/multiwall_rainbowscroll.py"]]], + #[20, [["python","animations/s-color4-faster.py"]]], #[20, [["python","animations/rand.py"]]], #[20, [["python","animations/python-banner.py"]]], #[20, [["python","animations/gameoflife.py"]]], #[20, [["python","animations/dmm/hackerbrucke.py"]]], - [20, [["python","animations/red-sym-scroll.py"]]], - [20, [["python","animations/multiwall_fullpulse.py"]]], + #[20, [["python","animations/red-sym-scroll.py"]]], + #[20, [["python","animations/multiwall_fullpulse.py"]]], #[20, [["python","animations/dropping.py"]]], #[20, [["python","animations/dmm/hackerbrucke.py"]]], #[20, [["python","animations/dmm/dt.py"]]], #[20, [["python","animations/dmm/uhrzeit.py"]]], - [20, [["python","animations/multiwall_warp_core.py"]]], + #[20, [["python","animations/multiwall_warp_core.py"]]], ] return playlist diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..64b3006 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,21 @@ +[[package]] +name = "pyserial" +version = "3.5" +description = "Python Serial Port Extension" +category = "main" +optional = false +python-versions = "*" + +[package.extras] +cp2110 = ["hidapi"] + +[metadata] +lock-version = "1.1" +python-versions = "^3.9" +content-hash = "0b7919ac7c1646d88aa1e9cf16cc3de007a7696e6f1edeaf4d2ac377e79fd39f" + +[metadata.files] +pyserial = [ + {file = "pyserial-3.5-py2.py3-none-any.whl", hash = "sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0"}, + {file = "pyserial-3.5.tar.gz", hash = "sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..08bafd5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "acab-streetlife" +version = "0.1.0" +description = "" +authors = ["muCCC"] +readme = "README.md" +packages = [{include = "acab_streetlife"}] + +[tool.poetry.dependencies] +python = "^3.9" +pyserial = "^3.5" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/server/acabsl-config-generator.py b/server/acabsl-config-generator.py index 673c35e..f4a46f9 100755 --- a/server/acabsl-config-generator.py +++ b/server/acabsl-config-generator.py @@ -60,11 +60,9 @@ def write_config(serials, interfaces, matrix): serials1 = set() serials1 = set() - input("Please attach the USB to RS485 bridges and press enter.: ") serials2 = set(os.listdir('/dev/serial/by-id')) - serials = ['/dev/serial/by-id/'+serial for serial in serials2 - serials1] if len(serials) == 0: @@ -114,7 +112,7 @@ def get_tuple(message, default=None): print("Your matrix is",xsize,"X",ysize,"big.") min_address = get_number("Please enter the smallest lamp address (in hexadecimal)[10]: ", 16, 0x10) -max_address = get_number("Please enter the biggest lamp address (in hexadecimal)[FF]: ", 16, 0xFF) +max_address = get_number("Please enter the biggest lamp address (in hexadecimal)[BF]: ", 16, 0xFF) print("Tested address range: %02X - %02X (%d addresses)"%(min_address, max_address, max_address-min_address+1)) addresses = list(range(min_address, max_address+1)) diff --git a/server/acabsl-rconfig-server.py b/server/acabsl-rconfig-server.py index 65b1512..68214bf 100755 --- a/server/acabsl-rconfig-server.py +++ b/server/acabsl-rconfig-server.py @@ -35,6 +35,8 @@ path=arg serials = os.listdir(path) +#print("WARNING: serials are currently hardcoded") +#serials = [ 'usb-FTDI_FT232R_USB_UART_A400fvDr-if00-port0', 'usb-FTDI_FT232R_USB_UART_A10044Xp-if00-port0'] if len(serials) == 0: print "Found no devices. Aborting." diff --git a/server/acabsl_interface.py b/server/acabsl_interface.py index 5211856..39a32f1 100644 --- a/server/acabsl_interface.py +++ b/server/acabsl_interface.py @@ -22,8 +22,8 @@ def interfaceHandler(queue, serial, updatequeue): time.sleep(0.001) def createBridge(dev): - serial = serialinterface.SerialInterface(dev,115200,1) - queue = Queue() + serial = serialinterface.SerialInterface(dev, 115200, 1) + queue = Queue(255) updatequeue = Queue(1) updatequeues.append(updatequeue) return (queue, serial, updatequeue) diff --git a/server/acabslrouter.py b/server/acabslrouter.py index 6c94856..4cf50e3 100755 --- a/server/acabslrouter.py +++ b/server/acabslrouter.py @@ -24,7 +24,7 @@ #inputs = [[port, priority, timeout, socket], inputs = [{'port': router_base_port + 0, 'priority': 0, 'timeout': 1}, {'port': router_base_port + 1, 'priority': 1, 'timeout': 5}, - {'port': router_base_port + 2, 'priority': 2, 'timeout': 5}, + {'port': router_base_port + 2, 'priority': 2, 'timeout': 30}, {'port': router_base_port + 3, 'priority': 3, 'timeout': 5}, {'port': router_base_port + 4, 'priority': 4, 'timeout': 5}] diff --git a/server/config-decke.py b/server/config-decke.py index 1feb6b6..1339c1a 100644 --- a/server/config-decke.py +++ b/server/config-decke.py @@ -1,20 +1,21 @@ server_ip = '0.0.0.0' server_port = 7000 -serials = ['/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A10044Xp-if00-port0', '/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A400fvDr-if00-port0'] +serials = ['/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A400fvDr-if00-port0', '/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A10044Xp-if00-port0'] interfaces = [0, 1] -matrix = [[(0x57,0), (0x4A,1)], - [(0x6D,0), (0x43,1)], +matrix = [ + [(0x57,0), (0x47,1)], + [(0x6d,0), (0x4a,1)], [(0x17,0), (0x41,1)], - [(0x42,0), (0x19,1)], - [(0x67,0), (0x38,1)], - [(0x20,0), (0x56,1)], - [(0x5A,0), (0x3E,1)], - [(0x5C,0), (0x4C,1)], - [(0x4E,0), (0x3F,1)], - [(0x22,0), (0x6B,1)], - [(0x28,0), (0x47,1)], - [(0x26,0), (0x45,1)]] - + [(0x42,0), (0x3f,1)], + [(0x67,0), (0x39,1)], + [(0x20,0), (0x38,1)], + [(0x5a,0), (0x43,1)], + [(0x5c,0), (0x45,1)], + [(0x4e,0), (0x4c,1)], + [(0x22,0), (0x19,1)], + [(0x28,0), (0x56,1)], + [(0x26,0), (0x3e,1)], + ] simulation = False router_base_port = 8000 diff --git a/start-all b/start-all index 0066653..e9014e5 100755 --- a/start-all +++ b/start-all @@ -3,9 +3,12 @@ killall -9 python sleep 2 cd /home/acab/acab-streetlife -# ./start-32c3 +#./start-34c3 +#./start-muc-sf-festival ./start-wall -./start-decke +#./start-camp19 +#./start-decke #./start-cccamp +#./start-36c3 ./web-control-server.py & diff --git a/start-wall b/start-wall index 3717eb7..653c295 100755 --- a/start-wall +++ b/start-wall @@ -4,4 +4,8 @@ python server/acabslserver.py server/config-wall.py & #python animations/s-color4-faster.py --port=6000 & python animations/enerystar.py --port=6003 & -screen -A -m -d -S wall-scheduler python scheduler.py playlist-wall 6001 6 8 +# Original +screen -A -m -d -S wall-scheduler python scheduler.py playlist-wall-normal 6001 6 6 + +# For 33c3 lamp testing +#screen -A -m -d -S wall-scheduler python scheduler.py playlist-wall 6001 4 8 diff --git a/tests/testlamp b/tests/testlamp index 905b851..9eec790 100755 --- a/tests/testlamp +++ b/tests/testlamp @@ -11,6 +11,9 @@ x = int(sys.argv[1]) y = int(sys.argv[2]) t = float(sys.argv[3]) +acabsl.UDPHOST = "localhost" +acabsl.UDPPORT = 8002 + while 1: send(x,y,255,0,0,t) #update()