From df102d8e4e72d1a326082acef58f8fb54e9e809f Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Sat, 10 Aug 2024 01:24:21 +0200 Subject: [PATCH] Revert "Added temporary contrast to pattern endpoint" This reverts commit 9715339c43aa5c6845649e6df7ad6b8b251b83bb. --- src/actions.py | 11 ++--------- src/main.py | 8 ++------ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/actions.py b/src/actions.py index 0cd53fd..ab082ce 100644 --- a/src/actions.py +++ b/src/actions.py @@ -44,12 +44,5 @@ async def display_time(): async def display_pattern(*args, **kwargs): - old_contrast = matrix_display.contrast - if "contrast" in kwargs: - matrix_display.set_contrast(int(kwargs["contrast"])) - try: - while True: - await matrix_display.pattern(*args, **kwargs) - except: - if "contrast" in kwargs: - matrix_display.set_contrast(old_contrast) + while True: + await matrix_display.pattern(*args, **kwargs) diff --git a/src/main.py b/src/main.py index e7f6f86..57b2bbf 100644 --- a/src/main.py +++ b/src/main.py @@ -126,12 +126,8 @@ async def flash(count: int = 1, contrast: Optional[int] = None): @app.post("/pattern") -async def flash( - pattern: str = "01", step_ms: int = 500, contrast: Optional[int] = None -): - await queue.set_idle_action( - display_pattern, pattern=pattern, step_ms=step_ms, contrast=contrast - ) +async def flash(pattern: str = "01", step_ms: int = 500): + await queue.set_idle_action(display_pattern, pattern=pattern, step_ms=step_ms) return {"message": "Activated pattern."}