haitaowang1001 преди 4 дни
родител
ревизия
029479cb7b

+ 5 - 5
main/Kconfig.projbuild

@@ -404,21 +404,21 @@ config USE_WECHAT_MESSAGE_STYLE
 config USE_ESP_WAKE_WORD
     bool "Enable Wake Word Detection (without AFE)"
     default n
-    depends on IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C5 || IDF_TARGET_ESP32C6 || (IDF_TARGET_ESP32 && SPIRAM)
+    depends on IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C5 || IDF_TARGET_ESP32C6 || (IDF_TARGET_ESP32)
     help
         支持 ESP32 C3、ESP32 C5 与 ESP32 C6,增加ESP32支持(需要开启PSRAM)
 
 config USE_AFE_WAKE_WORD
     bool "Enable Wake Word Detection (AFE)"
     default y
-    depends on (IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4) && SPIRAM
+    depends on (IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4)
     help
         需要 ESP32 S3 与 PSRAM 支持
 
 config USE_CUSTOM_WAKE_WORD
     bool "Enable Custom Wake Word Detection"
     default n
-    depends on (IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4) && SPIRAM && (!USE_AFE_WAKE_WORD)
+    depends on (IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4) && (!USE_AFE_WAKE_WORD)
     help
         需要 ESP32 S3 与 PSRAM 支持
         
@@ -440,14 +440,14 @@ config CUSTOM_WAKE_WORD_DISPLAY
 config USE_AUDIO_PROCESSOR
     bool "Enable Audio Noise Reduction"
     default y
-    depends on (IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4) && SPIRAM
+    depends on (IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4)
     help
         需要 ESP32 S3 与 PSRAM 支持
 
 config USE_DEVICE_AEC
     bool "Enable Device-Side AEC"
     default n
-        depends on USE_AUDIO_PROCESSOR && (BOARD_TYPE_ESP_BOX_3 || BOARD_TYPE_ESP_BOX || BOARD_TYPE_ESP_BOX_LITE || BOARD_TYPE_LICHUANG_DEV || BOARD_TYPE_ESP32S3_KORVO2_V3 || BOARD_TYPE_ESP32S3_Touch_AMOLED_1_75 || BOARD_TYPE_ESP32S3_Touch_AMOLED_2_06 || BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_4B || BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC)
+        depends on USE_AUDIO_PROCESSOR && (BOARD_TYPE_CX_MXB_WIFI || BOARD_TYPE_ESP_BOX_3 || BOARD_TYPE_ESP_BOX || BOARD_TYPE_ESP_BOX_LITE || BOARD_TYPE_LICHUANG_DEV || BOARD_TYPE_ESP32S3_KORVO2_V3 || BOARD_TYPE_ESP32S3_Touch_AMOLED_1_75 || BOARD_TYPE_ESP32S3_Touch_AMOLED_2_06 || BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_4B || BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC)
     help
         因为性能不够,不建议和微信聊天界面风格同时开启
 

+ 6 - 6
main/boards/atk-dnesp32s3-box0/power_manager.h

@@ -82,12 +82,12 @@ private:
             uint16_t adc;
             uint8_t level;
         } levels[] = {
-            {2951, 0},  /*  3.80V */
-            {3019, 20},
-            {3037, 40},
-            {3091, 60}, /* 3.88 */
-            {3124, 80},
-            {3231, 100}
+            {2835, 0}, 
+            {2953, 20},
+            {3033, 40},
+            {3112, 60},
+            {3228, 80},
+            {3306, 100}
         };
 
         // 低于最低值时

+ 1 - 1
main/boards/common/blufi.c

@@ -176,7 +176,7 @@ static void ip_event_handler(void* arg, esp_event_base_t event_base,
  
             // 添加延迟确保数据写入完成 
             vTaskDelay(pdMS_TO_TICKS(100));
-            
+            blufi_security_deinit();
             // 重启设备
             esp_restart();           
         } else {

+ 26 - 17
main/boards/cx-mxb-wifi/config.h

@@ -1,28 +1,37 @@
-
 #ifndef _BOARD_CONFIG_H_
 #define _BOARD_CONFIG_H_
 
 #include <driver/gpio.h>
 
-#define AUDIO_INPUT_SAMPLE_RATE  16000
+
+#define AUDIO_INPUT_SAMPLE_RATE  24000
 #define AUDIO_OUTPUT_SAMPLE_RATE 24000
 
-#define AUDIO_I2S_MIC_GPIO_WS   GPIO_NUM_4
-#define AUDIO_I2S_MIC_GPIO_SCK  GPIO_NUM_5
-#define AUDIO_I2S_MIC_GPIO_DIN  GPIO_NUM_6
-#define AUDIO_I2S_SPK_GPIO_DOUT GPIO_NUM_7
-#define AUDIO_I2S_SPK_GPIO_BCLK GPIO_NUM_15
-#define AUDIO_I2S_SPK_GPIO_LRCK GPIO_NUM_16
+#define AUDIO_INPUT_REFERENCE    true
+
+#define AUDIO_I2S_GPIO_MCLK GPIO_NUM_45
+#define AUDIO_I2S_GPIO_WS GPIO_NUM_41
+#define AUDIO_I2S_GPIO_BCLK GPIO_NUM_39
+#define AUDIO_I2S_GPIO_DIN  GPIO_NUM_42
+#define AUDIO_I2S_GPIO_DOUT GPIO_NUM_40
 
+#define AUDIO_CODEC_PA_PIN       GPIO_NUM_46
+#define AUDIO_CODEC_I2C_SDA_PIN  GPIO_NUM_15
+#define AUDIO_CODEC_I2C_SCL_PIN  GPIO_NUM_16
+#define AUDIO_CODEC_ES8311_ADDR  ES8311_CODEC_DEFAULT_ADDR
+#define AUDIO_CODEC_ES7210_ADDR  ES7210_CODEC_DEFAULT_ADDR
+
+#define BUILTIN_LED_GPIO        GPIO_NUM_NC
 #define BOOT_BUTTON_GPIO        GPIO_NUM_0
-#define VOLUME_UP_BUTTON_GPIO   GPIO_NUM_40
-#define VOLUME_DOWN_BUTTON_GPIO GPIO_NUM_39
-
-#define DISPLAY_SDA GPIO_NUM_10
-#define DISPLAY_SCL GPIO_NUM_9
-#define DISPLAY_DC GPIO_NUM_8
-#define DISPLAY_CS GPIO_NUM_14
-#define DISPLAY_RES GPIO_NUM_18
+#define VOLUME_UP_BUTTON_GPIO   GPIO_NUM_NC
+#define VOLUME_DOWN_BUTTON_GPIO GPIO_NUM_NC
+
+
+#define DISPLAY_SDA GPIO_NUM_47
+#define DISPLAY_SCL GPIO_NUM_21
+#define DISPLAY_DC GPIO_NUM_7
+#define DISPLAY_CS GPIO_NUM_8
+#define DISPLAY_RES GPIO_NUM_46
 #define DISPLAY_WIDTH   240
 #define DISPLAY_HEIGHT  240
 #define DISPLAY_SWAP_XY  false
@@ -31,7 +40,7 @@
 #define BACKLIGHT_INVERT false
 #define DISPLAY_OFFSET_X  0
 #define DISPLAY_OFFSET_Y  0
-#define DISPLAY_BACKLIGHT_PIN GPIO_NUM_13
+#define DISPLAY_BACKLIGHT_PIN GPIO_NUM_NC
 #define DISPLAY_BACKLIGHT_OUTPUT_INVERT false
 
 #endif // _BOARD_CONFIG_H_

+ 49 - 132
main/boards/cx-mxb-wifi/cx-mxb-wifi.cc

@@ -1,41 +1,39 @@
 #include "wifi_board.h"
-#include "codecs/no_audio_codec.h"
+#include "codecs/box_audio_codec.h"
 #include "display/lcd_display.h"
-#include "system_reset.h"
+#include "esp_lcd_ili9341.h"
+#include "font_awesome_symbols.h"
 #include "application.h"
 #include "button.h"
 #include "config.h"
-#include "power_save_timer.h"
-#include "led/single_led.h"
-#include "assets/lang_config.h"
 #include "power_manager.h"
+#include "power_save_timer.h"
 
 #include <esp_log.h>
 #include <esp_lcd_panel_vendor.h>
+#include <driver/i2c_master.h>
+#include <driver/spi_common.h>
 #include <wifi_station.h>
 
-#include <driver/rtc_io.h>
-#include <esp_sleep.h>
-
-#define TAG "CX_MXB_WIFI"
+#define TAG "EspBoxBoard"
 
 LV_FONT_DECLARE(font_puhui_20_4);
 LV_FONT_DECLARE(font_awesome_20_4);
 
 
+
 class CX_MXB_WIFI : public WifiBoard {
 private:
-    Button boot_button_;
-    Button volume_up_button_;
-    Button volume_down_button_;
+    i2c_master_bus_handle_t i2c_bus_;
     SpiLcdDisplay* display_;
-    PowerSaveTimer* power_save_timer_;
-    PowerManager* power_manager_;
+    Button boot_button_;
     esp_lcd_panel_io_handle_t panel_io_ = nullptr;
     esp_lcd_panel_handle_t panel_ = nullptr;
+    PowerSaveTimer* power_save_timer_;
+    PowerManager* power_manager_;
 
     void InitializePowerManager() {
-        power_manager_ = new PowerManager(GPIO_NUM_38);
+        power_manager_ = new PowerManager(GPIO_NUM_1);
         power_manager_->OnChargingStatusChanged([this](bool is_charging) {
             if (is_charging) {
                 power_save_timer_->SetEnabled(false);
@@ -46,47 +44,32 @@ private:
     }
 
     void InitializePowerSaveTimer() {
-        rtc_gpio_init(GPIO_NUM_21);
-        rtc_gpio_set_direction(GPIO_NUM_21, RTC_GPIO_MODE_OUTPUT_ONLY);
-        rtc_gpio_set_level(GPIO_NUM_21, 1);
 
         power_save_timer_ = new PowerSaveTimer(-1, 60, 300);
-        power_save_timer_->OnEnterSleepMode([this]() {
-            ESP_LOGI(TAG, "Enabling sleep mode");
-            display_->SetChatMessage("system", "");
-            display_->SetEmotion("sleepy");
-            GetBacklight()->SetBrightness(1);
-        });
-        power_save_timer_->OnExitSleepMode([this]() {
-            display_->SetChatMessage("system", "");
-            display_->SetEmotion("neutral");
-            GetBacklight()->RestoreBrightness();
-        });
         power_save_timer_->OnShutdownRequest([this]() {
-            ESP_LOGI(TAG, "Shutting down");
-            rtc_gpio_set_level(GPIO_NUM_21, 0);
-            // 启用保持功能,确保睡眠期间电平不变
-            rtc_gpio_hold_en(GPIO_NUM_21);
-            esp_lcd_panel_disp_on_off(panel_, false); //关闭显示
-            esp_deep_sleep_start();
         });
         power_save_timer_->SetEnabled(true);
     }
 
-    void InitializeSpi() {
-        spi_bus_config_t buscfg = {};
-        buscfg.mosi_io_num = DISPLAY_SDA;
-        buscfg.miso_io_num = GPIO_NUM_NC;
-        buscfg.sclk_io_num = DISPLAY_SCL;
-        buscfg.quadwp_io_num = GPIO_NUM_NC;
-        buscfg.quadhd_io_num = GPIO_NUM_NC;
-        buscfg.max_transfer_sz = DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t);
-        ESP_ERROR_CHECK(spi_bus_initialize(SPI3_HOST, &buscfg, SPI_DMA_CH_AUTO));
+    void InitializeI2c() {
+        // Initialize I2C peripheral
+        i2c_master_bus_config_t i2c_bus_cfg = {
+            .i2c_port = (i2c_port_t)1,
+            .sda_io_num = AUDIO_CODEC_I2C_SDA_PIN,
+            .scl_io_num = AUDIO_CODEC_I2C_SCL_PIN,
+            .clk_source = I2C_CLK_SRC_DEFAULT,
+            .glitch_ignore_cnt = 7,
+            .intr_priority = 0,
+            .trans_queue_depth = 0,
+            .flags = {
+                .enable_internal_pullup = 1,
+            },
+        };
+        ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_cfg, &i2c_bus_));
     }
 
     void InitializeButtons() {
         boot_button_.OnClick([this]() {
-            power_save_timer_->WakeUp();
             auto& app = Application::GetInstance();
             if (app.GetDeviceState() == kDeviceStateStarting && !WifiStation::GetInstance().IsConnected()) {
                 ResetWifiConfiguration();
@@ -94,106 +77,39 @@ private:
             app.ToggleChatState();
         });
 
-        volume_up_button_.OnClick([this]() {
-            power_save_timer_->WakeUp();
-            auto codec = GetAudioCodec();
-            auto volume = codec->output_volume() + 10;
-            if (volume > 100) {
-                volume = 100;
-            }
-            codec->SetOutputVolume(volume);
-            GetDisplay()->ShowNotification(Lang::Strings::VOLUME + std::to_string(volume));
-        });
-
-        volume_up_button_.OnLongPress([this]() {
-            power_save_timer_->WakeUp();
-            GetAudioCodec()->SetOutputVolume(100);
-            GetDisplay()->ShowNotification(Lang::Strings::MAX_VOLUME);
-        });
-
-        volume_down_button_.OnClick([this]() {
-            power_save_timer_->WakeUp();
-            auto codec = GetAudioCodec();
-            auto volume = codec->output_volume() - 10;
-            if (volume < 0) {
-                volume = 0;
+#if CONFIG_USE_DEVICE_AEC
+        boot_button_.OnDoubleClick([this]() {
+            auto& app = Application::GetInstance();
+            if (app.GetDeviceState() == kDeviceStateIdle) {
+                app.SetAecMode(app.GetAecMode() == kAecOff ? kAecOnDeviceSide : kAecOff);
             }
-            codec->SetOutputVolume(volume);
-            GetDisplay()->ShowNotification(Lang::Strings::VOLUME + std::to_string(volume));
         });
-
-        volume_down_button_.OnLongPress([this]() {
-            power_save_timer_->WakeUp();
-            GetAudioCodec()->SetOutputVolume(0);
-            GetDisplay()->ShowNotification(Lang::Strings::MUTED);
-        });
-    }
-
-    void InitializeSt7789Display() {
-        ESP_LOGD(TAG, "Install panel IO");
-        esp_lcd_panel_io_spi_config_t io_config = {};
-        io_config.cs_gpio_num = DISPLAY_CS;
-        io_config.dc_gpio_num = DISPLAY_DC;
-        io_config.spi_mode = 3;
-        io_config.pclk_hz = 80 * 1000 * 1000;
-        io_config.trans_queue_depth = 10;
-        io_config.lcd_cmd_bits = 8;
-        io_config.lcd_param_bits = 8;
-        ESP_ERROR_CHECK(esp_lcd_new_panel_io_spi(SPI3_HOST, &io_config, &panel_io_));
-
-        ESP_LOGD(TAG, "Install LCD driver");
-        esp_lcd_panel_dev_config_t panel_config = {};
-        panel_config.reset_gpio_num = DISPLAY_RES;
-        panel_config.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB;
-        panel_config.bits_per_pixel = 16;
-        ESP_ERROR_CHECK(esp_lcd_new_panel_st7789(panel_io_, &panel_config, &panel_));
-        ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
-        ESP_ERROR_CHECK(esp_lcd_panel_init(panel_));
-        ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_, DISPLAY_SWAP_XY));
-        ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y));
-        ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_, true));
-
-        display_ = new SpiLcdDisplay(panel_io_, panel_, DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_OFFSET_X, DISPLAY_OFFSET_Y, 
-            DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y, DISPLAY_SWAP_XY, 
-        {
-            .text_font = &font_puhui_20_4,
-            .icon_font = &font_awesome_20_4,
-#if CONFIG_USE_WECHAT_MESSAGE_STYLE
-            .emoji_font = font_emoji_32_init(),
-#else
-            .emoji_font = font_emoji_64_init(),
 #endif
-        });
     }
-
 public:
-        CX_MXB_WIFI() :
-        boot_button_(BOOT_BUTTON_GPIO),
-        volume_up_button_(VOLUME_UP_BUTTON_GPIO),
-        volume_down_button_(VOLUME_DOWN_BUTTON_GPIO) {
+    CX_MXB_WIFI() : boot_button_(BOOT_BUTTON_GPIO) {
         InitializePowerManager();
         InitializePowerSaveTimer();
-        InitializeSpi();
+        InitializeI2c();
         InitializeButtons();
-        InitializeSt7789Display();
-        GetBacklight()->RestoreBrightness();
     }
 
     virtual AudioCodec* GetAudioCodec() override {
-        static NoAudioCodecSimplex audio_codec(AUDIO_INPUT_SAMPLE_RATE, AUDIO_OUTPUT_SAMPLE_RATE,
-            AUDIO_I2S_SPK_GPIO_BCLK, AUDIO_I2S_SPK_GPIO_LRCK, AUDIO_I2S_SPK_GPIO_DOUT, AUDIO_I2S_MIC_GPIO_SCK, AUDIO_I2S_MIC_GPIO_WS, AUDIO_I2S_MIC_GPIO_DIN);
+        static BoxAudioCodec audio_codec(
+            i2c_bus_, 
+            AUDIO_INPUT_SAMPLE_RATE, 
+            AUDIO_OUTPUT_SAMPLE_RATE,
+            AUDIO_I2S_GPIO_MCLK, 
+            AUDIO_I2S_GPIO_BCLK, 
+            AUDIO_I2S_GPIO_WS, 
+            AUDIO_I2S_GPIO_DOUT, 
+            AUDIO_I2S_GPIO_DIN,
+            AUDIO_CODEC_PA_PIN, 
+            AUDIO_CODEC_ES8311_ADDR, 
+            AUDIO_CODEC_ES7210_ADDR, 
+            AUDIO_INPUT_REFERENCE);
         return &audio_codec;
     }
-
-    virtual Display* GetDisplay() override {
-        return display_;
-    }
-    
-    virtual Backlight* GetBacklight() override {
-        static PwmBacklight backlight(DISPLAY_BACKLIGHT_PIN, DISPLAY_BACKLIGHT_OUTPUT_INVERT);
-        return &backlight;
-    }
-
     virtual bool GetBatteryLevel(int& level, bool& charging, bool& discharging) override {
         static bool last_discharging = false;
         charging = power_manager_->IsCharging();
@@ -212,6 +128,7 @@ public:
         }
         WifiBoard::SetPowerSaveMode(enabled);
     }
+
 };
 
 DECLARE_BOARD(CX_MXB_WIFI);

+ 9 - 10
main/boards/cx-mxb-wifi/power_manager.h

@@ -36,7 +36,6 @@ private:
             ReadBatteryAdcData();
             return;
         }
-
         // 如果电池电量数据不足,则读取电池电量数据
         if (adc_values_.size() < kBatteryAdcDataCount) {
             ReadBatteryAdcData();
@@ -52,7 +51,7 @@ private:
 
     void ReadBatteryAdcData() {
         int adc_value;
-        ESP_ERROR_CHECK(adc_oneshot_read(adc_handle_, ADC_CHANNEL_6, &adc_value));
+        ESP_ERROR_CHECK(adc_oneshot_read(adc_handle_, ADC_CHANNEL_1, &adc_value));
         
         // 将 ADC 值添加到队列中
         adc_values_.push_back(adc_value);
@@ -70,12 +69,12 @@ private:
             uint16_t adc;
             uint8_t level;
         } levels[] = {
-            {1970, 0},
-            {2062, 20},
-            {2154, 40},
-            {2246, 60},
-            {2338, 80},
-            {2430, 100}
+            {2047, 0},
+            {2106, 20},
+            {2164, 40},
+            {2223, 60},
+            {2281, 80},
+            {2310, 100}
         };
 
         // 低于最低值时
@@ -137,7 +136,7 @@ public:
 
         // 初始化 ADC
         adc_oneshot_unit_init_cfg_t init_config = {
-            .unit_id = ADC_UNIT_2,
+            .unit_id = ADC_UNIT_1,
             .ulp_mode = ADC_ULP_MODE_DISABLE,
         };
         ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config, &adc_handle_));
@@ -146,7 +145,7 @@ public:
             .atten = ADC_ATTEN_DB_12,
             .bitwidth = ADC_BITWIDTH_12,
         };
-        ESP_ERROR_CHECK(adc_oneshot_config_channel(adc_handle_, ADC_CHANNEL_6, &chan_config));
+        ESP_ERROR_CHECK(adc_oneshot_config_channel(adc_handle_, ADC_CHANNEL_1, &chan_config));
     }
 
     ~PowerManager() {

+ 6 - 6
main/boards/xingzhi-cube-1.54tft-wifi/power_manager.h

@@ -70,12 +70,12 @@ private:
             uint16_t adc;
             uint8_t level;
         } levels[] = {
-            {1970, 0},
-            {2062, 20},
-            {2154, 40},
-            {2246, 60},
-            {2338, 80},
-            {2430, 100}
+            {2047, 0},
+            {2106, 20},
+            {2164, 40},
+            {2223, 60},
+            {2281, 80},
+            {2340, 100}
         };
 
         // 低于最低值时

+ 211 - 211
main/display/display.cc

@@ -15,62 +15,62 @@
 #define TAG "Display"
 
 Display::Display() {
-    // Notification timer
-    esp_timer_create_args_t notification_timer_args = {
-        .callback = [](void *arg) {
-            Display *display = static_cast<Display*>(arg);
-            DisplayLockGuard lock(display);
-            lv_obj_add_flag(display->notification_label_, LV_OBJ_FLAG_HIDDEN);
-            lv_obj_clear_flag(display->status_label_, LV_OBJ_FLAG_HIDDEN);
-        },
-        .arg = this,
-        .dispatch_method = ESP_TIMER_TASK,
-        .name = "notification_timer",
-        .skip_unhandled_events = false,
-    };
-    ESP_ERROR_CHECK(esp_timer_create(&notification_timer_args, &notification_timer_));
+    // // Notification timer
+    // esp_timer_create_args_t notification_timer_args = {
+    //     .callback = [](void *arg) {
+    //         Display *display = static_cast<Display*>(arg);
+    //         DisplayLockGuard lock(display);
+    //         lv_obj_add_flag(display->notification_label_, LV_OBJ_FLAG_HIDDEN);
+    //         lv_obj_clear_flag(display->status_label_, LV_OBJ_FLAG_HIDDEN);
+    //     },
+    //     .arg = this,
+    //     .dispatch_method = ESP_TIMER_TASK,
+    //     .name = "notification_timer",
+    //     .skip_unhandled_events = false,
+    // };
+    // ESP_ERROR_CHECK(esp_timer_create(&notification_timer_args, &notification_timer_));
 
-    // Create a power management lock
-    auto ret = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "display_update", &pm_lock_);
-    if (ret == ESP_ERR_NOT_SUPPORTED) {
-        ESP_LOGI(TAG, "Power management not supported");
-    } else {
-        ESP_ERROR_CHECK(ret);
-    }
+    // // Create a power management lock
+    // auto ret = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "display_update", &pm_lock_);
+    // if (ret == ESP_ERR_NOT_SUPPORTED) {
+    //     ESP_LOGI(TAG, "Power management not supported");
+    // } else {
+    //     ESP_ERROR_CHECK(ret);
+    // }
 }
 
 Display::~Display() {
-    if (notification_timer_ != nullptr) {
-        esp_timer_stop(notification_timer_);
-        esp_timer_delete(notification_timer_);
-    }
+    // if (notification_timer_ != nullptr) {
+    //     esp_timer_stop(notification_timer_);
+    //     esp_timer_delete(notification_timer_);
+    // }
 
-    if (network_label_ != nullptr) {
-        lv_obj_del(network_label_);
-        lv_obj_del(notification_label_);
-        lv_obj_del(status_label_);
-        lv_obj_del(mute_label_);
-        lv_obj_del(battery_label_);
-        lv_obj_del(emotion_label_);
-    }
-    if( low_battery_popup_ != nullptr ) {
-        lv_obj_del(low_battery_popup_);
-    }
-    if (pm_lock_ != nullptr) {
-        esp_pm_lock_delete(pm_lock_);
-    }
+    // if (network_label_ != nullptr) {
+    //     lv_obj_del(network_label_);
+    //     lv_obj_del(notification_label_);
+    //     lv_obj_del(status_label_);
+    //     lv_obj_del(mute_label_);
+    //     lv_obj_del(battery_label_);
+    //     lv_obj_del(emotion_label_);
+    // }
+    // if( low_battery_popup_ != nullptr ) {
+    //     lv_obj_del(low_battery_popup_);
+    // }
+    // if (pm_lock_ != nullptr) {
+    //     esp_pm_lock_delete(pm_lock_);
+    // }
 }
 
 void Display::SetStatus(const char* status) {
-    DisplayLockGuard lock(this);
-    if (status_label_ == nullptr) {
-        return;
-    }
-    lv_label_set_text(status_label_, status);
-    lv_obj_clear_flag(status_label_, LV_OBJ_FLAG_HIDDEN);
-    lv_obj_add_flag(notification_label_, LV_OBJ_FLAG_HIDDEN);
+    // DisplayLockGuard lock(this);
+    // if (status_label_ == nullptr) {
+    //     return;
+    // }
+    // lv_label_set_text(status_label_, status);
+    // lv_obj_clear_flag(status_label_, LV_OBJ_FLAG_HIDDEN);
+    // lv_obj_add_flag(notification_label_, LV_OBJ_FLAG_HIDDEN);
 
-    last_status_update_time_ = std::chrono::system_clock::now();
+    // last_status_update_time_ = std::chrono::system_clock::now();
 }
 
 void Display::ShowNotification(const std::string &notification, int duration_ms) {
@@ -78,177 +78,177 @@ void Display::ShowNotification(const std::string &notification, int duration_ms)
 }
 
 void Display::ShowNotification(const char* notification, int duration_ms) {
-    DisplayLockGuard lock(this);
-    if (notification_label_ == nullptr) {
-        return;
-    }
-    lv_label_set_text(notification_label_, notification);
-    lv_obj_clear_flag(notification_label_, LV_OBJ_FLAG_HIDDEN);
-    lv_obj_add_flag(status_label_, LV_OBJ_FLAG_HIDDEN);
+    // DisplayLockGuard lock(this);
+    // if (notification_label_ == nullptr) {
+    //     return;
+    // }
+    // lv_label_set_text(notification_label_, notification);
+    // lv_obj_clear_flag(notification_label_, LV_OBJ_FLAG_HIDDEN);
+    // lv_obj_add_flag(status_label_, LV_OBJ_FLAG_HIDDEN);
 
-    esp_timer_stop(notification_timer_);
-    ESP_ERROR_CHECK(esp_timer_start_once(notification_timer_, duration_ms * 1000));
+    // esp_timer_stop(notification_timer_);
+    // ESP_ERROR_CHECK(esp_timer_start_once(notification_timer_, duration_ms * 1000));
 }
 
 void Display::UpdateStatusBar(bool update_all) {
-    auto& app = Application::GetInstance();
-    auto& board = Board::GetInstance();
-    auto codec = board.GetAudioCodec();
+    // auto& app = Application::GetInstance();
+    // auto& board = Board::GetInstance();
+    // auto codec = board.GetAudioCodec();
 
-    // Update mute icon
-    {
-        DisplayLockGuard lock(this);
-        if (mute_label_ == nullptr) {
-            return;
-        }
+    // // Update mute icon
+    // {
+    //     DisplayLockGuard lock(this);
+    //     if (mute_label_ == nullptr) {
+    //         return;
+    //     }
 
-        // 如果静音状态改变,则更新图标
-        if (codec->output_volume() == 0 && !muted_) {
-            muted_ = true;
-            lv_label_set_text(mute_label_, FONT_AWESOME_VOLUME_MUTE);
-        } else if (codec->output_volume() > 0 && muted_) {
-            muted_ = false;
-            lv_label_set_text(mute_label_, "");
-        }
-    }
+    //     // 如果静音状态改变,则更新图标
+    //     if (codec->output_volume() == 0 && !muted_) {
+    //         muted_ = true;
+    //         lv_label_set_text(mute_label_, FONT_AWESOME_VOLUME_MUTE);
+    //     } else if (codec->output_volume() > 0 && muted_) {
+    //         muted_ = false;
+    //         lv_label_set_text(mute_label_, "");
+    //     }
+    // }
 
-    // Update time
-    if (app.GetDeviceState() == kDeviceStateIdle) {
-        if (last_status_update_time_ + std::chrono::seconds(10) < std::chrono::system_clock::now()) {
-            // Set status to clock "HH:MM"
-            time_t now = time(NULL);
-            struct tm* tm = localtime(&now);
-            // Check if the we have already set the time
-            if (tm->tm_year >= 2025 - 1900) {
-                char time_str[16];
-                strftime(time_str, sizeof(time_str), "%H:%M  ", tm);
-                SetStatus(time_str);
-            } else {
-                ESP_LOGW(TAG, "System time is not set, tm_year: %d", tm->tm_year);
-            }
-        }
-    }
+    // // Update time
+    // if (app.GetDeviceState() == kDeviceStateIdle) {
+    //     if (last_status_update_time_ + std::chrono::seconds(10) < std::chrono::system_clock::now()) {
+    //         // Set status to clock "HH:MM"
+    //         time_t now = time(NULL);
+    //         struct tm* tm = localtime(&now);
+    //         // Check if the we have already set the time
+    //         if (tm->tm_year >= 2025 - 1900) {
+    //             char time_str[16];
+    //             strftime(time_str, sizeof(time_str), "%H:%M  ", tm);
+    //             SetStatus(time_str);
+    //         } else {
+    //             ESP_LOGW(TAG, "System time is not set, tm_year: %d", tm->tm_year);
+    //         }
+    //     }
+    // }
 
-    esp_pm_lock_acquire(pm_lock_);
-    // 更新电池图标
-    int battery_level;
-    bool charging, discharging;
-    const char* icon = nullptr;
-    if (board.GetBatteryLevel(battery_level, charging, discharging)) {
-        if (charging) {
-            icon = FONT_AWESOME_BATTERY_CHARGING;
-        } else {
-            const char* levels[] = {
-                FONT_AWESOME_BATTERY_EMPTY, // 0-19%
-                FONT_AWESOME_BATTERY_1,    // 20-39%
-                FONT_AWESOME_BATTERY_2,    // 40-59%
-                FONT_AWESOME_BATTERY_3,    // 60-79%
-                FONT_AWESOME_BATTERY_FULL, // 80-99%
-                FONT_AWESOME_BATTERY_FULL, // 100%
-            };
-            icon = levels[battery_level / 20];
-        }
-        DisplayLockGuard lock(this);
-        if (battery_label_ != nullptr && battery_icon_ != icon) {
-            battery_icon_ = icon;
-            lv_label_set_text(battery_label_, battery_icon_);
-        }
+    // esp_pm_lock_acquire(pm_lock_);
+    // // 更新电池图标
+    // int battery_level;
+    // bool charging, discharging;
+    // const char* icon = nullptr;
+    // if (board.GetBatteryLevel(battery_level, charging, discharging)) {
+    //     if (charging) {
+    //         icon = FONT_AWESOME_BATTERY_CHARGING;
+    //     } else {
+    //         const char* levels[] = {
+    //             FONT_AWESOME_BATTERY_EMPTY, // 0-19%
+    //             FONT_AWESOME_BATTERY_1,    // 20-39%
+    //             FONT_AWESOME_BATTERY_2,    // 40-59%
+    //             FONT_AWESOME_BATTERY_3,    // 60-79%
+    //             FONT_AWESOME_BATTERY_FULL, // 80-99%
+    //             FONT_AWESOME_BATTERY_FULL, // 100%
+    //         };
+    //         icon = levels[battery_level / 20];
+    //     }
+    //     DisplayLockGuard lock(this);
+    //     if (battery_label_ != nullptr && battery_icon_ != icon) {
+    //         battery_icon_ = icon;
+    //         lv_label_set_text(battery_label_, battery_icon_);
+    //     }
 
-        if (low_battery_popup_ != nullptr) {
-            if (strcmp(icon, FONT_AWESOME_BATTERY_EMPTY) == 0 && discharging) {
-                if (lv_obj_has_flag(low_battery_popup_, LV_OBJ_FLAG_HIDDEN)) { // 如果低电量提示框隐藏,则显示
-                    lv_obj_clear_flag(low_battery_popup_, LV_OBJ_FLAG_HIDDEN);
-                    app.PlaySound(Lang::Sounds::P3_LOW_BATTERY);
-                }
-            } else {
-                // Hide the low battery popup when the battery is not empty
-                if (!lv_obj_has_flag(low_battery_popup_, LV_OBJ_FLAG_HIDDEN)) { // 如果低电量提示框显示,则隐藏
-                    lv_obj_add_flag(low_battery_popup_, LV_OBJ_FLAG_HIDDEN);
-                }
-            }
-        }
-    }
+    //     if (low_battery_popup_ != nullptr) {
+    //         if (strcmp(icon, FONT_AWESOME_BATTERY_EMPTY) == 0 && discharging) {
+    //             if (lv_obj_has_flag(low_battery_popup_, LV_OBJ_FLAG_HIDDEN)) { // 如果低电量提示框隐藏,则显示
+    //                 lv_obj_clear_flag(low_battery_popup_, LV_OBJ_FLAG_HIDDEN);
+    //                 app.PlaySound(Lang::Sounds::P3_LOW_BATTERY);
+    //             }
+    //         } else {
+    //             // Hide the low battery popup when the battery is not empty
+    //             if (!lv_obj_has_flag(low_battery_popup_, LV_OBJ_FLAG_HIDDEN)) { // 如果低电量提示框显示,则隐藏
+    //                 lv_obj_add_flag(low_battery_popup_, LV_OBJ_FLAG_HIDDEN);
+    //             }
+    //         }
+    //     }
+    // }
 
-    // 每 10 秒更新一次网络图标
-    static int seconds_counter = 0;
-    if (update_all || seconds_counter++ % 10 == 0) {
-        // 升级固件时,不读取 4G 网络状态,避免占用 UART 资源
-        auto device_state = Application::GetInstance().GetDeviceState();
-        static const std::vector<DeviceState> allowed_states = {
-            kDeviceStateIdle,
-            kDeviceStateStarting,
-            kDeviceStateWifiConfiguring,
-            kDeviceStateListening,
-            kDeviceStateActivating,
-        };
-        if (std::find(allowed_states.begin(), allowed_states.end(), device_state) != allowed_states.end()) {
-            icon = board.GetNetworkStateIcon();
-            if (network_label_ != nullptr && icon != nullptr && network_icon_ != icon) {
-                DisplayLockGuard lock(this);
-                network_icon_ = icon;
-                lv_label_set_text(network_label_, network_icon_);
-            }
-        }
-    }
+    // // 每 10 秒更新一次网络图标
+    // static int seconds_counter = 0;
+    // if (update_all || seconds_counter++ % 10 == 0) {
+    //     // 升级固件时,不读取 4G 网络状态,避免占用 UART 资源
+    //     auto device_state = Application::GetInstance().GetDeviceState();
+    //     static const std::vector<DeviceState> allowed_states = {
+    //         kDeviceStateIdle,
+    //         kDeviceStateStarting,
+    //         kDeviceStateWifiConfiguring,
+    //         kDeviceStateListening,
+    //         kDeviceStateActivating,
+    //     };
+    //     if (std::find(allowed_states.begin(), allowed_states.end(), device_state) != allowed_states.end()) {
+    //         icon = board.GetNetworkStateIcon();
+    //         if (network_label_ != nullptr && icon != nullptr && network_icon_ != icon) {
+    //             DisplayLockGuard lock(this);
+    //             network_icon_ = icon;
+    //             lv_label_set_text(network_label_, network_icon_);
+    //         }
+    //     }
+    // }
 
-    esp_pm_lock_release(pm_lock_);
+    // esp_pm_lock_release(pm_lock_);
 }
 
 
 void Display::SetEmotion(const char* emotion) {
-    struct Emotion {
-        const char* icon;
-        const char* text;
-    };
+    // struct Emotion {
+    //     const char* icon;
+    //     const char* text;
+    // };
 
-    static const std::vector<Emotion> emotions = {
-        {FONT_AWESOME_EMOJI_NEUTRAL, "neutral"},
-        {FONT_AWESOME_EMOJI_HAPPY, "happy"},
-        {FONT_AWESOME_EMOJI_LAUGHING, "laughing"},
-        {FONT_AWESOME_EMOJI_FUNNY, "funny"},
-        {FONT_AWESOME_EMOJI_SAD, "sad"},
-        {FONT_AWESOME_EMOJI_ANGRY, "angry"},
-        {FONT_AWESOME_EMOJI_CRYING, "crying"},
-        {FONT_AWESOME_EMOJI_LOVING, "loving"},
-        {FONT_AWESOME_EMOJI_EMBARRASSED, "embarrassed"},
-        {FONT_AWESOME_EMOJI_SURPRISED, "surprised"},
-        {FONT_AWESOME_EMOJI_SHOCKED, "shocked"},
-        {FONT_AWESOME_EMOJI_THINKING, "thinking"},
-        {FONT_AWESOME_EMOJI_WINKING, "winking"},
-        {FONT_AWESOME_EMOJI_COOL, "cool"},
-        {FONT_AWESOME_EMOJI_RELAXED, "relaxed"},
-        {FONT_AWESOME_EMOJI_DELICIOUS, "delicious"},
-        {FONT_AWESOME_EMOJI_KISSY, "kissy"},
-        {FONT_AWESOME_EMOJI_CONFIDENT, "confident"},
-        {FONT_AWESOME_EMOJI_SLEEPY, "sleepy"},
-        {FONT_AWESOME_EMOJI_SILLY, "silly"},
-        {FONT_AWESOME_EMOJI_CONFUSED, "confused"}
-    };
+    // static const std::vector<Emotion> emotions = {
+    //     {FONT_AWESOME_EMOJI_NEUTRAL, "neutral"},
+    //     {FONT_AWESOME_EMOJI_HAPPY, "happy"},
+    //     {FONT_AWESOME_EMOJI_LAUGHING, "laughing"},
+    //     {FONT_AWESOME_EMOJI_FUNNY, "funny"},
+    //     {FONT_AWESOME_EMOJI_SAD, "sad"},
+    //     {FONT_AWESOME_EMOJI_ANGRY, "angry"},
+    //     {FONT_AWESOME_EMOJI_CRYING, "crying"},
+    //     {FONT_AWESOME_EMOJI_LOVING, "loving"},
+    //     {FONT_AWESOME_EMOJI_EMBARRASSED, "embarrassed"},
+    //     {FONT_AWESOME_EMOJI_SURPRISED, "surprised"},
+    //     {FONT_AWESOME_EMOJI_SHOCKED, "shocked"},
+    //     {FONT_AWESOME_EMOJI_THINKING, "thinking"},
+    //     {FONT_AWESOME_EMOJI_WINKING, "winking"},
+    //     {FONT_AWESOME_EMOJI_COOL, "cool"},
+    //     {FONT_AWESOME_EMOJI_RELAXED, "relaxed"},
+    //     {FONT_AWESOME_EMOJI_DELICIOUS, "delicious"},
+    //     {FONT_AWESOME_EMOJI_KISSY, "kissy"},
+    //     {FONT_AWESOME_EMOJI_CONFIDENT, "confident"},
+    //     {FONT_AWESOME_EMOJI_SLEEPY, "sleepy"},
+    //     {FONT_AWESOME_EMOJI_SILLY, "silly"},
+    //     {FONT_AWESOME_EMOJI_CONFUSED, "confused"}
+    // };
     
-    // 查找匹配的表情
-    std::string_view emotion_view(emotion);
-    auto it = std::find_if(emotions.begin(), emotions.end(),
-        [&emotion_view](const Emotion& e) { return e.text == emotion_view; });
+    // // 查找匹配的表情
+    // std::string_view emotion_view(emotion);
+    // auto it = std::find_if(emotions.begin(), emotions.end(),
+    //     [&emotion_view](const Emotion& e) { return e.text == emotion_view; });
     
-    DisplayLockGuard lock(this);
-    if (emotion_label_ == nullptr) {
-        return;
-    }
+    // DisplayLockGuard lock(this);
+    // if (emotion_label_ == nullptr) {
+    //     return;
+    // }
 
-    // 如果找到匹配的表情就显示对应图标,否则显示默认的neutral表情
-    if (it != emotions.end()) {
-        lv_label_set_text(emotion_label_, it->icon);
-    } else {
-        lv_label_set_text(emotion_label_, FONT_AWESOME_EMOJI_NEUTRAL);
-    }
+    // // 如果找到匹配的表情就显示对应图标,否则显示默认的neutral表情
+    // if (it != emotions.end()) {
+    //     lv_label_set_text(emotion_label_, it->icon);
+    // } else {
+    //     lv_label_set_text(emotion_label_, FONT_AWESOME_EMOJI_NEUTRAL);
+    // }
 }
 
 void Display::SetIcon(const char* icon) {
-    DisplayLockGuard lock(this);
-    if (emotion_label_ == nullptr) {
-        return;
-    }
-    lv_label_set_text(emotion_label_, icon);
+    // DisplayLockGuard lock(this);
+    // if (emotion_label_ == nullptr) {
+    //     return;
+    // }
+    // lv_label_set_text(emotion_label_, icon);
 }
 
 void Display::SetPreviewImage(const lv_img_dsc_t* image) {
@@ -256,25 +256,25 @@ void Display::SetPreviewImage(const lv_img_dsc_t* image) {
 }
 
 void Display::SetChatMessage(const char* role, const char* content) {
-    DisplayLockGuard lock(this);
-    if (chat_message_label_ == nullptr) {
-        return;
-    }
-    lv_label_set_text(chat_message_label_, content);
+    // DisplayLockGuard lock(this);
+    // if (chat_message_label_ == nullptr) {
+    //     return;
+    // }
+    // lv_label_set_text(chat_message_label_, content);
 }
 
 void Display::SetTheme(const std::string& theme_name) {
-    current_theme_name_ = theme_name;
-    Settings settings("display", true);
-    settings.SetString("theme", theme_name);
+//     current_theme_name_ = theme_name;
+//     Settings settings("display", true);
+//     settings.SetString("theme", theme_name);
 }
 
 void Display::ShowStandbyScreen(bool show) {
-    if (show) {
-        SetChatMessage("system", "");
-        SetEmotion("sleepy");
-    } else {
-        SetChatMessage("system", "");
-        SetEmotion("neutral");
-    }
+//     if (show) {
+//         SetChatMessage("system", "");
+//         SetEmotion("sleepy");
+//     } else {
+//         SetChatMessage("system", "");
+//         SetEmotion("neutral");
+//     }
 }