WiimoteReal: Call Update() less often

This moves back the WiimoteScanner:Update() call to where it originally
was, since according to a comment it is intended to be called only when
"when not looking for more Wiimotes", and calling it too often causes
the Bluetooth module to be loaded/unloaded a lot of times.
This commit is contained in:
Léo Lam 2016-07-12 16:50:41 +02:00
parent 6b48b62872
commit 47859ad40c

View file

@ -472,7 +472,6 @@ void WiimoteScanner::ThreadFunc()
{
m_scan_mode_changed_event.WaitFor(std::chrono::milliseconds(500));
Update(); // Does stuff needed to detect disconnects on Windows
CheckForDisconnectedWiimotes();
if (m_scan_mode.load() == WiimoteScanMode::DO_NOT_SCAN)
@ -490,6 +489,10 @@ void WiimoteScanner::ThreadFunc()
TryToConnectBalanceBoard(found_board);
}
}
else
{
Update(); // Does stuff needed to detect disconnects on Windows
}
if (m_scan_mode.load() == WiimoteScanMode::SCAN_ONCE)
m_scan_mode.store(WiimoteScanMode::DO_NOT_SCAN);