mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] DutyCycleEncoder: Fix reset behavior (#5287)
reset should set the offset to the properly scaled position provided by getAbsolutePosition, not the raw duty cycle.
This commit is contained in:
@@ -164,7 +164,7 @@ void DutyCycleEncoder::Reset() {
|
||||
if (m_counter) {
|
||||
m_counter->Reset();
|
||||
}
|
||||
m_positionOffset = m_dutyCycle->GetOutput();
|
||||
m_positionOffset = GetAbsolutePosition();
|
||||
}
|
||||
|
||||
bool DutyCycleEncoder::IsConnected() const {
|
||||
|
||||
@@ -246,7 +246,7 @@ public class DutyCycleEncoder implements Sendable, AutoCloseable {
|
||||
if (m_counter != null) {
|
||||
m_counter.reset();
|
||||
}
|
||||
m_positionOffset = m_dutyCycle.getOutput();
|
||||
m_positionOffset = getAbsolutePosition();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user