How to prevent ESP_ERROR_CHECK from aborting
Posted: Fri Jul 12, 2024 5:39 am
I'm using a library to interface with an I2C OLED display (specifically this one https://github.com/nkolban/esp32-snippe ... plays/U8G2), and have a long standing problem that when the I2C display is not connected my device just crash loops. The reason this happens is because of the calls to ESP_ERROR_CHECK like this one: https://github.com/nkolban/esp32-snippe ... hal.c#L159
Since there is no I2C device attached, the assert here will fail, and abort will be called. I'd love for my device to be able to handle this a little more gracefully, and simply print an error message when the I2C connection fails. Is there a straightforward way to do that?
Code: Select all
ESP_ERROR_CHECK(i2c_master_cmd_begin(I2C_MASTER_NUM, handle_i2c, pdMS_TO_TICKS(I2C_TIMEOUT_MS)));