Simplified format for patterns
This commit is contained in:
parent
31072baf97
commit
ea73b3702c
2 changed files with 3 additions and 3 deletions
|
@ -68,9 +68,9 @@ 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", step_ms: int = 500):
|
||||
async def pattern(self, pattern: str = "01", step_ms: int = 500):
|
||||
# Parse
|
||||
pattern_steps = [step.strip() == "1" for step in pattern.split(",") if step]
|
||||
pattern_steps = [step.strip() == "1" for step in pattern]
|
||||
# Execute
|
||||
for step in pattern_steps:
|
||||
if step:
|
||||
|
|
|
@ -101,7 +101,7 @@ async def flash(count: int = 1, contrast: Optional[int] = None):
|
|||
|
||||
|
||||
@app.post("/pattern")
|
||||
async def flash(pattern: str = "0,1", step_ms: int = 500):
|
||||
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."}
|
||||
|
||||
|
|
Loading…
Reference in a new issue