From d2076ff5deb2046d1f8bcd2d324e5cd917c3871d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Jul 2015 07:11:24 +0200 Subject: simconnect: increase timer precision just to be safe --- CMakeLists.txt | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c45163dc..448375f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,7 +304,7 @@ endif() if(SDK_SIMCONNECT) opentrack_library(opentrack-proto-simconnect ftnoir_protocol_sc) - target_link_libraries(opentrack-proto-simconnect ${SDK_SIMCONNECT}/lib/SimConnect.lib) + target_link_libraries(opentrack-proto-simconnect ${SDK_SIMCONNECT}/lib/SimConnect.lib winmm) include_directories(opentrack-proto-simconnect SYSTEM PUBLIC ${SDK_SIMCONNECT}/inc) endif() diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index eb8d1a79..f767d232 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -44,6 +44,8 @@ void FTNoIR_Protocol::run() { Affinity thr; + (void) timeBeginPeriod(1); + while (!should_stop) { if (SUCCEEDED(simconnect_open(&hSimConnect, "opentrack", NULL, 0, 0, 0))) @@ -54,7 +56,7 @@ void FTNoIR_Protocol::run() { if (FAILED(simconnect_calldispatch(hSimConnect, processNextSimconnectEvent, reinterpret_cast(this)))) break; - Sleep(1); + Sleep(3); } (void) simconnect_close(hSimConnect); @@ -62,6 +64,8 @@ void FTNoIR_Protocol::run() Sleep(100); } + + (void) timeEndPeriod(1); } void FTNoIR_Protocol::pose( const double *headpose ) { -- cgit v1.2.3