Fix buzzer

This commit is contained in:
2026-08-23 20:04:20 +02:00
parent 8a71d4eaa7
commit 5c60de3f03
3 changed files with 39 additions and 30 deletions
+4 -4
View File
@@ -113,7 +113,7 @@ def on_microwave_change(state: MicrowaveState, field: MicrowaveStateFields):
if state.cooking_state in (CookingStates.DONE, CookingStates.STIRRING_REQUIRED, CookingStates.ALERT):
# Trigger buzzer for user attention
beats = 5 if state.cooking_state == CookingStates.ALERT else (1 if state.cooking_state == CookingStates.STIRRING_REQUIRED else 3)
buzzer.buzzer_siren(beatsNb=beats)
buzzer.buzzer_siren(beats_nb=beats)
elif state.cooking_state == CookingStates.DONE and state.state == MicrowaveState.COOKING:
state.set_state(MicrowaveState.DONE)
print(f"[{state.microwave_id}] Cooking finished. Waiting for user to remove dish.")
@@ -275,17 +275,17 @@ async def rfid_listener_task():
TECHNICIAN_MODE = True
print(f"[RFID] Card {tag_id} VALIDATED! -> TECHNICIAN_MODE = TRUE")
# Optional: Sound positive feedback beep
buzzer.buzzer_siren(beatsNb=1)
buzzer.buzzer_siren(beats_nb=2)
else:
print(f"[RFID] Card {tag_id} REJECTED / Invalid.")
# Optional: Sound error feedback beep
buzzer.buzzer_siren(beatsNb=2)
buzzer.buzzer_siren(beats_nb=4)
except Exception as e:
print(f"[RFID Task] Error reading RFID tag: {e}")
# Sleep 100ms between checks to keep CPU usage near zero
await asyncio.sleep(0.1)
await asyncio.sleep(0.2)
async def display_broadcast_worker_task():
"""