esp_register_shutdown_handler() function
Register shutdown handler This function allows you to register a handler that gets invoked before the application is restarted using esp_restart function.
Arguments
handle
function to execute on restart
Return value
- ESP_OK on success - ESP_ERR_INVALID_STATE if the handler has already been registered - ESP_ERR_NO_MEM if no more shutdown handler slots are available