mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
DutyCycleEncoder: Set ownsDutyCycle for channel constructor (#2436)
Also close dutyCycle before closing digitalInput.
This commit is contained in:
@@ -41,6 +41,7 @@ public class DutyCycleEncoder implements Sendable, AutoCloseable {
|
||||
*/
|
||||
public DutyCycleEncoder(int channel) {
|
||||
m_digitalInput = new DigitalInput(channel);
|
||||
m_ownsDutyCycle = true;
|
||||
m_dutyCycle = new DutyCycle(m_digitalInput);
|
||||
init();
|
||||
}
|
||||
@@ -218,12 +219,12 @@ public class DutyCycleEncoder implements Sendable, AutoCloseable {
|
||||
if (m_analogTrigger != null) {
|
||||
m_analogTrigger.close();
|
||||
}
|
||||
if (m_digitalInput != null) {
|
||||
m_digitalInput.close();
|
||||
}
|
||||
if (m_ownsDutyCycle) {
|
||||
m_dutyCycle.close();
|
||||
}
|
||||
if (m_digitalInput != null) {
|
||||
m_digitalInput.close();
|
||||
}
|
||||
if (m_simDevice != null) {
|
||||
m_simDevice.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user