From 7e8d298595664b608735513e7bbfa2e0d8f64c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=96ScreamingOranges?= Date: Thu, 27 May 2021 23:14:27 -0400 Subject: [PATCH] Fixed issue with taking/releasing control of leds. Replaced priority control with request and release controls --- icueConnect.py | 7 +++++-- main.py | 2 +- pusherConnect.py | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/icueConnect.py b/icueConnect.py index 6aa9b31..e631d0a 100644 --- a/icueConnect.py +++ b/icueConnect.py @@ -73,8 +73,11 @@ def setLedsByDevice(self, device,RGB_val): sdk.set_led_colors_buffer_by_device_index(device, deviceToLed[device]) sdk.set_led_colors_flush_buffer() - def setPriority(self,value): - sdk.set_layer_priority(value) + def requestControl(self): + sdk.request_control() + + def releaseControl(self): + sdk.release_control() def perform_pulse_effect(self,wave_duration,RGB_val): time_per_frame = 25 diff --git a/main.py b/main.py index 13f6763..ce37219 100644 --- a/main.py +++ b/main.py @@ -30,7 +30,7 @@ def checkJsonFile(): def colorResetCall(): conn = icueConnect.icueConnect() - conn.setPriority(0) + conn.releaseControl() del conn def main(): diff --git a/pusherConnect.py b/pusherConnect.py index 48583fe..e0dd33d 100644 --- a/pusherConnect.py +++ b/pusherConnect.py @@ -40,16 +40,17 @@ def my_func(self, *args, **kwargs): #print(result) result = json.loads(result) conn = icueConnect.icueConnect() - conn.setPriority(255)#iCue's priority is 127 if "RGB_PULSE" in result: + conn.requestControl() RGB_val = result["RGB_PULSE"] conn.perform_pulse_effect(1000,RGB_val) - conn.setPriority(0) + conn.releaseControl() elif "RGB_SOLID" in result: + conn.requestControl() RGB_val = result["RGB_SOLID"] conn.solidColor(RGB_val) elif "RGB_RESET" in result: - conn.setPriority(0) + conn.releaseControl() elif "Request_SubDevices" in result: print('Received From App') devices = conn.getDevicesIdMap()