Hololens falls asleep if moveless
Asked Answered
O

2

6

In my app I need to measure a camera data if the glasses are moving or not. I get the data with:

quaternions["x"] = Camera.main.transform.rotation.x;
quaternions["y"] = Camera.main.transform.rotation.y;
quaternions["z"] = Camera.main.transform.rotation.z;
quaternions["w"] = Camera.main.transform.rotation.w;
quaternions["tx"] = Camera.main.transform.position.x;
quaternions["ty"] = Camera.main.transform.position.y;
quaternions["tz"] = Camera.main.transform.position.z;

If I move the glasses, the app works fine. But if I leave the glasses on the table, then after 4 minutes the glasses disable display and the code returns last stored data. Even if the charge cable is plugged in. If I press enable button on the glasses, the display is on again and the data is also right.

Is there some possibility to prevent the glasses falling asleep?

Oakie answered 23/4, 2019 at 13:6 Comment(2)
I never used it on my own but did you try Screen.sleepTimeout?Pretor
Yes, it works! Thanks!Oakie
O
2

According to comment of @Kay, the solution is adding the line:

Screen.sleepTimeout = SleepTimeout.NeverSleep;

NOTE: this solution works if you use MixedRealityToolkit-Unity because it needs:

using UnityEngine;
Oakie answered 24/4, 2019 at 12:44 Comment(0)
R
0

You can adjust the sleep settings using the Device Portal under System->Preference.

When on battery, go to sleep after

When plugged in, go to sleep after

enter image description here

Rozalie answered 24/4, 2019 at 14:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.