Skip to content

Potential crash on I2C communication failure due to ESP_ERROR_CHECK #786

@devprofile98

Description

@devprofile98

Hi, Thanks for the great library.

I am using i2cdev and esp-idf for an ESP32 project to connect to MPU6050, everything is ok in debug build, but in production, I think the ESP_ERROR_CHECK is misused, for example, the i2c_master_cmd_begin function can fail because the bus is busy (ESP_ERR_TIMEOUT), In debug environments this result in calling aborrt(), which could be ok in many cases, but in production the ESP_ERROR_CHECK macro became empty, and the writeBytes function will return true. This behavior is not suitable for a robust production application, considering I2C is a sensitive protocol.

Isn't it better to leverage a more appropriate error handling using if/else statements or just by returning the esp_err_t from the called function? What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions