Alexander Tumanin
Alexander Tumanin

Reputation: 1842

Hololens falls asleep if moveless

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?

Upvotes: 6

Views: 806

Answers (2)

ickydime
ickydime

Reputation: 1071

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

Upvotes: 0

Alexander Tumanin
Alexander Tumanin

Reputation: 1842

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;

Upvotes: 2

Related Questions