-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read selector #34
base: master
Are you sure you want to change the base?
Read selector #34
Conversation
With dedicated converter methods, the LSM6DSO32 can do its conversion for the bigger ranges there, so duplicated code in _read() can be removed. Also, getAccelRange() and setAccelRange() are exactly the same as in the base class, the difference is only the enum type. Replaced these methods with a call to the baseclass with the casted range.
fa4fad8
to
d34a85c
Compare
With this selector (which defaults to the behaviour as before this commit), the calling code can specify which kind data to transfer from the IMU. All the data transfer code is centralized in _read() now, the various getEvent() methods only transfer the data they need. I removed some hard coded conversions (all read outs now respect the set ranges) and also added a method to read out the accelerometer and gyroscope data at the same time.
d34a85c
to
1d694a4
Compare
@caternuson Did you have the time to read through this PR? |
This needs #33, so looking at that one first. |
@eringerli and @caternuson thanks for your efforts to update this library. I tested your pull and found that the readAcceleration and readGyro members were not working. I investigated a bit and believe I found the typo in the following:
thanks again. |
You're right, @f-peri. I want to rebase this commit anyway, so I have a look at it soon. |
With a selector (which defaults to the behaviour as before this commit), the calling code can specify which kind data to transfer from the IMU.
All the data transfer code is centralized in
_read()
now, the variousgetEvent()
methods call it with a selector. As only the data needed is transfered, this should result in a small performance gain.I removed some hard coded conversions, all reads should now respect the set ranges. I also added a method to read out the accelerometer and gyroscope at the same time.
As all the errors bubble up, this solves issue #26 and makes PR #27 obsolete.
Beware, this PR is based on PR #33:
