Skip to content

Commit 6cc0e07

Browse files
committed
fix battery check
1 parent b0edf06 commit 6cc0e07

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/hhd/plugins/power/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
logger = logging.getLogger(__name__)
1616

1717
TEMP_CHECK_INTERVAL = 10
18-
# Chill for the first 10 minutes to avoid bricking installs if a device
18+
# Chill for a bit to bricking installs if a device
1919
# has e.g., a battery bug that trips the condition incorrectly
20-
TEMP_CHECK_INITIALIZE = 300
20+
TEMP_CHECK_INITIALIZE = 120
2121
BATTERY_LOW_THRESHOLD = 5
2222
LAST_ATTEMPT_WAIT = 5
2323
LAST_ATTEMPT_BAIL = 30
@@ -36,13 +36,14 @@ def thermal_check(therm: dict[str, int], bat: str | None, last_attempt: float =
3636

3737
if bat and not found:
3838
with open(bat + "/status") as f:
39-
dc = "discharging" in bat.lower()
39+
dc = "discharging" in f.read().lower()
4040

4141
with open(bat + "/capacity") as f:
4242
curr = int(f.read())
43-
if dc and curr <= BATTERY_LOW_THRESHOLD:
44-
logger.warning(f"Battery level reached {curr}%, hibernating.")
45-
found = True
43+
44+
if dc and curr <= BATTERY_LOW_THRESHOLD:
45+
logger.warning(f"Battery level reached {curr}%, hibernating.")
46+
found = True
4647

4748
if not found:
4849
return False

0 commit comments

Comments
 (0)