Some fixes

This commit is contained in:
Maximilian Giller 2024-03-03 16:15:04 +01:00
parent 49c53b0f93
commit 6e42689a91
2 changed files with 9 additions and 3 deletions

View file

@ -26,7 +26,7 @@ class MatrixDisplay:
Args:
contrast (int): [0, 255]
"""
super().set_contrast(contrast)
self.contrast = contrast
self.device.contrast(self.contrast)
def show_text(self, text):

View file

@ -5,7 +5,13 @@ from typing import Optional
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from actions import climate_sensor, display_time, log_temperature, matrix_display
from actions import (
climate_sensor,
display_time,
log_temperature,
matrix_display,
display_pattern,
)
from config import climate_log_file
from handler.action_queue import ActionQueue
from handler.history import get_recent_entries
@ -93,7 +99,7 @@ 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(
matrix_display.pattern, pattern=pattern, off_ms=off_ms, on_ms=on_ms
display_pattern, pattern=pattern, off_ms=off_ms, on_ms=on_ms
)
return {"message": "Activated pattern."}