Fixed warning active flag

This commit is contained in:
Maximilian Giller 2024-05-06 22:23:32 +02:00
parent 9a9d40db82
commit c4e302aef2

View file

@ -21,7 +21,7 @@ show_scale_countdown: int = 0 # Number of updates for the scale, until return t
average_person_weight: float = 75 average_person_weight: float = 75
is_warning_active: bool = False is_warning_active: int = 0
leg_capacity_limit_patterns = [ leg_capacity_limit_patterns = [
{"limit": 80, "pattern": 110, "duration": 1000}, {"limit": 80, "pattern": 110, "duration": 1000},
{"limit": 90, "pattern": 110, "duration": 250}, {"limit": 90, "pattern": 110, "duration": 250},
@ -61,14 +61,17 @@ def is_capacity_reached() -> bool:
global is_warning_active global is_warning_active
if highest_limit is None: if highest_limit is None:
if is_warning_active: if is_warning_active:
is_warning_active = False is_warning_active = 0
show_time() show_time()
return return False
is_warning_active = True if is_warning_active != highest_limit["limit"]:
r.post( is_warning_active = highest_limit["limit"]
f"{matrix_clock_api}/pattern?pattern={highest_limit['pattern']}&step_ms={highest_limit['duration']}" r.post(
) f"{matrix_clock_api}/pattern?pattern={highest_limit['pattern']}&step_ms={highest_limit['duration']}"
)
return True
def check_for_change(): def check_for_change():