Forward controller battery info via XR_EXT_interaction_profile_battery_state_display

This commit is contained in:
Sapphire
2026-11-11 16:23:54 -05:00
parent aba0210923
commit 2233817b59
10 changed files with 159 additions and 14 deletions
+14 -4
View File
@@ -164,8 +164,10 @@ void wivrn_hmd::update_tracking(const from_headset::tracking & tracking, const c
void wivrn_hmd::update_battery(const from_headset::battery & new_battery)
{
// We will only request a new sample if the current one is consumed
*battery.lock() = new_battery;
if (new_battery.device == device_id::HEAD)
{
*battery.lock() = new_battery;
}
}
xrt_result_t wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
@@ -214,9 +216,17 @@ xrt_result_t wivrn_hmd::get_battery_status(bool * out_present,
float * out_charge)
{
auto bat = battery.lock();
*out_present = bat->present;
*out_charging = bat->charging;
*out_charge = bat->charge;
if (bat->charge)
{
*out_present = true;
*out_charge = *bat->charge;
}
else
{
*out_present = false;
}
return XRT_SUCCESS;
}