mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Fixes control data packet delay (#875)
Because of an expected change in 2018 that didn't happen, we had a race condition causing a 1 packet delay on all DS values. This fixes that.
This commit is contained in:
committed by
Peter Johnson
parent
e4e1eab413
commit
07f70cf784
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <HAL/DriverStation.h>
|
||||
#include <llvm/Twine.h>
|
||||
#include <support/condition_variable.h>
|
||||
#include <support/deprecated.h>
|
||||
#include <support/mutex.h>
|
||||
|
||||
@@ -155,6 +156,10 @@ class DriverStation : public ErrorBase, public RobotStateInterface {
|
||||
std::thread m_dsThread;
|
||||
std::atomic<bool> m_isRunning{false};
|
||||
|
||||
wpi::mutex m_waitForDataMutex;
|
||||
wpi::condition_variable m_waitForDataCond;
|
||||
int m_waitForDataCounter;
|
||||
|
||||
mutable wpi::mutex m_cacheDataMutex;
|
||||
|
||||
// Robot state status variables
|
||||
|
||||
Reference in New Issue
Block a user