mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpilib] Deprecate getInstance() in favor of static functions (#3440)
Co-authored-by: Noam Zaks <imnoamzaks@gmail.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user