added idle light event (green) triggered on hello and menu
This commit is contained in:
parent
39b848e433
commit
29b9350b7a
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import websocket
|
import websocket
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import thread
|
import thread
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -74,7 +75,7 @@ class Layer:
|
|||||||
def run_next_fade_color(self):
|
def run_next_fade_color(self):
|
||||||
if not self.animation_finished and self.animation_current_brightness > 0:
|
if not self.animation_finished and self.animation_current_brightness > 0:
|
||||||
# fade rgb values
|
# fade rgb values
|
||||||
self.animation_current_brightness -= 25
|
self.animation_current_brightness -= 30
|
||||||
|
|
||||||
# set current layer color brightness to animation brightness
|
# set current layer color brightness to animation brightness
|
||||||
for i in range(0, 2):
|
for i in range(0, 2):
|
||||||
@ -105,7 +106,6 @@ class Layer:
|
|||||||
# reset current brightness of color for new animation
|
# reset current brightness of color for new animation
|
||||||
self.animation_current_brightness = self.max_brightness
|
self.animation_current_brightness = self.max_brightness
|
||||||
self.animation_finished = False
|
self.animation_finished = False
|
||||||
output_rgb_array[2] = self.max_brightness
|
|
||||||
elif event_value == 5 or event_value == 6:
|
elif event_value == 5 or event_value == 6:
|
||||||
# static red light
|
# static red light
|
||||||
output_rgb_array[0] = self.max_brightness
|
output_rgb_array[0] = self.max_brightness
|
||||||
@ -116,7 +116,10 @@ class Layer:
|
|||||||
# reset current brightness of color for new animation
|
# reset current brightness of color for new animation
|
||||||
self.animation_current_brightness = self.max_brightness
|
self.animation_current_brightness = self.max_brightness
|
||||||
self.animation_finished = False
|
self.animation_finished = False
|
||||||
output_rgb_array[0] = self.max_brightness
|
elif event_value == 8:
|
||||||
|
# idle color
|
||||||
|
output_rgb_array[1] = self.max_brightness
|
||||||
|
self.animation_finished = True
|
||||||
|
|
||||||
return output_rgb_array
|
return output_rgb_array
|
||||||
|
|
||||||
@ -169,6 +172,8 @@ def parse_json(input_json):
|
|||||||
event_bomb_cut()
|
event_bomb_cut()
|
||||||
elif current_event == "beatmapEvent":
|
elif current_event == "beatmapEvent":
|
||||||
event_beat_map(json_content["beatmapEvent"])
|
event_beat_map(json_content["beatmapEvent"])
|
||||||
|
elif current_event == "hello" or current_event == "menu":
|
||||||
|
event_idle()
|
||||||
# else:
|
# else:
|
||||||
# print("other event: " + current_event)
|
# print("other event: " + current_event)
|
||||||
|
|
||||||
@ -226,7 +231,17 @@ def event_beat_map_parse(beatmap_event_object):
|
|||||||
elif event_type == 3:
|
elif event_type == 3:
|
||||||
trigger_light_right(event_value)
|
trigger_light_right(event_value)
|
||||||
elif event_type == 4:
|
elif event_type == 4:
|
||||||
trigger_light_center(event_value)
|
trigger_light_middle(event_value)
|
||||||
|
|
||||||
|
|
||||||
|
def event_idle():
|
||||||
|
# disable small, center, big lights
|
||||||
|
trigger_light_small(0)
|
||||||
|
trigger_light_middle(0)
|
||||||
|
trigger_light_big(0)
|
||||||
|
# set both laser to green (custom value 8)
|
||||||
|
trigger_light_left(8)
|
||||||
|
trigger_light_right(8)
|
||||||
|
|
||||||
|
|
||||||
def trigger_light_small(value):
|
def trigger_light_small(value):
|
||||||
@ -234,16 +249,16 @@ def trigger_light_small(value):
|
|||||||
layer_small.trigger_event(value)
|
layer_small.trigger_event(value)
|
||||||
|
|
||||||
|
|
||||||
|
def trigger_light_middle(value):
|
||||||
|
# print("light middle " + str(value))
|
||||||
|
layer_middle.trigger_event(value)
|
||||||
|
|
||||||
|
|
||||||
def trigger_light_big(value):
|
def trigger_light_big(value):
|
||||||
# print("light big " + str(value))
|
# print("light big " + str(value))
|
||||||
layer_big.trigger_event(value)
|
layer_big.trigger_event(value)
|
||||||
|
|
||||||
|
|
||||||
def trigger_light_center(value):
|
|
||||||
# print("light middle " + str(value))
|
|
||||||
layer_middle.trigger_event(value)
|
|
||||||
|
|
||||||
|
|
||||||
def trigger_light_left(value):
|
def trigger_light_left(value):
|
||||||
# print("light left " + str(value))
|
# print("light left " + str(value))
|
||||||
layer_left.trigger_event(value)
|
layer_left.trigger_event(value)
|
||||||
@ -270,7 +285,8 @@ def on_close(ws):
|
|||||||
|
|
||||||
def on_open(ws):
|
def on_open(ws):
|
||||||
# print("websocket connected")
|
# print("websocket connected")
|
||||||
thread.start_new_thread(run, ())
|
# thread.start_new_thread(run, ())
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user