Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 4 potential issues.
Bugbot Free Tier Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
There was a problem hiding this comment.
Pull request overview
Adds MPU-6886 IMU support for M5Stack Core2 and wires it into the display rotation example, along with related BSP capability and documentation updates.
Changes:
- Introduces a new
mpu6886ESP-IDF component (driver, build files, docs). - Enables
BSP_CAPS_IMUonm5stack_core_2and adds the driver as a BSP dependency. - Updates the
display_rotationexample to usempu6886on Core2 (and keepsicm42670for other IMU-capable boards).
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| examples/display_rotation/sdkconfig.bsp.m5stack_core_2 | Adds a Core2-specific minimal sdkconfig for the display_rotation example. |
| examples/display_rotation/main/main.c | Selects MPU6886 vs ICM42670 by board and adds Core2 IMU init/read logic for rotation. |
| components/mpu6886/mpu6886.c | New MPU6886 driver implementation (I2C, data reads, config, interrupts, FIFO, filter). |
| components/mpu6886/license.txt | Adds Apache-2.0 license text for the new component. |
| components/mpu6886/include/mpu6886.h | New public header/API definitions for the MPU6886 driver. |
| components/mpu6886/idf_component.yml | Declares the MPU6886 component metadata and IDF dependency. |
| components/mpu6886/README.md | Documents MPU6886 features and usage examples. |
| components/mpu6886/CMakeLists.txt | Registers the new component and selects driver requirements by IDF version. |
| bsp/m5stack_tab5/API.md | Documentation formatting/punctuation updates. |
| bsp/m5stack_core_s3/API.md | Documentation formatting/punctuation updates. |
| bsp/m5stack_core_2/include/bsp/m5stack_core_2.h | Enables IMU capability and documents MPU6886 on the I2C bus. |
| bsp/m5stack_core_2/idf_component.yml | Bumps BSP version and adds MPU6886 as a public dependency (override_path). |
| bsp/m5stack_core_2/README.md | Marks IMU as supported and adds display_rotation example entry. |
| bsp/m5stack_core_2/API.md | Updates IMU capability macro doc and various doc formatting changes. |
| bsp/m5stack_core/API.md | Documentation formatting/punctuation updates. |
| bsp/m5dial/API.md | Documentation formatting/punctuation updates. |
| bsp/m5_atom_s3/API.md | Documentation formatting/punctuation updates. |
| bsp/esp_wrover_kit/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_s3_usb_otg/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_s3_lcd_ev_board/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_s3_korvo_2/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_s3_korvo_1/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_s3_eye/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_s2_kaluga_kit/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_p4_function_ev_board/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_p4_eye/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_lyrat/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_c3_lcdkit/API.md | Documentation formatting/punctuation updates. |
| bsp/esp32_azure_iot_kit/API.md | Documentation formatting/punctuation updates. |
| bsp/esp-box/API.md | Documentation formatting/punctuation updates. |
| bsp/esp-box-lite/API.md | Documentation formatting/punctuation updates. |
| bsp/esp-box-3/API.md | Documentation formatting/punctuation updates. |
| README.md | Updates Core2 feature list to include IMU and adds Core2 to the display_rotation supported boards list. |
Comments suppressed due to low confidence (6)
examples/display_rotation/main/main.c:1
imucan remainNULLwhenmpu6886_create()fails (init only logs/configures whenimuis non-null), butapp_imu_read()unconditionally callsmpu6886_get_*()withimu. Add an early return inapp_imu_read()whenimu == NULL, and consider logging the init failure once inapp_imu_init()so the example fails gracefully instead of dereferencing a null handle.
components/mpu6886/mpu6886.c:1- This file uses
calloc/freeandassert()later, but does not include the standard headers that declare them. This can fail builds under C99/C11 with-Werror=implicit-function-declaration(common in ESP-IDF). Add#include <stdlib.h>and#include <assert.h>near the other libc includes.
components/mpu6886/mpu6886.c:1 sensor->timerallocation is not checked for failure. Ifcalloc()returnsNULL, later calls togettimeofday(sens->timer, ...)will crash. ReturnNULL(and remove the I2C device / freesensor) when timer allocation fails. The legacympu6886_create()path has the same missing allocation checks.
components/mpu6886/mpu6886.c:1pin_bit_maskis a bitmask of GPIOs and is a 64-bit field in ESP-IDF. Using(BIT0 << gpio_num)performs the shift on a 32-bit value, which is undefined/incorrect for GPIO numbers >= 32 and can silently misconfigure the interrupt pin. Use a 64-bit shift (e.g.,1ULL << interrupt_configuration->interrupt_pin) to correctly support all valid GPIOs.
components/mpu6886/mpu6886.c:1- This uses a variable-length array sized by
data_len. VLAs are discouraged in ESP-IDF components because they can increase stack usage unpredictably and may be disabled by toolchain/project warnings. Prefer a small fixed-size stack buffer (if all writes are bounded) or allocate a buffer dynamically when needed (and handle allocation failure), or perform a two-step transmit if the I2C API supports it.
bsp/m5stack_core_2/API.md:1 - The docs now contain internal/anonymous-type placeholders like
bsp_sdcard_cfg_t::@..., which makes the generated API documentation harder to read and unstable across builds. This looks like a doc generation artifact; consider adjusting the documentation generator settings (or the source comments/types) so anonymous unions/structs are rendered with stable, human-readable names, and re-generate theseAPI.mdfiles.
# API Reference
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…gth, add null check
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 20. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 20. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
|
Hello @rashedtalukder, Thank you for this IMU driver addition. Could you please also include sensor-hub integration so that it can be directly used with our BSP sensor hub API. (ESP-BOX-3 example |
Change description
Add MPU-6886 6-axis IMU and Gyro feature for the M5Stack Core 2
Note
Medium Risk
Adds a new hardware driver component and wires it into the
m5stack_core_2BSP (capability flags + dependency graph), which could affect build/integration on that target. Other changes are documentation-only updates across many BSPAPI.mdfiles.Overview
Adds MPU-6886 IMU support for
m5stack_core_2by introducing a newcomponents/mpu6886driver component and declaring it as a public BSP dependency (and bumping the BSP version).Updates
m5stack_core_2capability metadata (BSP_CAPS_IMUnow enabled) and documentation so Core2 is listed as IMU-capable and as supported by thedisplay_rotationexample. The remainder of the diff is largely generated-doc touchups (punctuation/formatting) across multiple BSPAPI.mdfiles.Written by Cursor Bugbot for commit 67f0622. This will update automatically on new commits. Configure here.