|
|
@ -20,7 +20,7 @@ def set_all_leds(device, grb=[0,0,0]):
|
|
|
|
return_value = device.set_led_data(0, grb*32)
|
|
|
|
return_value = device.set_led_data(0, grb*32)
|
|
|
|
sleep(0.02) # minimal delay to not crash the blinkstick
|
|
|
|
sleep(0.02) # minimal delay to not crash the blinkstick
|
|
|
|
return return_value
|
|
|
|
return return_value
|
|
|
|
def morph_color(color, steps):
|
|
|
|
def morph_channel(color, steps):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Takes an int between 0-255 and either increments or decreases it by the specified steps.
|
|
|
|
Takes an int between 0-255 and either increments or decreases it by the specified steps.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -45,10 +45,10 @@ def morph_grb(grb, steps, mode='single'):
|
|
|
|
|
|
|
|
|
|
|
|
if mode == 'single':
|
|
|
|
if mode == 'single':
|
|
|
|
color_index = randint(0, len(grb)-1)
|
|
|
|
color_index = randint(0, len(grb)-1)
|
|
|
|
grb[color_index] = morph_color(grb[color_index], steps)
|
|
|
|
grb[color_index] = morph_channel(grb[color_index], steps)
|
|
|
|
elif mode == 'all':
|
|
|
|
elif mode == 'all':
|
|
|
|
for color_index in range(len(grb)):
|
|
|
|
for color_index in range(len(grb)):
|
|
|
|
grb[color_index] = morph_color(grb[color_index], steps)
|
|
|
|
grb[color_index] = morph_channel(grb[color_index], steps)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise Exception(f'Mode "{mode}" is not supported.')
|
|
|
|
raise Exception(f'Mode "{mode}" is not supported.')
|
|
|
|
|
|
|
|
|
|
|
|