Fixed warning active flag
This commit is contained in:
parent
9a9d40db82
commit
c4e302aef2
1 changed files with 10 additions and 7 deletions
|
@ -21,7 +21,7 @@ show_scale_countdown: int = 0 # Number of updates for the scale, until return t
|
|||
|
||||
average_person_weight: float = 75
|
||||
|
||||
is_warning_active: bool = False
|
||||
is_warning_active: int = 0
|
||||
leg_capacity_limit_patterns = [
|
||||
{"limit": 80, "pattern": 110, "duration": 1000},
|
||||
{"limit": 90, "pattern": 110, "duration": 250},
|
||||
|
@ -61,14 +61,17 @@ def is_capacity_reached() -> bool:
|
|||
global is_warning_active
|
||||
if highest_limit is None:
|
||||
if is_warning_active:
|
||||
is_warning_active = False
|
||||
is_warning_active = 0
|
||||
show_time()
|
||||
return
|
||||
return False
|
||||
|
||||
is_warning_active = True
|
||||
r.post(
|
||||
f"{matrix_clock_api}/pattern?pattern={highest_limit['pattern']}&step_ms={highest_limit['duration']}"
|
||||
)
|
||||
if is_warning_active != highest_limit["limit"]:
|
||||
is_warning_active = highest_limit["limit"]
|
||||
r.post(
|
||||
f"{matrix_clock_api}/pattern?pattern={highest_limit['pattern']}&step_ms={highest_limit['duration']}"
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def check_for_change():
|
||||
|
|
Loading…
Reference in a new issue