[wpilib] LiveWindow: Add enableAllTelemetry() (#4480)

This commit is contained in:
Peter Johnson
2022-10-17 14:39:57 -07:00
committed by GitHub
parent 8153911160
commit 878cc8defb
3 changed files with 30 additions and 0 deletions

View File

@@ -114,6 +114,18 @@ void LiveWindow::DisableAllTelemetry() {
});
}
void LiveWindow::EnableAllTelemetry() {
auto& inst = ::GetInstance();
std::scoped_lock lock(inst.mutex);
inst.telemetryEnabled = true;
wpi::SendableRegistry::ForeachLiveWindow(inst.dataHandle, [&](auto& cbdata) {
if (!cbdata.data) {
cbdata.data = std::make_shared<Component>();
}
std::static_pointer_cast<Component>(cbdata.data)->telemetryEnabled = true;
});
}
bool LiveWindow::IsEnabled() {
auto& inst = ::GetInstance();
std::scoped_lock lock(inst.mutex);