[wpilib] Add metadata to all dashboard ".type" entries (#6799)

This commit is contained in:
Ryan Blue
2024-07-02 16:31:50 -04:00
committed by GitHub
parent 7366a03fc9
commit 6a5448322b
12 changed files with 95 additions and 23 deletions

View File

@@ -8,6 +8,7 @@
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableInstance.h>
#include <networktables/StringTopic.h>
#include <wpi/json.h>
#include <wpi/mutex.h>
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableRegistry.h>
@@ -16,6 +17,8 @@
using namespace frc;
static constexpr std::string_view kSmartDashboardType = "LW Subsystem";
namespace {
struct Component {
bool firstTime = true;
@@ -207,8 +210,10 @@ void LiveWindow::UpdateValuesUnsafe() {
comp.namePub.Set(cbdata.name);
static_cast<SendableBuilderImpl&>(cbdata.builder).SetTable(table);
cbdata.sendable->InitSendable(cbdata.builder);
comp.typePub = nt::StringTopic{ssTable->GetTopic(".type")}.Publish();
comp.typePub.Set("LW Subsystem");
comp.typePub = nt::StringTopic{ssTable->GetTopic(".type")}.PublishEx(
nt::StringTopic::kTypeString,
{{"SmartDashboard", kSmartDashboardType}});
comp.typePub.Set(kSmartDashboardType);
comp.firstTime = false;
}