Closed Thorinair closed 5 years ago
Hi Thorinair,
Thanks for adding the extra functionality to allow independent retrieval of accel and mag data as well as configuration of the low pass filter response rate. It is much appreciated and I'm sure it will be useful to the wider community.
I just have one small comment on the naming of the third parameter of the begin function as "lowAccel", I feel it is a little ambiguous and may confusion in the future if more functionality is added for example an option to toggle the low power mode. May I suggest "lowpassAccel" or "dlpfcfgAccel" to make it a little more explicit? Otherwise I am happy to merge this request.
Regards, DP Eng
Good suggestion. I have renamed the parameter to lowpassAccel
, and also added it to the comment header of the begin function.
Many thanks Thorinair.
I was just thinking that modifying the begin function will also affect the three example sketches. Are you able to update those also?
Regards, DP Eng
I will check later today if they still work, but theoretically, it shouldn't be required because the third parameter has a default value set. Might still be useful to point out that the parameter exists though.
That's true, as long as the example sketches still work I'm happy.
I have now updated the examples. I did end up changing the begin function in them, just to highlight that the lowpass can indeed be set. I have also changed the sensorapi example to use 115200 baud serial like the other examples, mostly because of consistency. I have tested all 3 to make sure they work.
I have done some changes to the original library:
getEventAcc
andgetEventMag
. These two functions have a lower overhead, performing read requests only for the accelerometer and magnetometer respectively. This lowers the execution time from around 3000 us to 1300 us and 1100 us respectively. I have added these as I needed to sample the accelerometer at a high rate.begin
function:lowAccel
. This parameter specifies the lowpass filter which will be ran internally on the accelerometer, and the user can choose from any defined in theicm20948AccelLowpass_t
enum. I have done this as I needed to change the lowpass filter from the 50.4 Hz which was originally hardcoded.