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
|
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,15 +61,18 @@ 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"]:
|
||||||
|
is_warning_active = highest_limit["limit"]
|
||||||
r.post(
|
r.post(
|
||||||
f"{matrix_clock_api}/pattern?pattern={highest_limit['pattern']}&step_ms={highest_limit['duration']}"
|
f"{matrix_clock_api}/pattern?pattern={highest_limit['pattern']}&step_ms={highest_limit['duration']}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def check_for_change():
|
def check_for_change():
|
||||||
# Check for capicity limits
|
# Check for capicity limits
|
||||||
|
|
Loading…
Reference in a new issue