[wpilib] Deprecate getInstance() in favor of static functions (#3440)

Co-authored-by: Noam Zaks <imnoamzaks@gmail.com>
This commit is contained in:
Peter Johnson
2021-06-15 23:06:03 -07:00
committed by GitHub
parent 26ff9371d9
commit 362066a9b7
105 changed files with 1500 additions and 1539 deletions

View File

@@ -20,12 +20,11 @@ MotorControllerGroup::MotorControllerGroup(
void MotorControllerGroup::Initialize() {
for (auto& motorController : m_motorControllers) {
wpi::SendableRegistry::GetInstance().AddChild(this, &motorController.get());
wpi::SendableRegistry::AddChild(this, &motorController.get());
}
static int instances = 0;
++instances;
wpi::SendableRegistry::GetInstance().Add(this, "MotorControllerGroup",
instances);
wpi::SendableRegistry::Add(this, "MotorControllerGroup", instances);
}
void MotorControllerGroup::Set(double speed) {

View File

@@ -13,9 +13,8 @@ using namespace frc;
NidecBrushless::NidecBrushless(int pwmChannel, int dioChannel)
: m_dio(dioChannel), m_pwm(pwmChannel) {
auto& registry = wpi::SendableRegistry::GetInstance();
registry.AddChild(this, &m_dio);
registry.AddChild(this, &m_pwm);
wpi::SendableRegistry::AddChild(this, &m_dio);
wpi::SendableRegistry::AddChild(this, &m_pwm);
SetExpiration(0_s);
SetSafetyEnabled(false);
@@ -24,7 +23,7 @@ NidecBrushless::NidecBrushless(int pwmChannel, int dioChannel)
m_dio.EnablePWM(0.5);
HAL_Report(HALUsageReporting::kResourceType_NidecBrushless, pwmChannel + 1);
registry.AddLW(this, "Nidec Brushless", pwmChannel);
wpi::SendableRegistry::AddLW(this, "Nidec Brushless", pwmChannel);
}
void NidecBrushless::Set(double speed) {

View File

@@ -44,7 +44,7 @@ int PWMMotorController::GetChannel() const {
PWMMotorController::PWMMotorController(std::string_view name, int channel)
: m_pwm(channel, false) {
wpi::SendableRegistry::GetInstance().AddLW(this, name, channel);
wpi::SendableRegistry::AddLW(this, name, channel);
}
void PWMMotorController::InitSendable(wpi::SendableBuilder& builder) {