forked from dylanrush/categorical-sectional
-
Notifications
You must be signed in to change notification settings - Fork 17
/
check_lights_wiring.py
63 lines (46 loc) · 1.59 KB
/
check_lights_wiring.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Self-Test file that makes sure all
# off the wired lights are functional.
import time
import renderer
from configuration import configuration
from data_sources import weather
from lib import colors, safe_logging
airport_render_config = configuration.get_airport_configs()
rgb_colors = colors.get_colors()
renderer = renderer.get_renderer()
if __name__ == '__main__':
# Start loading the METARs in the background
# while going through the self-test
safe_logging.safe_log("Testing all colors for all airports.")
# Test LEDS on startup
colors_to_test = (
colors.MAGENTA,
colors.RED,
colors.YELLOW,
colors.GREEN,
colors.BLUE,
colors.WHITE,
colors.GRAY,
colors.DARK_YELLOW,
colors.OFF
)
for color in colors_to_test:
safe_logging.safe_log("Setting to {}".format(color))
renderer.set_all(rgb_colors[color])
time.sleep(0.5)
safe_logging.safe_log("Starting airport identification test")
while True:
for airport in airport_render_config:
led_indices = airport_render_config[airport]
for led_index in led_indices:
renderer.set_led(
led_index,
rgb_colors[colors.GREEN])
safe_logging.safe_log(
"LED {} - {} - Now lit".format(led_index, airport))
renderer.show()
input("Press Enter to continue...")
renderer.set_leds(
airport_render_config[airport],
rgb_colors[weather.OFF])
renderer.show()