Open eringerli opened 2 years ago
@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:
constexpr uint8_t registersAndNum[] = { LSM6DS_OUT_TEMP_L, 14, LSM6DS_OUTX_L_G, 12, LSM6DS_OUTX_L_G, 6, LSM6DS_OUTX_L_A, 6, LSM6DS_OUT_TEMP_L, 2};
seems like the wrong registers were referenced. If I change to the following:
constexpr uint8_t registersAndNum[] = { LSM6DS_OUT_TEMP_L, 14, LSM6DS_OUTX_L_G, 12, LSM6DS_OUTX_L_A, 6, LSM6DS_OUTX_L_G, 6, LSM6DS_OUT_TEMP_L, 2};
the functions appear to work as designed. I am in no way a pro at this, so I don't presume to know if there are other bits of code that should be checked.
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: