Skip to content

Commit

Permalink
Fix hmd cycling notification
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaamo committed Jul 30, 2024
1 parent b36a2cd commit 17f4d0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions OpenVR Display Devices/BatteryChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,15 @@ class BatteryChecker {
lastCheck = time(0);
}

if (application_configuration.alertHmdCycling) {
// Every X minutes, check for the state change
std::cout << "prev= " << gaugesChargingPrev[index] << " new: " << gaugesCharging[index] << std::endl;

if (isHmd && (gaugesChargingPrev[index] != gaugesCharging[index]) && (difftime(time(0), gaugesChargingChangeTime[index]) >= CHECK_CHG_EVERY)) {
dispatchChargeWarn(index);
// Reset time
gaugesChargingChangeTime[index] = time(0);
if (isHmd && (gaugesChargingPrev[index] != gaugesCharging[index]) && (difftime(time(0), gaugesChargingChangeTime[index]) >= CHECK_CHG_EVERY)) {
dispatchChargeWarn(index);
// Reset time
gaugesChargingChangeTime[index] = time(0);
// Then reset previous gauge state
gaugesChargingPrev[index] = gaugesCharging[index];
}
}

// Do nothing as we still haven't waited enough
Expand Down
2 changes: 1 addition & 1 deletion OpenVR Display Devices/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
#define TRACKING_KO IM_COL32(209, 31, 31, 255)

#define APP_VERSION_MAJOR 0
#define APP_VERSION_MINOR 1
#define APP_VERSION_MINOR 2
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ To create an installer:
- VR Runtime path (xxx.exe -runtimepath) doesn't return anything ???
- WIP to be tested: Implement a "previous value" for battery statuses, to detect if the device is charging BUT current% is inferior to last%, to send a more specific notification about slow charging
- The code really needs cleanups, the WebSocket part is absolutely awful, it works, but PRs welcomes (I won't bite you)
- Properly detect when a device is disconnected because they are still returned by the API

## License & contact

Expand Down

0 comments on commit 17f4d0b

Please sign in to comment.