feat: Implement Discord app UI and settings management
- Added MainUI class for displaying voice state, status icon, and buttons. - Introduced MainUIHandler to manage UI interactions and bridge communication. - Created SettingsUI for displaying QR code and configuration instructions. - Implemented SettingsUIHandler to manage settings and web server interactions. - Developed WebHandler for handling HTTP requests for settings configuration. - Updated AppRegistry to initialize with the new Discord app descriptor. - Enhanced InteractionHandler to support keyboard interactions across app switches. - Updated UIHandler to manage app switching and rendering of app icons. - Enabled QR code support in LVGL configuration.
This commit is contained in:
@@ -8,10 +8,12 @@
|
||||
#include "esp_flash.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_event.h"
|
||||
|
||||
//
|
||||
#include "common/constants.h"
|
||||
#include "common/queue_defs.h"
|
||||
#include "common/system_context.h"
|
||||
#include "io/nvs_handler.h"
|
||||
#include "io/fs_handler.h"
|
||||
#include "info/info.h"
|
||||
@@ -42,6 +44,15 @@ void init_queues(
|
||||
void app_main(void) {
|
||||
display_chip_info();
|
||||
|
||||
// Initialize default event loop early - required for UI events
|
||||
esp_err_t err = esp_event_loop_create_default();
|
||||
if (err != ESP_OK && err != ESP_ERR_INVALID_STATE) {
|
||||
ESP_LOGE(TAG, "Failed to create default event loop: %s", esp_err_to_name(err));
|
||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||
return esp_restart();
|
||||
}
|
||||
ESP_LOGI(TAG, "Default event loop created.\n");
|
||||
|
||||
QueueHandle_t touch_event_queue = NULL;
|
||||
EventGroupHandle_t system_event_group = NULL, system_lifecycle_event_group = NULL;
|
||||
|
||||
@@ -76,7 +87,7 @@ void app_main(void) {
|
||||
// LVGL Handler
|
||||
std::unique_ptr<EInkDisplayHandler> display_uptr(display_handler);
|
||||
LVGLHandler lvgl_handler(std::move(display_uptr));
|
||||
esp_err_t err = lvgl_handler.initLVGL(system_event_group);
|
||||
err = lvgl_handler.initLVGL(system_event_group);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to initialize LVGL handler: %s", esp_err_to_name(err));
|
||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||
@@ -87,6 +98,9 @@ void app_main(void) {
|
||||
kv_storage_handler->init(system_event_group);
|
||||
network_handler->init(system_event_group);
|
||||
|
||||
// Make network handler available to apps
|
||||
SystemContext::instance().set_network_handler(network_handler);
|
||||
|
||||
//
|
||||
ESP_LOGI(TAG, "Waiting for system to be ready...\n");
|
||||
xEventGroupWaitBits(
|
||||
@@ -100,7 +114,13 @@ void app_main(void) {
|
||||
);
|
||||
ESP_LOGI(TAG, "System is ready. Starting main application...\n");
|
||||
|
||||
// DiscordAppDescriptor::instance();
|
||||
AppRegistry& app_registry = AppRegistry::instance();
|
||||
err = app_registry.init();
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to initialize App Registry: %s", esp_err_to_name(err));
|
||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||
return esp_restart();
|
||||
}
|
||||
UIHandler ui_handler;
|
||||
err = ui_handler.init();
|
||||
if (err != ESP_OK) {
|
||||
|
||||
Reference in New Issue
Block a user