mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Adds RobotController class (#828)
Unifies random functionality from other classes Deprecates all old functions.
This commit is contained in:
committed by
Peter Johnson
parent
88a6b4ac38
commit
8b7aa61091
@@ -99,7 +99,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
|
||||
|
||||
@Override
|
||||
public void interruptFired(int interruptAssertedMask, InterruptCounter param) {
|
||||
m_interruptFireTime.set(Utility.getFPGATime());
|
||||
m_interruptFireTime.set(RobotController.getFPGATime());
|
||||
m_counter.increment();
|
||||
try {
|
||||
// This won't cause the test to fail
|
||||
@@ -132,7 +132,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
|
||||
Timer.delay(0.01);
|
||||
// Note: Utility.getFPGATime() is used because double values can turn over
|
||||
// after the robot has been running for a long time
|
||||
final long interruptTriggerTime = Utility.getFPGATime();
|
||||
final long interruptTriggerTime = RobotController.getFPGATime();
|
||||
setInterruptHigh();
|
||||
|
||||
// Delay until the interrupt is complete
|
||||
@@ -205,11 +205,11 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
|
||||
|
||||
// Note: the long time value is used because doubles can flip if the robot
|
||||
// is left running for long enough
|
||||
final long startTimeStamp = Utility.getFPGATime();
|
||||
final long startTimeStamp = RobotController.getFPGATime();
|
||||
new Thread(runnable).start();
|
||||
// Delay for twice as long as the timeout so the test should fail first
|
||||
getInterruptable().waitForInterrupt(synchronousTimeout * 2);
|
||||
final long stopTimeStamp = Utility.getFPGATime();
|
||||
final long stopTimeStamp = RobotController.getFPGATime();
|
||||
|
||||
// Then
|
||||
// The test will not have timed out and:
|
||||
|
||||
@@ -28,13 +28,13 @@ public class DriverStationTest extends AbstractComsSetup {
|
||||
|
||||
@Test
|
||||
public void waitForDataTest() {
|
||||
long startTime = Utility.getFPGATime();
|
||||
long startTime = RobotController.getFPGATime();
|
||||
|
||||
// Wait for data 50 times
|
||||
for (int i = 0; i < 50; i++) {
|
||||
DriverStation.getInstance().waitForData();
|
||||
}
|
||||
long endTime = Utility.getFPGATime();
|
||||
long endTime = RobotController.getFPGATime();
|
||||
long difference = endTime - startTime;
|
||||
|
||||
assertEquals("DriverStation waitForData did not wait long enough", TIMER_RUNTIME, difference,
|
||||
|
||||
@@ -29,11 +29,11 @@ public class TimerTest extends AbstractComsSetup {
|
||||
@Test
|
||||
public void delayTest() {
|
||||
// Given
|
||||
long startTime = Utility.getFPGATime();
|
||||
long startTime = RobotController.getFPGATime();
|
||||
|
||||
// When
|
||||
Timer.delay(TIMER_RUNTIME / 1000000);
|
||||
long endTime = Utility.getFPGATime();
|
||||
long endTime = RobotController.getFPGATime();
|
||||
long difference = endTime - startTime;
|
||||
|
||||
// Then
|
||||
|
||||
Reference in New Issue
Block a user