Remove exception throwing
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "esp_chip_info.h"
|
||||
#include "esp_flash.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
//
|
||||
#include "common/constants.h"
|
||||
@@ -40,18 +41,21 @@ void init_queues(
|
||||
void app_main(void) {
|
||||
display_chip_info();
|
||||
|
||||
try {
|
||||
QueueHandle_t touch_event_queue = NULL;
|
||||
EventGroupHandle_t system_event_group = NULL, system_lifecycle_event_group = NULL;
|
||||
|
||||
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) {
|
||||
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");
|
||||
SemaphoreHandle_t lvgl_mutex = xSemaphoreCreateMutex();
|
||||
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(
|
||||
@@ -81,7 +85,9 @@ void app_main(void) {
|
||||
lvgl_tick_timer_callback
|
||||
);
|
||||
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);
|
||||
|
||||
@@ -162,28 +168,6 @@ void app_main(void) {
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void init_queues(
|
||||
QueueHandle_t& touch_queue,
|
||||
|
||||
Reference in New Issue
Block a user