nopnop2002 / esp-idf-sx126x

SX1262/SX1268/LLCC68 Low Power Long Range Transceiver driver for esp-idf
MIT License
83 stars 18 forks source link

abort() istead of while(1) { vTaskDelay(1); }? #14

Closed Glowman554 closed 1 year ago

Glowman554 commented 1 year ago

Wouldn't it be better to use abort() or some other sort of error handler instead of while(1) { vTaskDelay(1); } when an error occurs? It would allow the user to handle errors or at least auto reboot the esp32.

nopnop2002 commented 1 year ago

You can auto-restart with abort()/assert()/esp_restart().

However, unless the error is recovered, it will auto-restart forever. Auto-restart makes it difficult to find the cause of the problem.

Glowman554 commented 1 year ago

For development purposes esp-idf allows you to turn auto restarts off. It allows you to have the feature when deploying.

nopnop2002 commented 1 year ago

For development purposes esp-idf allows you to turn auto restarts off.

how do i set it?

Glowman554 commented 1 year ago

Using CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT halts the cpu instead of rebooting. I think it is located under components - > esp system settings

Glowman554 commented 1 year ago

The default configuration is CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT

nopnop2002 commented 1 year ago

Using CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT halts the cpu instead of rebooting. I think it is located under components - > esp system settings

Thank you

Glowman554 commented 1 year ago

Hey would it be ok if i implement a error callback function which by default uses while(1) { vTaskDelay(1); } but can be overwritten by the user using weak linking?

nopnop2002 commented 1 year ago

Hey would it be ok if i implement a error callback function which by default uses while(1) { vTaskDelay(1); } but can be overwritten by the user using weak linking?

Try it.