fix magiclick color

This commit is contained in:
Terrence
2025-01-24 00:21:42 +08:00
parent d75b01984c
commit 7335362bc1
3 changed files with 9 additions and 25 deletions

View File

@@ -50,6 +50,8 @@ public:
: LcdDisplay(io_handle, panel_handle, backlight_pin, backlight_output_invert,
width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy,
&font_puhui_30_4, &font_awesome_30_4) {
DisplayLockGuard lock(this);
// 由于屏幕是带圆角的,所以状态栏需要增加左右内边距
lv_obj_set_style_pad_left(status_bar_, LV_HOR_RES * 0.1, 0);
lv_obj_set_style_pad_right(status_bar_, LV_HOR_RES * 0.1, 0);

View File

@@ -26,14 +26,9 @@ public:
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy)
: LcdDisplay(panel_io, panel, backlight_pin, backlight_output_invert,
width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy,
&font_puhui_16_4, &font_awesome_16_4) {}
&font_puhui_16_4, &font_awesome_16_4) {
virtual void SetupUI() override {
DisplayLockGuard lock(this);
// 调用父类的 SetupUI 来设置基本布局
LcdDisplay::SetupUI();
// 只需要覆盖颜色相关的样式
auto screen = lv_disp_get_scr_act(lv_disp_get_default());
lv_obj_set_style_text_color(screen, lv_color_black(), 0);
@@ -54,9 +49,6 @@ public:
lv_obj_set_style_border_width(content_, 0, 0);
lv_obj_set_style_text_color(emotion_label_, lv_color_white(), 0);
lv_obj_set_style_text_color(chat_message_label_, lv_color_white(), 0);
// 设置布局
lv_obj_set_flex_align(content_, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_SPACE_EVENLY); // 子对象顶部对齐,左右居中对齐,等距分布
}
};

View File

@@ -27,14 +27,9 @@ public:
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy)
: LcdDisplay(panel_io, panel, backlight_pin, backlight_output_invert,
width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy,
&font_puhui_16_4, &font_awesome_16_4) {}
&font_puhui_16_4, &font_awesome_16_4) {
virtual void SetupUI() override {
DisplayLockGuard lock(this);
// 调用父类的 SetupUI 来设置基本布局
LcdDisplay::SetupUI();
// 只需要覆盖颜色相关的样式
auto screen = lv_disp_get_scr_act(lv_disp_get_default());
lv_obj_set_style_text_color(screen, lv_color_black(), 0);
@@ -84,10 +79,9 @@ private:
void InitializeButtons() {
boot_button_.OnClick([this]() {
auto& app = Application::GetInstance();
if (app.GetDeviceState() == kDeviceStateUnknown && !WifiStation::GetInstance().IsConnected()) {
if (app.GetDeviceState() == kDeviceStateStarting && !WifiStation::GetInstance().IsConnected()) {
ResetWifiConfiguration();
}
// app.ToggleChatState();
});
boot_button_.OnPressDown([this]() {
Application::GetInstance().StartListening();
@@ -95,7 +89,7 @@ private:
boot_button_.OnPressUp([this]() {
Application::GetInstance().StopListening();
});
}
}
void InitializeSpi() {
spi_bus_config_t buscfg = {};
@@ -106,7 +100,7 @@ private:
buscfg.quadhd_io_num = GPIO_NUM_NC;
buscfg.max_transfer_sz = DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t);
ESP_ERROR_CHECK(spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO));
}
}
void InitializeNv3023Display(){
esp_lcd_panel_io_handle_t panel_io = nullptr;
@@ -160,8 +154,8 @@ public:
}
virtual Led* GetLed() override {
static SingleLed led_strip(BUILTIN_LED_GPIO);
return &led_strip;
static SingleLed led(BUILTIN_LED_GPIO);
return &led;
}
virtual AudioCodec* GetAudioCodec() override {
@@ -174,10 +168,6 @@ public:
virtual Display* GetDisplay() override {
return display_;
}
virtual bool GetBatteryLevel(int &level, bool& charging) override {
return false;
}
};
DECLARE_BOARD(magiclick_c3);