[wpilibc] Revert "Return reference from GetInstance" (#3342)

This reverts commit a79faace1b.

This change will be superseded in a non-breaking way by changing to static functions and deprecating GetInstance() entirely.
This commit is contained in:
Peter Johnson
2021-05-09 18:16:07 -07:00
committed by GitHub
parent 3cc2da3328
commit 3fe8fc75aa
18 changed files with 63 additions and 67 deletions

View File

@@ -70,19 +70,19 @@ CommandScheduler::CommandScheduler()
HAL_Report(HALUsageReporting::kResourceType_Command,
HALUsageReporting::kCommand2_Scheduler);
frc::SendableRegistry::GetInstance().AddLW(this, "Scheduler");
auto& scheduler = frc::LiveWindow::GetInstance();
scheduler.enabled = [this] {
Disable();
CancelAll();
auto scheduler = frc::LiveWindow::GetInstance();
scheduler->enabled = [this] {
this->Disable();
this->CancelAll();
};
scheduler.disabled = [this] { Enable(); };
scheduler->disabled = [this] { this->Enable(); };
}
CommandScheduler::~CommandScheduler() {
frc::SendableRegistry::GetInstance().Remove(this);
auto& scheduler = frc::LiveWindow::GetInstance();
scheduler.enabled = nullptr;
scheduler.disabled = nullptr;
auto scheduler = frc::LiveWindow::GetInstance();
scheduler->enabled = nullptr;
scheduler->disabled = nullptr;
std::unique_ptr<Impl>().swap(m_impl);
}