mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Add ability to end startCompetition() main loop (#2032)
This is useful for both cleanly exiting from simulation and for unit testing at a framework level. This change required removing move constructor/assignment from IterativeRobot.
This commit is contained in:
@@ -30,7 +30,13 @@ void IterativeRobot::StartCompetition() {
|
||||
while (true) {
|
||||
// Wait for driver station data so the loop doesn't hog the CPU
|
||||
DriverStation::GetInstance().WaitForData();
|
||||
if (m_exit) break;
|
||||
|
||||
LoopFunc();
|
||||
}
|
||||
}
|
||||
|
||||
void IterativeRobot::EndCompetition() {
|
||||
m_exit = true;
|
||||
DriverStation::GetInstance().WakeupWaitForData();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user