-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send device battery levels over OSC #108
Conversation
i _understand_ now! basically, i did it the "wrong" way first by modifying openxr.rs and openvr.rs to pass battery levels to osc, when really i could have just made osc get the pre-formatted device details from AppState. live and learn, i'm new to rust anyway.
this is just to make sure the unwrap() doesn't crash; -1 (or any negative value) is used as the "disconnected" value.
this means parameter can be immutable if left unset at initialisation, and we can use format!() macro in the match statements. silly workarounds no more!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no reason to send battery states out 10 times/second
let's add a separate timer for sending the battery states (similar to self.last_sent
), once per 10s maybe?
true. |
you know, i thought the osc debug menu was updating a little fast for 10 times per second (updated values being fully lit all the time). i added a second |
ok, mind fixing that as well? |
|
i've fixed the timers, i won't change them to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's fine, i think it's good as is. gonna run the actions and merge when i'm back
I've edited the osc.rs file to send HMD, controller, and tracker battery levels and charging state over OSC to VRChat.
It takes in AppState as a new parameter, but could probably pass just the raw list of devices unless we want to add more parameters like FPS or IPD, etc.
For now there is a workaround for HMD battery specifically as XSOverlay has no parameter for it, and OVR Toolkit uses an int 0-100. I implement both 0-100 as hmdBattery and 0-1 as headsetBattery.
I can only test the HMD battery on Monado at the moment (WiVRn with PICO 4), so controller batteries, tracker batteries, and SteamVR devices are untested.
Parameters are based on the XSOverlay format, excluding average battery levels but adding charging state. Charging state in my testing is delayed, I expect it only updates when the battery level is updated.