add color codes to debug print

This commit is contained in:
Lucca Ketterer 2021-04-27 11:57:38 +02:00
parent 180d4ebe13
commit 67a40ce98e

View File

@ -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])