mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Add simulation pause/resume/step support
Calling HALSIM_PauseTiming pauses the FPGA clock and notifiers. Calling HALSIM_ResumeTiming resumes the FPGA clock and notifiers. Calling HALSIM_StepTiming steps the FPGA clock and runs applicable notifiers. This will effectively pause TimedRobot and any other notifier-based events, but of course will not pause user threads that do not use the notifier (e.g. image processing).
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -24,4 +24,20 @@ public final class SimHooks {
|
||||
public static void restartTiming() {
|
||||
SimulatorJNI.restartTiming();
|
||||
}
|
||||
|
||||
public static void pauseTiming() {
|
||||
SimulatorJNI.pauseTiming();
|
||||
}
|
||||
|
||||
public static void resumeTiming() {
|
||||
SimulatorJNI.resumeTiming();
|
||||
}
|
||||
|
||||
public static boolean isTimingPaused() {
|
||||
return SimulatorJNI.isTimingPaused();
|
||||
}
|
||||
|
||||
public static void stepTiming(long delta) {
|
||||
SimulatorJNI.stepTiming(delta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -13,5 +13,9 @@ public class SimulatorJNI extends JNIWrapper {
|
||||
public static native void waitForProgramStart();
|
||||
public static native void setProgramStarted();
|
||||
public static native void restartTiming();
|
||||
public static native void pauseTiming();
|
||||
public static native void resumeTiming();
|
||||
public static native boolean isTimingPaused();
|
||||
public static native void stepTiming(long delta);
|
||||
public static native void resetHandles();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user