mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add timing window to simulation GUI
This shows the FPGA time and notifier timing, and has buttons to start/pause/step the simulation. The GUI also pauses DS new data notifications when paused. This could be done globally instead by blocking NotifyNewData at the HAL level?
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <mockdata/DriverStationData.h>
|
||||
#include <mockdata/MockHooks.h>
|
||||
#include <wpi/Format.h>
|
||||
#include <wpi/SmallString.h>
|
||||
#include <wpi/StringRef.h>
|
||||
@@ -328,7 +329,7 @@ static void DriverStationExecute() {
|
||||
|
||||
// Send new data every 20 ms (may be slower depending on GUI refresh rate)
|
||||
static double lastNewDataTime = 0.0;
|
||||
if ((curTime - lastNewDataTime) > 0.02) {
|
||||
if ((curTime - lastNewDataTime) > 0.02 && !HALSIM_IsTimingPaused()) {
|
||||
lastNewDataTime = curTime;
|
||||
HALSIM_NotifyDriverStationNewData();
|
||||
}
|
||||
@@ -367,7 +368,7 @@ static void DisplayFMS() {
|
||||
ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
HALSIM_SetDriverStationMatchTime(matchTime);
|
||||
startMatchTime = curTime - matchTime;
|
||||
} else if (!HALSIM_GetDriverStationEnabled()) {
|
||||
} else if (!HALSIM_GetDriverStationEnabled() || HALSIM_IsTimingPaused()) {
|
||||
startMatchTime = curTime - matchTime;
|
||||
} else if (matchTimeEnabled) {
|
||||
HALSIM_SetDriverStationMatchTime(curTime - startMatchTime);
|
||||
|
||||
Reference in New Issue
Block a user