hid add "unknown" runtime state (#1693)

This commit is contained in:
sctanf
2025-12-25 09:41:46 -06:00
committed by GitHub
parent 23df46ca33
commit 2aa8d3a056

View File

@@ -254,9 +254,10 @@ class HIDCommon {
}
// Assign data
if (runtime != null) {
if (runtime != null && runtime >= 0) {
tracker.batteryRemainingRuntime = runtime
}
// -1: Not known (e.g. not yet calculated after wake up, reusing known value is okay), 0: N/A (e.g. charging)
if (batt != null) {
tracker.batteryLevel = if (batt == 128) 1f else (batt and 127).toFloat()
}