imxieyi / esp32-i2c-mpu6050

ESP32 I2C MPU6050 driver for esp-idf
31 stars 16 forks source link

r[0] ? #1

Open thealch3m1st opened 6 years ago

thealch3m1st commented 6 years ago

In mpu6050.cpp, line 70 you declare uint8_t r[0]; and then you read 2 bytes into it.

I don't really understand what's happening here. Could you please explain what's going on?

I would like to know: Why did you do that? Where is the memory for r? What are the consequences/limitations of doing this? Any additional information you think is relevant :)

Thanks

imxieyi commented 6 years ago

I believe it is a mistake. Although the code works, the memory is never allocated for r. It may point to anywhere and risk crashing the program. Since I don't have MPU6050 at hand, I can't test if it works well afterwards. Maybe you can correct it and open a pull request :)

thealch3m1st commented 6 years ago

Sorry for the late reply. Thanks for explaining. When I tried it it seemed to have been working fine. I will probably submit a PR soon :)