mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-29 04:02:36 +01:00
Reject unreadable Frame smoke sensor values
This commit is contained in:
1 parent
b123f5ff34
commit
be07dbeeeb
4 files changed
+30
-5
No files matched your search
@@ -2,6 +2,7 @@
|
||||
"""Check a locked Frame smoke result against the exact release commit."""
|
||||
|
||||
import json
|
||||
import math
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -40,7 +41,8 @@ def verify(result, commit):
|
||||
state = result.get('preflight') or {}
|
||||
if (not isinstance(state, dict) or state.get('activity') != 3 or
|
||||
not isinstance(state.get('proximity'), list) or not state['proximity'] or
|
||||
any(type(value) not in (int, float) or value < 0 or value > 10
|
||||
any(type(value) not in (int, float) or not math.isfinite(value) or
|
||||
value < 0 or value > 10
|
||||
for value in state['proximity']) or
|
||||
not isinstance(state.get('battery'), list) or not state['battery'] or
|
||||
any(type(value) is not int or value < 20 or value > 100
|
||||
|
||||
Reference in new issue
Block a user