aboutsummaryrefslogtreecommitdiff
path: root/NeoRuntime/Runtime/neo_runtime.py
diff options
context:
space:
mode:
authorJakob Stendahl <jakobste@uio.no>2021-10-03 20:01:31 +0200
committerJakob Stendahl <jakobste@uio.no>2021-10-03 20:01:31 +0200
commit4850c11d87df287beacf5a5bd9012f7b54f13566 (patch)
tree549f08a23a4fe87a07ec17885016696e829ca50b /NeoRuntime/Runtime/neo_runtime.py
parent950d093ca54366ce49164370325062afd061cf9d (diff)
downloadLuxcena-Neo-4850c11d87df287beacf5a5bd9012f7b54f13566.tar.gz
Luxcena-Neo-4850c11d87df287beacf5a5bd9012f7b54f13566.zip
:sprakles: Add BooleanVariable
Diffstat (limited to 'NeoRuntime/Runtime/neo_runtime.py')
-rw-r--r--NeoRuntime/Runtime/neo_runtime.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/NeoRuntime/Runtime/neo_runtime.py b/NeoRuntime/Runtime/neo_runtime.py
index 4ecbc97..d132bff 100644
--- a/NeoRuntime/Runtime/neo_runtime.py
+++ b/NeoRuntime/Runtime/neo_runtime.py
@@ -59,7 +59,7 @@ class NeoRuntime:
self.__module_th = None
self.__socket_file = socket_file
self.__send_strip_buffer = False
-
+
def start(self):
# The mode is starting in it's own thread
@@ -82,7 +82,7 @@ class NeoRuntime:
def __bind_socket(self):
if path.exists(self.__socket_file):
remove(self.__socket_file)
-
+
self.__s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.__s.bind(self.__socket_file)
self.__s.listen(1)
@@ -126,7 +126,7 @@ class NeoRuntime:
rs.close()
else:
self.__execute_command(data)
-
+
def __close_socket(self):
if (self.__s is None): return
r, w, e = select.select([self.__s, *self.__s_clients], self.__s_clients, [], 0)
@@ -145,22 +145,20 @@ class NeoRuntime:
"""
command should be of type bytes
first byte indicates command type (currently setglob or setvar)
-
+
for command type 1
byte 1 indicates which globvar
byte 2 indicates value
for command type 2
first 32 bytes are the var name
-
+
"""
# print(command.hex(" "))
if command[0] == 0:
if command[1] == 0:
self.__strip.power_on = (command[2] == 1)
- print(f"Strip power: {self.__strip.power_on}")
elif command[1] == 1:
self.__strip.brightness = command[2]
- print(f"Strip brightness: {self.__strip.brightness}")
else:
print(f"Unknown globvar {command[1]}.")
elif command[0] == 1:
@@ -236,7 +234,7 @@ if __name__ == "__main__":
if not path.exists(f"{args.mode_path}/{args.mode_entry}.py"):
print(f"Mode entry not found in mode path ({args.mode_path}/{args.mode_entry}).")
sys.exit(1)
-
+
print(f"StripConfig: {args.strip_config}")
print(f"Module : {args.mode_path}/{args.mode_entry}")