Remove exception throwing
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include "esp_chip_info.h"
|
#include "esp_chip_info.h"
|
||||||
#include "esp_flash.h"
|
#include "esp_flash.h"
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
#include "common/constants.h"
|
#include "common/constants.h"
|
||||||
@@ -40,18 +41,21 @@ void init_queues(
|
|||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
display_chip_info();
|
display_chip_info();
|
||||||
|
|
||||||
try {
|
|
||||||
QueueHandle_t touch_event_queue = NULL;
|
QueueHandle_t touch_event_queue = NULL;
|
||||||
EventGroupHandle_t system_event_group = NULL, system_lifecycle_event_group = NULL;
|
EventGroupHandle_t system_event_group = NULL, system_lifecycle_event_group = NULL;
|
||||||
|
|
||||||
init_queues(touch_event_queue, system_event_group, system_lifecycle_event_group);
|
init_queues(touch_event_queue, system_event_group, system_lifecycle_event_group);
|
||||||
if (touch_event_queue == NULL || system_event_group == NULL || system_lifecycle_event_group == NULL) {
|
if (touch_event_queue == NULL || system_event_group == NULL || system_lifecycle_event_group == NULL) {
|
||||||
throw std::runtime_error("Failed to create one or more queues/event groups");
|
ESP_LOGE("Main", "Failed to create one or more queues/event groups");
|
||||||
|
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||||
|
return esp_restart();
|
||||||
}
|
}
|
||||||
printf("Queues initialized.\n");
|
printf("Queues initialized.\n");
|
||||||
SemaphoreHandle_t lvgl_mutex = xSemaphoreCreateMutex();
|
SemaphoreHandle_t lvgl_mutex = xSemaphoreCreateMutex();
|
||||||
if (lvgl_mutex == NULL) {
|
if (lvgl_mutex == NULL) {
|
||||||
throw std::runtime_error("Failed to create LVGL mutex");
|
ESP_LOGE("Main", "Failed to create LVGL mutex");
|
||||||
|
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||||
|
return esp_restart();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
WifiHandler wifi_handler(
|
WifiHandler wifi_handler(
|
||||||
@@ -81,7 +85,9 @@ void app_main(void) {
|
|||||||
lvgl_tick_timer_callback
|
lvgl_tick_timer_callback
|
||||||
);
|
);
|
||||||
if (lvgl_tick_timer == NULL) {
|
if (lvgl_tick_timer == NULL) {
|
||||||
throw std::runtime_error("Failed to create LVGL tick timer");
|
ESP_LOGE("Main", "Failed to create LVGL tick timer");
|
||||||
|
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||||
|
return esp_restart();
|
||||||
}
|
}
|
||||||
xTimerStart(lvgl_tick_timer, 0);
|
xTimerStart(lvgl_tick_timer, 0);
|
||||||
|
|
||||||
@@ -160,28 +166,6 @@ void app_main(void) {
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
return esp_restart();
|
|
||||||
}
|
|
||||||
catch (const std::exception& e) {
|
|
||||||
printf("Exception occurred during initialization: %s\n", e.what());
|
|
||||||
printf("System will restart due to the error.\n");
|
|
||||||
for (int i = 5; i >= 0; --i) {
|
|
||||||
printf("Restarting in %d seconds...\n", i);
|
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
||||||
}
|
|
||||||
printf("Restarting now.\n");
|
|
||||||
fflush(stdout);
|
|
||||||
return esp_restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Reached end of app_main unexpectedly.\n");
|
|
||||||
printf("System will restart in 10 seconds...\n");
|
|
||||||
for (int i = 10; i >= 0; --i) {
|
|
||||||
printf("Restarting in %d seconds...\n", i);
|
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
||||||
}
|
|
||||||
printf("Restarting now.\n");
|
|
||||||
fflush(stdout);
|
|
||||||
return esp_restart();
|
return esp_restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user