mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpilibc] Add internal function to reset Shuffleboard instance (#4884)
Needed for RobotPy test framework.
This commit is contained in:
@@ -63,10 +63,24 @@ void Shuffleboard::AddEventMarker(std::string_view name,
|
||||
AddEventMarker(name, "", importance);
|
||||
}
|
||||
|
||||
detail::ShuffleboardInstance& Shuffleboard::GetInstance() {
|
||||
static detail::ShuffleboardInstance inst(
|
||||
static std::unique_ptr<detail::ShuffleboardInstance>& GetInstanceHolder() {
|
||||
static std::unique_ptr<detail::ShuffleboardInstance> instance =
|
||||
std::make_unique<detail::ShuffleboardInstance>(
|
||||
nt::NetworkTableInstance::GetDefault());
|
||||
return instance;
|
||||
}
|
||||
|
||||
#ifndef __FRC_ROBORIO__
|
||||
namespace frc::impl {
|
||||
void ResetShuffleboardInstance() {
|
||||
GetInstanceHolder() = std::make_unique<detail::ShuffleboardInstance>(
|
||||
nt::NetworkTableInstance::GetDefault());
|
||||
return inst;
|
||||
}
|
||||
} // namespace frc::impl
|
||||
#endif
|
||||
|
||||
detail::ShuffleboardInstance& Shuffleboard::GetInstance() {
|
||||
return *GetInstanceHolder();
|
||||
}
|
||||
|
||||
detail::RecordingController& Shuffleboard::GetRecordingController() {
|
||||
|
||||
Reference in New Issue
Block a user