SRA-VJTI / sra-board-component

ESP-IDF component for SRA Board
https://sravjti.in/sra-board-component/
MIT License
36 stars 20 forks source link

Removed extra error variables and replaced if else by switch case in adc.c #25

Closed ombhilare999 closed 4 years ago

udit7395 commented 4 years ago

@laukik-hase Isn't there a ERROR_FUNCTION_CHECK from ESP that does this if (err == ESP_OK ) ?

laukik-hase commented 4 years ago

@laukik-hase Isn't there a ERROR_FUNCTION_CHECK from ESP that does this if (err == ESP_OK ) ?

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/esp_err.html#c.ESP_ERROR_CHECK_WITHOUT_ABORT

ombhilare999 commented 4 years ago

Should I use this then @laukik-hase ?

ESP_ERROR_CHECK(x)

Macro which can be used to check the error code, and terminate the program in case the code is not ESP_OK. Prints the error code, error location, and the failed statement to serial output.

udit7395 commented 4 years ago

@laukik-hase Lets take up this activity of code improvement in the next round since majority of code has checks like these

laukik-hase commented 4 years ago

I am closing this pull request for now as further code optimizations will be done in the next round.