TechnoTitans / TitanWare2024

Crescendo 2024
Other
3 stars 1 forks source link

Split `SwerveModule.periodic()` into `updateInputs` and `periodic` #56

Closed HarryXChen3 closed 5 months ago

HarryXChen3 commented 6 months ago

Separate the periodic() call in SwerveModule into an updateInputs() call and a now independent periodic() call, that way only the updateInputs() call needs to be behind a read/write lock, and the rest of the periodic logic can remain outside of the lock, as it is thread safe.

This reduces the chances of a deadlock occurring by mistake when writing code in the old periodic() method, and also reduces the amount of the time the read/write lock is held for.