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:
Peter Johnson
2019-11-10 20:55:42 -08:00
parent c5a0497124
commit 1853f7b6b7
4 changed files with 82 additions and 2 deletions

View File

@@ -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);