Skip to content

Commit

Permalink
Merge branch 'feat/refactor_assets' into 'master'
Browse files Browse the repository at this point in the history
feat(assets): refactor assets and update stylesheet

Closes #12

See merge request ae_group/esp-brookesia!12
  • Loading branch information
Lzw655 committed Oct 25, 2024
2 parents 3a87930 + 229b9d6 commit 7586c09
Show file tree
Hide file tree
Showing 320 changed files with 8,130 additions and 28,416 deletions.
12 changes: 6 additions & 6 deletions .build-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
# Componet test_apps
test_apps:
enable:
- if: IDF_TARGET in ["esp32s2", "esp32s3", "esp32p4", "esp32c3", "esp32c6"]
- if: IDF_TARGET in ["esp32s3", "esp32p4"]

# Examples
examples/esp_brookesia_phone_m5stace_core_s3:
examples/esp_idf/esp_brookesia_phone_m5stace_core_s3:
enable:
- if: IDF_TARGET in ["esp32s3"]

examples/esp_brookesia_phone_p4_function_ev_board:
examples/esp_idf/esp_brookesia_phone_p4_function_ev_board:
enable:
- if: IDF_TARGET in ["esp32p4"]

examples/esp_brookesia_phone_s3_box:
examples/esp_idf/esp_brookesia_phone_s3_box:
enable:
- if: IDF_TARGET in ["esp32s3"]

examples/esp_brookesia_phone_s3_box_3:
examples/esp_idf/esp_brookesia_phone_s3_box_3:
enable:
- if: IDF_TARGET in ["esp32s3"]

examples/esp_brookesia_phone_s3_lcd_ev_board:
examples/esp_idf/esp_brookesia_phone_s3_lcd_ev_board:
enable:
- if: IDF_TARGET in ["esp32s3"]
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# ChangeLog

## v0.4.1 - 2024-10-25

### Enhancements:

* feat(assets): refactor assets and update stylesheet
* feat(phone): add default image for app launcher in stylesheet
* feat(phone): enable recents screen hide when no snapshot by default
* feat(widgets): avoid click the next page icon when the app launcher scroll is not finished

### Bugfixes:

* fix(examples): fix arduino build error

## v0.4.0 - 2024-10-23

### Enhancements:
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ file(GLOB_RECURSE APP_EXAMPLES_PHONE_SRCS_CPP ${APP_EXAMPLES_PHONE_SRC_DIR}/*.cp
list(APPEND SRCS_C ${APP_EXAMPLES_PHONE_SRCS_C})
list(APPEND SRCS_CPP ${APP_EXAMPLES_PHONE_SRCS_CPP})

set(ASSETS_SRC_DIR ${PROJ_SRC_DIR}/assets)
file(GLOB_RECURSE ASSETS_SRC_C ${ASSETS_SRC_DIR}/*.c)
list(APPEND SRCS_C ${ASSETS_SRC_C})

set(CORE_SRC_DIR ${PROJ_SRC_DIR}/core)
file(GLOB_RECURSE CORE_SRCS_C ${CORE_SRC_DIR}/*.c)
file(GLOB_RECURSE CORE_SRCS_CPP ${CORE_SRC_DIR}/*.cpp)
list(APPEND SRCS_C ${CORE_SRCS_C})
list(APPEND SRCS_CPP ${CORE_SRCS_CPP})

set(FONT_SRC_DIR ${PROJ_SRC_DIR}/fonts)
file(GLOB_RECURSE FONTS_SRCS_C ${FONT_SRC_DIR}/*.c)
list(APPEND SRCS_C ${FONTS_SRCS_C})

set(PHONE_SRC_DIR ${PROJ_SRC_DIR}/systems/phone)
file(GLOB_RECURSE PHONE_SRCS_C ${PHONE_SRC_DIR}/*.c)
file(GLOB_RECURSE PHONE_SRCS_CPP ${PHONE_SRC_DIR}/*.cpp)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,20 @@
#define EXAMPLE_SHOW_MEM_INFO (1)

/* Try using a stylesheet that corresponds to the resolution */
#if (ESP_PANEL_LCD_WIDTH == 1024) && (ESP_PANEL_LCD_HEIGHT == 600)
#define EXAMPLE_USE_STYLESHEET (1)
static const ESP_Brookesia_PhoneStylesheet_t stylesheet = ESP_BROOKESIA_PHONE_1024_600_DARK_STYLESHEET();
#elif (ESP_PANEL_LCD_WIDTH == 800) && (ESP_PANEL_LCD_HEIGHT == 480)
#define EXAMPLE_USE_STYLESHEET (1)
static const ESP_Brookesia_PhoneStylesheet_t stylesheet = ESP_BROOKESIA_PHONE_800_480_DARK_STYLESHEET();
#if (ESP_PANEL_LCD_WIDTH == 320) && (ESP_PANEL_LCD_HEIGHT == 240)
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_320_240_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 320) && (ESP_PANEL_LCD_HEIGHT == 480)
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_320_480_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 480) && (ESP_PANEL_LCD_HEIGHT == 480)
#define EXAMPLE_USE_STYLESHEET (1)
static const ESP_Brookesia_PhoneStylesheet_t stylesheet = ESP_BROOKESIA_PHONE_480_480_DARK_STYLESHEET();
#elif (ESP_PANEL_LCD_WIDTH == 320) && (ESP_PANEL_LCD_HEIGHT == 240)
#define EXAMPLE_USE_STYLESHEET (1)
static const ESP_Brookesia_PhoneStylesheet_t stylesheet = ESP_BROOKESIA_PHONE_320_240_DARK_STYLESHEET();
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_480_480_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 800) && (ESP_PANEL_LCD_HEIGHT == 480)
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_800_480_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 800) && (ESP_PANEL_LCD_HEIGHT == 1280)
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_800_1280_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 1024) && (ESP_PANEL_LCD_HEIGHT == 600)
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_1024_600_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 1280) && (ESP_PANEL_LCD_HEIGHT == 800)
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_1280_800_DARK_STYLESHEET()
#endif

static char buffer[128]; /* Make sure buffer is enough for `sprintf` */
Expand Down Expand Up @@ -114,26 +116,31 @@ void setup()
phone = new ESP_Brookesia_Phone();
ESP_BROOKESIA_CHECK_NULL_EXIT(phone, "Create phone failed");

#ifdef EXAMPLE_USE_STYLESHEET
#ifdef EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET
/* Add external stylesheet and activate it */
Serial.printf("Using stylesheet (%s)\n", stylesheet.core.name);
ESP_Brookesia_PhoneStylesheet_t *stylesheet = new ESP_Brookesia_PhoneStylesheet_t EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET();
ESP_BROOKESIA_CHECK_NULL_EXIT(stylesheet, "Create stylesheet failed");

Serial.printf("Using stylesheet (%s)\n", stylesheet->core.name);
ESP_BROOKESIA_CHECK_FALSE_EXIT(phone->addStylesheet(stylesheet), "Add stylesheet failed");
ESP_BROOKESIA_CHECK_FALSE_EXIT(phone->activateStylesheet(stylesheet), "Activate stylesheet failed");
delete stylesheet;
#endif

/* Configure and begin the phone */
phone->registerLvLockCallback((ESP_Brookesia_LvLockCallback_t)(lvgl_port_lock), -1);
phone->registerLvUnlockCallback((ESP_Brookesia_LvUnlockCallback_t)(lvgl_port_unlock));
ESP_BROOKESIA_CHECK_FALSE_EXIT(phone->begin(), "Begin phone failed");
// ESP_BROOKESIA_CHECK_FALSE_EXIT(phone->getCoreHome().showContainerBorder(), "Show container border failed");

/* Install apps */
bool enable_navigation_bar = phone->getStylesheet()->home.flags.enable_navigation_bar;
PhoneAppSimpleConf *app_simple_conf = new PhoneAppSimpleConf(true, enable_navigation_bar);
PhoneAppSimpleConf *app_simple_conf = new PhoneAppSimpleConf();
ESP_BROOKESIA_CHECK_NULL_EXIT(app_simple_conf, "Create app simple conf failed");
ESP_BROOKESIA_CHECK_FALSE_EXIT((phone->installApp(app_simple_conf) >= 0), "Install app simple conf failed");
PhoneAppComplexConf *app_complex_conf = new PhoneAppComplexConf(true, enable_navigation_bar);
PhoneAppComplexConf *app_complex_conf = new PhoneAppComplexConf();
ESP_BROOKESIA_CHECK_NULL_EXIT(app_complex_conf, "Create app complex conf failed");
ESP_BROOKESIA_CHECK_FALSE_EXIT((phone->installApp(app_complex_conf) >= 0), "Install app complex conf failed");
PhoneAppSquareline *app_squareline = new PhoneAppSquareline(true, enable_navigation_bar);
PhoneAppSquareline *app_squareline = new PhoneAppSquareline();
ESP_BROOKESIA_CHECK_NULL_EXIT(app_squareline, "Create app squareline failed");
ESP_BROOKESIA_CHECK_FALSE_EXIT((phone->installApp(app_squareline) >= 0), "Install app squareline failed");

Expand All @@ -160,13 +167,18 @@ void loop()
heap_caps_get_largest_free_block(MALLOC_CAP_SPIRAM), external_free, external_total);
Serial.printf("%s", buffer);

lvgl_port_lock(-1);
/**
* The `lockLv()` and `unlockLv()` functions are used to lock and unlock the LVGL task.
* They are registered by the `registerLvLockCallback()` and `registerLvUnlockCallback()` functions.
*/
phone->lockLv();
// Update memory label on "Recents Screen"
if (!phone->getHome().getRecentsScreen()->setMemoryLabel(internal_free / 1024, internal_total / 1024,
external_free / 1024, external_total / 1024)) {
if (!phone->getHome().getRecentsScreen()->setMemoryLabel(
internal_free / 1024, internal_total / 1024, external_free / 1024, external_total / 1024
)) {
ESP_BROOKESIA_LOGE("Set memory label failed");
}
lvgl_port_unlock();
phone->unlockLv();
#endif

vTaskDelay(pdMS_TO_TICKS(2000));
Expand All @@ -183,7 +195,10 @@ static void onClockUpdateTimerCallback(struct _lv_timer_t *t)
localtime_r(&now, &timeinfo);
is_time_pm = (timeinfo.tm_hour >= 12);

/* Since this callback is called from LVGL task, it is safe to operate LVGL */
// Update clock on "Status Bar"
ESP_BROOKESIA_CHECK_FALSE_EXIT(phone->getHome().getStatusBar()->setClock(timeinfo.tm_hour, timeinfo.tm_min, is_time_pm),
"Refresh status bar failed");
ESP_BROOKESIA_CHECK_FALSE_EXIT(
phone->getHome().getStatusBar()->setClock(timeinfo.tm_hour, timeinfo.tm_min, is_time_pm),
"Refresh status bar failed"
);
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@
#define ESP_BROOKESIA_SQ1_4_1_LV8_3_11 // | 1.4.1 | 8.3.11 |
#endif /* ESP_BROOKESIA_SQUARELINE_USE_INTERNAL_UI_HELPERS */

/**
* Use the internal general APIs of "ui_comp.c" and "ui_comp.h" instead of the ones exported from Squareline Studio.
* 1: enable, 0: disable
*
* This configuration is to avoid function redefinition errors caused by multiple UIs exported from Squareline Studio
* that include duplicate APIs of "ui_comp.c" and "ui_comp.h".
*
*/
#define ESP_BROOKESIA_SQUARELINE_USE_INTERNAL_UI_COMP (1)

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////// File Version ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -116,5 +126,5 @@
*
*/
#define ESP_BROOKESIA_CONF_FILE_VER_MAJOR 0
#define ESP_BROOKESIA_CONF_FILE_VER_MINOR 1
#define ESP_BROOKESIA_CONF_FILE_VER_MINOR 2
#define ESP_BROOKESIA_CONF_FILE_VER_PATCH 0
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 7586c09

Please sign in to comment.