Skip to content

Conversation

bparks13
Copy link
Member

This update refactors the PolledBno055 device so that it no longer uses the HighResolutionTimer Juce class. Now, it runs on a regular Thread class and utilizes std::chrono::steady_clock to count intervals to ensure that the timer is not shared across multiple sources.

This PR also takes greater advantage of the new multi-byte read functionality to minimize the number of register reads while polling. Instead of reading two bytes at a time to get the full word for each value, now it reads four bytes at a time and then separates the higher and lower bits to create the individual values.

Testing shows that setting the sample rate at 100 Hz was able to achieve this rate, on average. There is some jitter in the acquisition, but the mean value is very close to 10 ms between successive timestamps.

bparks13 added 5 commits June 26, 2025 12:10
- Match conventions, remove unused enums, move method bodies out of the header file
- Removed the extra step checking for PolledBno devices, as the thread-safety additions ensure no streams will clash
@bparks13 bparks13 requested review from aacuevas and jonnew June 26, 2025 18:48
Copy link
Collaborator

@aacuevas aacuevas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are adding locks to many things now, I'd say to be consistent.
You are adding an optionLock to read options but not to write.

Also, in truth, optionLock and registerLock should be the same, they both access the same stream

@bparks13 bparks13 requested a review from aacuevas June 27, 2025 14:30
@bparks13
Copy link
Member Author

@aacuevas Thanks for the review, I have consolidated the option and register lock into one object. The lock for writing options was already present in the setOption method, but now it uses the register lock for consistency with the stream that is used for communication.

@bparks13 bparks13 self-assigned this Jun 27, 2025
@jonnew
Copy link
Contributor

jonnew commented Jul 1, 2025

Brandon and I looked at the behavior starting from scratch on a different dev machine with OEPS-supplied hardware and the behavior looked good.

Base automatically changed from issue-77 to main July 1, 2025 15:45
@bparks13 bparks13 dismissed aacuevas’s stale review July 1, 2025 15:47

Changes were committed and tested.

@bparks13 bparks13 merged commit 35a6d2b into main Jul 1, 2025
@bparks13 bparks13 deleted the polled-bno-threading branch July 1, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants