From b2c7f4b7f9fefc6deab1c1a4cfb9b490131fe08d Mon Sep 17 00:00:00 2001 From: r57zone Date: Wed, 27 Oct 2021 15:38:52 +0400 Subject: [PATCH] Optimization --- OpenVR/samples/driver_arduinohmd/driver_arduinohmd.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenVR/samples/driver_arduinohmd/driver_arduinohmd.cpp b/OpenVR/samples/driver_arduinohmd/driver_arduinohmd.cpp index de9428e..5929501 100644 --- a/OpenVR/samples/driver_arduinohmd/driver_arduinohmd.cpp +++ b/OpenVR/samples/driver_arduinohmd/driver_arduinohmd.cpp @@ -175,6 +175,8 @@ void ArduinoIMURead() HMDInitCentring = true; } } + + if (bytesRead == 0) Sleep(1); } } @@ -505,7 +507,7 @@ class CDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IVRDispl } // Centering - if ((GetAsyncKeyState(m_centeringKey) & 0x8000) != 0 || ((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0 && (GetAsyncKeyState(VK_MENU) & 0x8000) != 0 && (GetAsyncKeyState('R') & 0x8000) != 0)) + if ( (GetAsyncKeyState(m_centeringKey) & 0x8000) != 0 || ( (GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0 && (GetAsyncKeyState(VK_MENU) & 0x8000) != 0 && (GetAsyncKeyState('R') & 0x8000) != 0) ) SetCentering(); // Set head tracking rotation