Commit ab8bad15 authored by Niek Blankers's avatar Niek Blankers
Browse files

Fighting robots

parent f143dfa3
Pipeline #2986 passed with stages
in 48 seconds
......@@ -24,16 +24,8 @@ ANIM_TYPES = ["none", "led", "fade", "gay"]
def render_error(err1, err2):
with display.open() as disp:
disp.clear()
disp.print(
err1,
posx=80 - round(len(err1) / 2 * 14),
posy=18,
)
disp.print(
err2,
posx=80 - round(len(err2) / 2 * 14),
posy=42,
)
disp.print(err1, posx=80 - round(len(err1) / 2 * 14), posy=18)
disp.print(err2, posx=80 - round(len(err2) / 2 * 14), posy=42)
disp.update()
disp.close()
......@@ -61,9 +53,7 @@ def toggle_rockets(state):
leds.set_rocket(2, brightness)
def render_nickname(
title, sub, fg, bg, fg_sub, bg_sub, main_bg
):
def render_nickname(title, sub, fg, bg, fg_sub, bg_sub, main_bg):
anim = 0
posy = 30
if sub != "":
......@@ -86,9 +76,7 @@ def render_nickname(
r_bg_sub_color = bg_sub[dark]
r_bg = main_bg[dark]
# Button handling
pressed = buttons.read(
buttons.BOTTOM_LEFT | buttons.BOTTOM_RIGHT
)
pressed = buttons.read(buttons.BOTTOM_LEFT | buttons.BOTTOM_RIGHT)
if utime.time() - last_btn_poll >= 1:
last_btn_poll = utime.time()
if pressed & buttons.BOTTOM_RIGHT != 0:
......@@ -177,28 +165,14 @@ if FILENAME_ADV in os.listdir("."):
background = get_key(c, "background", [0, 0, 0])
fg_color = get_key(c, "fg_color", [255, 255, 255])
bg_color = get_key(c, "bg_color", background)
fg_sub_color = get_key(
c, "fg_sub_color", [255, 255, 255]
)
bg_sub_color = get_key(
c, "bg_sub_color", background
)
fg_sub_color = get_key(c, "fg_sub_color", [255, 255, 255])
bg_sub_color = get_key(c, "bg_sub_color", background)
# nighttime values
background_night = get_key(
c, "background_night", [0, 0, 0]
)
fg_color_night = get_key(
c, "fg_color_night", [255, 255, 255]
)
bg_color_night = get_key(
c, "bg_color_night", background_night
)
fg_sub_color_night = get_key(
c, "fg_sub_color_night", [255, 255, 255]
)
bg_sub_color_night = get_key(
c, "bg_sub_color_night", background_night
)
background_night = get_key(c, "background_night", [0, 0, 0])
fg_color_night = get_key(c, "fg_color_night", [255, 255, 255])
bg_color_night = get_key(c, "bg_color_night", background_night)
fg_sub_color_night = get_key(c, "fg_sub_color_night", [255, 255, 255])
bg_sub_color_night = get_key(c, "bg_sub_color_night", background_night)
# render nickname
render_nickname(
nick,
......@@ -232,4 +206,3 @@ else:
([0, 0, 0], [0, 0, 0]),
([0, 0, 0], [0, 0, 0]),
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment