mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[sim] Add GUI support for the REV PH (#6704)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <glass/Context.h>
|
||||
#include <glass/Storage.h>
|
||||
#include <glass/hardware/Pneumatic.h>
|
||||
#include <glass/other/Plot.h>
|
||||
|
||||
#include <cstdio>
|
||||
@@ -26,6 +27,7 @@
|
||||
#include "HALSimGuiExt.h"
|
||||
#include "NetworkTablesSimGui.h"
|
||||
#include "PCMSimGui.h"
|
||||
#include "PHSimGui.h"
|
||||
#include "PWMSimGui.h"
|
||||
#include "PowerDistributionSimGui.h"
|
||||
#include "RelaySimGui.h"
|
||||
@@ -85,9 +87,43 @@ __declspec(dllexport)
|
||||
PowerDistributionSimGui::Initialize();
|
||||
PWMSimGui::Initialize();
|
||||
RelaySimGui::Initialize();
|
||||
PHSimGui::Initialize();
|
||||
RoboRioSimGui::Initialize();
|
||||
TimingGui::Initialize();
|
||||
|
||||
HALSimGui::halProvider->RegisterModel(
|
||||
"AllPneumaticControls",
|
||||
[] {
|
||||
return PCMSimGui::PCMsAnyInitialized() || PHSimGui::PHsAnyInitialized();
|
||||
},
|
||||
[] {
|
||||
return std::make_unique<glass::AllPneumaticControlsModel>(
|
||||
PCMSimGui::GetPCMsModel(), PHSimGui::GetPHsModel());
|
||||
});
|
||||
|
||||
HALSimGui::halProvider->RegisterView(
|
||||
"Solenoids", "AllPneumaticControls",
|
||||
[](glass::Model* model) {
|
||||
auto pneumaticModel =
|
||||
static_cast<glass::AllPneumaticControlsModel*>(model);
|
||||
return PCMSimGui::PCMsAnySolenoids(pneumaticModel->pcms.get()) ||
|
||||
PHSimGui::PHsAnySolenoids(pneumaticModel->phs.get());
|
||||
},
|
||||
[](glass::Window* win, glass::Model* model) {
|
||||
win->SetFlags(ImGuiWindowFlags_AlwaysAutoResize);
|
||||
win->SetDefaultPos(290, 20);
|
||||
return glass::MakeFunctionView([=] {
|
||||
auto pneumaticModel =
|
||||
static_cast<glass::AllPneumaticControlsModel*>(model);
|
||||
glass::DisplayPneumaticControlsSolenoids(
|
||||
pneumaticModel->pcms.get(),
|
||||
HALSimGui::halProvider->AreOutputsEnabled());
|
||||
glass::DisplayPneumaticControlsSolenoids(
|
||||
pneumaticModel->phs.get(),
|
||||
HALSimGui::halProvider->AreOutputsEnabled());
|
||||
});
|
||||
});
|
||||
|
||||
HALSimGui::mainMenu.AddMainMenu([] {
|
||||
if (ImGui::BeginMenu("Hardware")) {
|
||||
HALSimGui::halProvider->DisplayMenu();
|
||||
|
||||
Reference in New Issue
Block a user