diff --git a/src/handler/matrix_display.py b/src/handler/matrix_display.py index db79cf6..1355661 100644 --- a/src/handler/matrix_display.py +++ b/src/handler/matrix_display.py @@ -68,7 +68,7 @@ class MatrixDisplay: with canvas(self.device) as draw: draw.rectangle((0, 0, 31, 7), outline="white", fill="white") - async def pattern(self, pattern: str = "0,1", off_ms: int = 500, on_ms: int = 500): + async def pattern(self, pattern: str = "0,1", step_ms: int = 500): # Parse pattern_steps = [step.strip() == "1" for step in pattern.split(",") if step] # Execute @@ -77,7 +77,7 @@ class MatrixDisplay: self.turn_full() else: self.turn_off() - await asyncio.sleep((on_ms if step else off_ms) / 1000) + await asyncio.sleep(step_ms / 1000) def show_current_time(self): self.device.contrast(self.contrast) diff --git a/src/main.py b/src/main.py index 4669cb6..623e458 100644 --- a/src/main.py +++ b/src/main.py @@ -97,10 +97,8 @@ async def flash(count: int = 1, contrast: Optional[int] = None): @app.post("/pattern") -async def flash(pattern: str="0,1", off_ms: int = 500, on_ms: int = 500): - await queue.set_idle_action( - display_pattern, pattern=pattern, off_ms=off_ms, on_ms=on_ms - ) +async def flash(pattern: str = "0,1", step_ms: int = 500): + await queue.set_idle_action(display_pattern, pattern=pattern, step_ms=step_ms) return {"message": "Activated pattern."}