Releases: wollewald/ICM20948_WE
Change of SPI pins restricted to ESP32
In version 1.2.2 I had introduced a method to change the SPI pins. It worked fine on an ESP32. The problem is that not all MCUs do know the function SPI.begin(...changed pins...). I have now restricted the use to ESP32 boards using #ifdefined (ESP32).
Correct way of handling xyzFloat structures
Version 1.2.2 is not fully compatible with former versions. Many functions like getGValues() returned xyzFloat structures. To be exact, the functions did return pointers to the structures which were created by library functions. But after returning from the functions the memory space where the structures were located can be overwritten. I have changed that by passing the xyzFloat variables by reference. See also readme.
Moreover, I have added the option to change SPI pins in case your MCU board allows that. You can pass the SPI pins when creating your ICM20948_WE object.
Further improvement of magnetometer detection
Further improvement of magnetometer detection. With release 1.2.1 some users still had problems to detect the magnetometer.
Connection issue solved
My library caused sporadic connection issues after re-powering. This has been solved by setting up the magnetometer as SLV4. The magnetometer data reading is still done using the magnetometer as SLV0.
Added functions to query offsets
I added functions to query acceleration and gyroscope offset and to write these values back:
getAccOffsets()
getGyrOffsets()
setAccOffsets()
setGyrOffsets()
Further changes for the init procedure
Still there are issues when re-powering the ICM20948. Found this for ESP32 boards. If you add a delay of 2000 ms at the beginning of setup. it becomes better. Unfortunately still not perfect. No issues at all with Atmega328P based boards.
More reliable startup after re-power
When re-powered, the initiation sometimes failed. In this case a second attempt will be carried out.
Multiple tries to initiate the magnetometer
It seems that at least one user had issues to initiate the magnetometer. It only worked after few resets of the sketches.
I have implemented that, in case the magnetometer initiation fails, it is tried again up to ten times in total.
CS Pin changed from int16_t to int
Defining the cs pin variable as int16_t gave an error for some boards. Changed to int.
Change to default SPI clock
I noticed that the max SPI clock is 7 MHz according to the data sheet. I adjusted the default to 7 MHz accordingly from 8 MHz which also worked well so far in my tests.