mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Currently, Encoder.reset() must make a round trip to the sensor and back in order for the count to be updated for the user program. As the sim layer also resets the internal encoder count, this creates a race condition (a WS message with a new count can be "in flight" during a reset and update the count). This changes the WS layer to not put reset on the wire, but instead keep an offset count internal to the robot program. The value on the wire is not reset, but rather all sends and receives are adjusted as necessary to the internal robot count. This approach is straightforward, but does result in the value on the wire not matching the value in the user program. A future improvement will fix this, but this change fixes the immediate race condition problem.