This commit is contained in:
Maximilian Giller 2023-10-11 01:52:55 +02:00
parent e4f88110fd
commit 08cb3b9588

View file

@ -62,6 +62,7 @@ async def flash(count: int = 1):
@app.post("/message")
async def display_message(body: dict):
global should_run_time_loop
was_clock_runnign = should_run_time_loop
should_run_time_loop = False
message_text = body.get("message")
try:
@ -71,6 +72,10 @@ async def display_message(body: dict):
status_code=500,
detail=f"Failed to display message on the matrix display: {e}",
)
finally:
if was_clock_runnign:
should_run_time_loop = True
asyncio.create_task(display_time())
return {"message": "Message displayed"}