fix preflight config path check

This commit is contained in:
ykcheungab
2026-09-20 11:20:47 +08:00
parent 45419a59c4
commit e2b906a640
3 changed files with 104 additions and 33 deletions
+4 -2
View File
@@ -1271,9 +1271,11 @@ class Sensor:
that root had coefficients.
"""
attempts = self._force_cal_attempts or []
found = [entry for entry in attempts if entry.get("found_root") is not None]
# ``found_root`` is keyed even when nothing was found (valued None), so
# test its value, not the key.
found = [entry for entry in attempts if entry.get("found_root")]
with_cal = [entry for entry in found if entry.get("force_calibration_json")]
chosen = (with_cal or found or attempts or [None])[0]
chosen = (with_cal or found or [None])[0]
searched: list = []
for entry in attempts:
for root in entry.get("searched") or ():