Add more Logging to esp_restart (#179)

This commit is contained in:
pixel::doc 2024-05-24 04:55:31 +02:00 committed by GitHub
parent 0072a0f5c8
commit e4fcfdca83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 3 deletions

View File

@ -56,6 +56,8 @@ static void realloc_json_buffer(size_t len)
if (new_sockbuf == NULL) {
fprintf(stderr, "Error: realloc failed in recalloc_sock()\n");
ESP_LOGI(TAG, "Restarting System because of ERROR: realloc failed in recalloc_sock");
vTaskDelay(1000 / portTICK_PERIOD_MS);
esp_restart();
}
@ -79,7 +81,10 @@ char * STRATUM_V1_receive_jsonrpc_line(int sockfd)
memset(recv_buffer, 0, BUFFER_SIZE);
nbytes = recv(sockfd, recv_buffer, BUFFER_SIZE - 1, 0);
if (nbytes == -1) {
perror("recv");
//perror("recv");
ESP_LOGE(TAG, "recv");
ESP_LOGI(TAG, "Restarting System because of Error: recv");
vTaskDelay(1000 / portTICK_PERIOD_MS);
esp_restart();
}

View File

@ -308,6 +308,8 @@ static esp_err_t PATCH_update_settings(httpd_req_t * req)
static esp_err_t POST_restart(httpd_req_t * req)
{
ESP_LOGI(TAG, "Restarting System because of API Request");
vTaskDelay(1000 / portTICK_PERIOD_MS);
esp_restart();
return ESP_OK;
}
@ -471,8 +473,8 @@ esp_err_t POST_OTA_update(httpd_req_t * req)
}
httpd_resp_sendstr(req, "Firmware update complete, rebooting now!\n");
vTaskDelay(500 / portTICK_PERIOD_MS);
ESP_LOGI(TAG, "Restarting System because of Firmware update complete");
vTaskDelay(1000 / portTICK_PERIOD_MS);
esp_restart();
return ESP_OK;

View File

@ -120,6 +120,9 @@ void POWER_MANAGEMENT_task(void * pvParameters)
// chip is coming back from a low/no voltage event
if (power_management->frequency_value < 50 && target_frequency > 50) {
// TODO recover gracefully?
ESP_LOGE(TAG, "Freq %f", power_management->frequency_value);
ESP_LOGI(TAG, "Restarting System because of ERROR: low/no voltage event");
vTaskDelay(1000 / portTICK_PERIOD_MS);
esp_restart();
}

View File

@ -82,6 +82,8 @@ void stratum_task(void * pvParameters)
GLOBAL_STATE->sock = socket(addr_family, SOCK_STREAM, ip_protocol);
if (GLOBAL_STATE->sock < 0) {
ESP_LOGE(TAG, "Unable to create socket: errno %d", errno);
ESP_LOGI(TAG, "Restarting System because of ERROR: Unable to create socket");
vTaskDelay(1000 / portTICK_PERIOD_MS);
esp_restart();
break;
}