mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
Add Encoder Index as a child (#857)
This commit is contained in:
committed by
Peter Johnson
parent
02131639bc
commit
c647a801ad
@@ -464,7 +464,8 @@ double Encoder::PIDGet() {
|
||||
*/
|
||||
void Encoder::SetIndexSource(int channel, Encoder::IndexingType type) {
|
||||
// Force digital input if just given an index
|
||||
m_indexSource = std::make_unique<DigitalInput>(channel);
|
||||
m_indexSource = std::make_shared<DigitalInput>(channel);
|
||||
AddChild(m_indexSource);
|
||||
SetIndexSource(*m_indexSource.get(), type);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class Encoder : public SensorBase, public CounterBase, public PIDSource {
|
||||
|
||||
std::shared_ptr<DigitalSource> m_aSource; // The A phase of the quad encoder
|
||||
std::shared_ptr<DigitalSource> m_bSource; // The B phase of the quad encoder
|
||||
std::unique_ptr<DigitalSource> m_indexSource = nullptr;
|
||||
std::shared_ptr<DigitalSource> m_indexSource = nullptr;
|
||||
HAL_EncoderHandle m_encoder = HAL_kInvalidHandle;
|
||||
|
||||
friend class DigitalGlitchFilter;
|
||||
|
||||
Reference in New Issue
Block a user