Skip to content

Commit 2aa8d3a

Browse files
authored
hid add "unknown" runtime state (#1693)
1 parent 23df46c commit 2aa8d3a

File tree

1 file changed

+2
-1
lines changed
  • server/core/src/main/java/dev/slimevr/tracking/trackers/hid

1 file changed

+2
-1
lines changed

server/core/src/main/java/dev/slimevr/tracking/trackers/hid/HIDCommon.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,10 @@ class HIDCommon {
254254
}
255255

256256
// Assign data
257-
if (runtime != null) {
257+
if (runtime != null && runtime >= 0) {
258258
tracker.batteryRemainingRuntime = runtime
259259
}
260+
// -1: Not known (e.g. not yet calculated after wake up, reusing known value is okay), 0: N/A (e.g. charging)
260261
if (batt != null) {
261262
tracker.batteryLevel = if (batt == 128) 1f else (batt and 127).toFloat()
262263
}

0 commit comments

Comments
 (0)