Move fonts / assets definition from main/boards to CMakeLists.txt (#1174)

* update surfer-c3-1.14tft font size

* Move fonts / assets definition from main/boards to CMakeLists.txt

* fix c3 compiling errors

---------

Co-authored-by: Xiaoxia <terrence.huang@tenclass.com>
This commit is contained in:
Xiaoxia
2025-09-08 17:30:18 +08:00
committed by GitHub
parent 897239e997
commit d04b08133f
111 changed files with 1193 additions and 1673 deletions

View File

@@ -64,14 +64,18 @@ const ThemeColors LIGHT_THEME = {
.low_battery = LIGHT_LOW_BATTERY_COLOR
};
LV_FONT_DECLARE(LVGL_TEXT_FONT);
LV_FONT_DECLARE(LVGL_ICON_FONT);
LV_FONT_DECLARE(font_awesome_30_4);
LcdDisplay::LcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, int width, int height, DisplayStyle style)
LcdDisplay::LcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, int width, int height)
: panel_io_(panel_io), panel_(panel) {
width_ = width;
height_ = height;
style_ = style;
style_ = {
.text_font = &LVGL_TEXT_FONT,
.icon_font = &LVGL_ICON_FONT,
};
// Load theme from settings
Settings settings("display", false);
@@ -99,9 +103,8 @@ LcdDisplay::LcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_
}
SpiLcdDisplay::SpiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy,
DisplayStyle style)
: LcdDisplay(panel_io, panel, width, height, style) {
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy)
: LcdDisplay(panel_io, panel, width, height) {
// draw white
std::vector<uint16_t> buffer(width_, 0xFFFF);
@@ -176,9 +179,8 @@ SpiLcdDisplay::SpiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_h
// RGB LCD实现
RgbLcdDisplay::RgbLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
int width, int height, int offset_x, int offset_y,
bool mirror_x, bool mirror_y, bool swap_xy,
DisplayStyle style)
: LcdDisplay(panel_io, panel, width, height, style) {
bool mirror_x, bool mirror_y, bool swap_xy)
: LcdDisplay(panel_io, panel, width, height) {
// draw white
std::vector<uint16_t> buffer(width_, 0xFFFF);
@@ -238,9 +240,8 @@ RgbLcdDisplay::RgbLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_h
MipiLcdDisplay::MipiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
int width, int height, int offset_x, int offset_y,
bool mirror_x, bool mirror_y, bool swap_xy,
DisplayStyle style)
: LcdDisplay(panel_io, panel, width, height, style) {
bool mirror_x, bool mirror_y, bool swap_xy)
: LcdDisplay(panel_io, panel, width, height) {
// Set the display to on
ESP_LOGI(TAG, "Turning display on");

View File

@@ -49,7 +49,7 @@ protected:
protected:
// 添加protected构造函数
LcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, int width, int height, DisplayStyle style);
LcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, int width, int height);
public:
~LcdDisplay();
@@ -68,8 +68,7 @@ class SpiLcdDisplay : public LcdDisplay {
public:
SpiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
int width, int height, int offset_x, int offset_y,
bool mirror_x, bool mirror_y, bool swap_xy,
DisplayStyle style);
bool mirror_x, bool mirror_y, bool swap_xy);
};
// RGB LCD显示器
@@ -77,8 +76,7 @@ class RgbLcdDisplay : public LcdDisplay {
public:
RgbLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
int width, int height, int offset_x, int offset_y,
bool mirror_x, bool mirror_y, bool swap_xy,
DisplayStyle style);
bool mirror_x, bool mirror_y, bool swap_xy);
};
// MIPI LCD显示器
@@ -86,8 +84,7 @@ class MipiLcdDisplay : public LcdDisplay {
public:
MipiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
int width, int height, int offset_x, int offset_y,
bool mirror_x, bool mirror_y, bool swap_xy,
DisplayStyle style);
bool mirror_x, bool mirror_y, bool swap_xy);
};
#endif // LCD_DISPLAY_H

View File

@@ -11,14 +11,19 @@
#define TAG "OledDisplay"
LV_FONT_DECLARE(LVGL_TEXT_FONT);
LV_FONT_DECLARE(LVGL_ICON_FONT);
LV_FONT_DECLARE(font_awesome_30_1);
OledDisplay::OledDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
int width, int height, bool mirror_x, bool mirror_y, DisplayStyle style)
int width, int height, bool mirror_x, bool mirror_y)
: panel_io_(panel_io), panel_(panel) {
width_ = width;
height_ = height;
style_ = style;
style_ = {
.text_font = &LVGL_TEXT_FONT,
.icon_font = &LVGL_ICON_FONT,
};
ESP_LOGI(TAG, "Initialize LVGL");
lvgl_port_cfg_t port_cfg = ESP_LVGL_PORT_INIT_CONFIG();

View File

@@ -27,8 +27,7 @@ private:
void SetupUI_128x32();
public:
OledDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, int width, int height, bool mirror_x, bool mirror_y,
DisplayStyle style);
OledDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, int width, int height, bool mirror_x, bool mirror_y);
~OledDisplay();
virtual void SetChatMessage(const char* role, const char* content) override;