mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
Moves the DS new data wait calls down to the HAL. (#156)
This commit is contained in:
committed by
Peter Johnson
parent
0cb288ffba
commit
4a98e68815
@@ -54,9 +54,6 @@ DriverStation::DriverStation() {
|
||||
m_joystickDescriptorCache[i].type = -1;
|
||||
m_joystickDescriptorCache[i].name[0] = '\0';
|
||||
}
|
||||
// Register that semaphore with the network communications task.
|
||||
// It will signal when new packet data is available.
|
||||
HAL_SetNewDataSem(&m_packetDataAvailableCond);
|
||||
|
||||
m_task = Task("DriverStation", &DriverStation::Run, this);
|
||||
}
|
||||
@@ -64,19 +61,13 @@ DriverStation::DriverStation() {
|
||||
DriverStation::~DriverStation() {
|
||||
m_isRunning = false;
|
||||
m_task.join();
|
||||
|
||||
// Unregister our semaphore.
|
||||
HAL_SetNewDataSem(nullptr);
|
||||
}
|
||||
|
||||
void DriverStation::Run() {
|
||||
m_isRunning = true;
|
||||
int period = 0;
|
||||
while (m_isRunning) {
|
||||
{
|
||||
std::unique_lock<priority_mutex> lock(m_packetDataAvailableMutex);
|
||||
m_packetDataAvailableCond.wait(lock);
|
||||
}
|
||||
HAL_WaitForDSData();
|
||||
GetData();
|
||||
{
|
||||
std::lock_guard<priority_mutex> lock(m_waitForDataMutex);
|
||||
|
||||
Reference in New Issue
Block a user