Adafruit_MPU6050 icon indicating copy to clipboard operation
Adafruit_MPU6050 copied to clipboard

Alternative to resetting clearing MPU on init and begin calls.

Open mahboud opened this issue 2 years ago • 5 comments

  • Arduino board: MPU6050

  • Arduino IDE version (found in Arduino -> About Arduino menu): NA - 2.0 or 1.8

  • List the steps to reproduce the problem below (if possible attach a sketch or copy the sketch code in too):

When you use the ESP32 in Deep Sleep mode, and are using a MPU6050 that is configured to wake the ESP32, the interrupt status bits that are required to be read, will get demolished by the init() call (calling reset()), and the begin() call changes other settings that might not be desirable.

This is due to the fact that the ESP32's return from deep sleep, is very similar to a reset of the chip and many configurations, such as i2c connections, are reset and need to be reconfigured. It is important to be able to read the i2c, without disturbing important data.

An alternative could be to have init() not do anything but to make sure Wire and i2c are setup for the board so that communication can happen between the esp32 and the MPU6050. Then most people would use begin() to continue normal setup. Those who care to preserve the settings they already have, will not call begin(). They would read what they need, and change any settings as needed, without having a call that blanket resets things.

I don't think this is a big change, and I plan to try out those changes myself, to see if it accomplishes my goal. I'm curious what your thoughts are about this.

mahboud avatar Mar 07 '22 04:03 mahboud