mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
DutyCycleEncoder: Fix simulation support (#2387)
The DutyCycleEncoder class initializes AnalogTrigger, which is not supported in simulation. To avoid this, do not use AnalogTrigger (or Counter) in simulation mode. Fixes #2367 Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -160,8 +160,8 @@ class DutyCycleEncoder : public ErrorBase,
|
||||
void Init();
|
||||
|
||||
std::shared_ptr<DutyCycle> m_dutyCycle;
|
||||
AnalogTrigger m_analogTrigger;
|
||||
Counter m_counter;
|
||||
std::unique_ptr<AnalogTrigger> m_analogTrigger;
|
||||
std::unique_ptr<Counter> m_counter;
|
||||
int m_frequencyThreshold = 100;
|
||||
double m_positionOffset = 0;
|
||||
double m_distancePerRotation = 1.0;
|
||||
|
||||
Reference in New Issue
Block a user