mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Runs DS enabled loop in process (#785)
Solves mutex issues, and other issues with the existing teststand software. And simplifies the unit test structure.
This commit is contained in:
committed by
Peter Johnson
parent
26a36779a6
commit
fa0b4428e9
@@ -17,6 +17,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import edu.wpi.first.wpilibj.DriverStation;
|
||||
import edu.wpi.first.wpilibj.MockDS;
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.hal.HAL;
|
||||
@@ -34,6 +35,9 @@ public abstract class AbstractComsSetup {
|
||||
*/
|
||||
private static boolean initialized = false;
|
||||
|
||||
// We have no way to stop the MockDS, so its thread is daemon.
|
||||
private static MockDS ds;
|
||||
|
||||
/**
|
||||
* This sets up the network communications library to enable the driver
|
||||
* station. After starting network coms, it will loop until the driver station
|
||||
@@ -45,6 +49,10 @@ public abstract class AbstractComsSetup {
|
||||
// Set some implementations so that the static methods work properly
|
||||
RobotBase.initializeHardwareConfiguration();
|
||||
HAL.observeUserProgramStarting();
|
||||
DriverStation.getInstance().getAlliance();
|
||||
|
||||
ds = new MockDS();
|
||||
ds.start();
|
||||
|
||||
LiveWindow.setEnabled(false);
|
||||
TestBench.out().println("Started coms");
|
||||
@@ -57,8 +65,7 @@ public abstract class AbstractComsSetup {
|
||||
} catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
// Prints the message on one line overwriting itself each time
|
||||
TestBench.out().print("\rWaiting for enable: " + enableCounter++);
|
||||
TestBench.out().println("Waiting for enable: " + enableCounter++);
|
||||
}
|
||||
TestBench.out().println();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user