From 67a40ce98e117db510156c3ae5602c0ee3ab154c Mon Sep 17 00:00:00 2001 From: Lucca Ketterer Date: Tue, 27 Apr 2021 11:57:38 +0200 Subject: [PATCH] add color codes to debug print --- client/client.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/client/client.py b/client/client.py index ce9b36d..4a5e2da 100755 --- a/client/client.py +++ b/client/client.py @@ -88,21 +88,25 @@ def vibrant(r,g,b): #rgb[min_idx] = int(rgb[min_idx]*(rgb[min_idx]/d)**2) return rgb -def p_controller(soll, ist, K): - return K*(soll-ist) - def ambient_light_thread(): r,g,b = 0,0,0 brighness = 1 + active_color = '' + while True: # P-Regler r,g,b = [w+((y-w)*0.08) for y,w in zip((_r,_g,_b),(r,g,b))] - print(int(r), int(g), int(b), '\033[0;35;40m', _r,_g,_b, '\033[0;37;40m') + if ((round(r),round(g),round(b)) == (_r,_g,_b)): + active_color = '\033[0;32;40m' + else: + active_color = '\033[0;31;40m' + print(active_color, round(r),round(g),round(b), '\033[0;37;40m') send(rgb_to_hex(int(r*brighness),int(g*brighness),int(b*brighness))) time.sleep(0.01) ups_counter = 0 start_time = time.time() + def ups(): global ups_counter global start_time @@ -114,7 +118,8 @@ def ups(): def color_correction(r,g,b): amp = [1,1,0.8] - if r < 5 and g < 5 and b < 5: + threshold = 10 + if r < threshold and g < threshold and b < threshold: return 0,0,0 return int(r*amp[0]), int(g*amp[1]), int(b*amp[2])