Skip to content

Commit

Permalink
Merge pull request #2 from esp-arduino-libs/feat/update_esp_ui
Browse files Browse the repository at this point in the history
feat(esp-ui): update
feat(esp-ui-stylesheet): add esp-ui-phone_320_240_stylesheet
  • Loading branch information
Lzw655 authored Aug 27, 2024
2 parents aed9281 + 608bcb5 commit e8015dd
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ build/
# VSCode
.vscode/

# MacOS
.DS_Store

# Ignore files generated by bear
compile_commands.events.json
compile_commands.json
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@
path = components/esp-ui-stylesheet/esp-ui-phone_1024_600_stylesheet
url = https://github.com/esp-arduino-libs/esp-ui-phone_1024_600_stylesheet.git
branch = master
[submodule "components/esp-ui-stylesheet/esp-ui-phone_320_240_stylesheet"]
path = components/esp-ui-stylesheet/esp-ui-phone_320_240_stylesheet
url = https://github.com/esp-arduino-libs/esp-ui-phone_320_240_stylesheet.git
branch = master
2 changes: 1 addition & 1 deletion components/esp-ui
17 changes: 8 additions & 9 deletions components/esp_ui_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////// Debug /////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Assert when check result failed. 0: diable, 1: enable */
/* Assert when check result failed. 0: disable, 1: enable */
#define ESP_UI_CHECK_RESULT_ASSERT (0)

/**
Expand All @@ -30,7 +30,7 @@
* - ESP_UI_LOG_LEVEL_NONE: No log output (least verbose)
*
*/
#define ESP_UI_LOG_LEVEL (ESP_UI_LOG_LEVEL_INFO)
#define ESP_UI_LOG_LEVEL (ESP_UI_LOG_LEVEL_DEBUG)

/* Enable debug logs for modules */
#define ESP_UI_LOG_ENABLE_DEBUG_CORE (1)
Expand All @@ -46,10 +46,10 @@
// Widgets
#if ESP_UI_LOG_ENABLE_DEBUG_WIDGETS
#define ESP_UI_LOG_ENABLE_DEBUG_WIDGETS_APP_LAUNCHER (1)
#define ESP_UI_LOG_ENABLE_DEBUG_WIDGETS_RECENTS_SCREEN (1)
#define ESP_UI_LOG_ENABLE_DEBUG_WIDGETS_GESTURE (1)
#define ESP_UI_LOG_ENABLE_DEBUG_WIDGETS_NAVIGATION (1)
#define ESP_UI_LOG_ENABLE_DEBUG_WIDGETS_STATUS_BAR (1)
#define ESP_UI_LOG_ENABLE_DEBUG_WIDGETS_RECENTS_SCREEN (1)
#define ESP_UI_LOG_ENABLE_DEBUG_WIDGETS_GESTURE (0)
#define ESP_UI_LOG_ENABLE_DEBUG_WIDGETS_NAVIGATION (1)
#define ESP_UI_LOG_ENABLE_DEBUG_WIDGETS_STATUS_BAR (1)
#endif
// Phone
#if ESP_UI_LOG_ENABLE_DEBUG_PHONE
Expand All @@ -62,7 +62,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////// Memory /////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define ESP_UI_MEMORY_USE_CUSTOM (0)
#define ESP_UI_MEMORY_USE_CUSTOM (0)
#if ESP_UI_MEMORY_USE_CUSTOM == 0
#define ESP_UI_MEMORY_INCLUDE <stdlib.h>
#define ESP_UI_MEMORY_MALLOC malloc
Expand Down Expand Up @@ -91,8 +91,7 @@
* configured version of LVGL. (If multiple options are uncommented, a compilation error will occur)
*
*/
// | Squareline | LVGL |
// #define ESP_UI_SQ1_3_4_LV8_2_0 // | 1.3.4 | 8.2.0 |
// | Squareline | LVGL |
// #define ESP_UI_SQ1_3_4_LV8_3_3 // | 1.3.4 | 8.3.3 |
// #define ESP_UI_SQ1_3_4_LV8_3_4 // | 1.3.4 | 8.3.4 |
// #define ESP_UI_SQ1_3_4_LV8_3_6 // | 1.3.4 | 8.3.6 |
Expand Down
4 changes: 2 additions & 2 deletions components/lv_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
*=========================*/

/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
#define LV_MEM_CUSTOM 1
#define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
#define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/
#define LV_MEM_SIZE (512 * 1024U) /*[bytes]*/

/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
#define LV_MEM_ADR 0 /*0: unused*/
Expand Down
3 changes: 2 additions & 1 deletion esp-ui-simulator_vscode.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"*.cpp": "cpp",
"array": "cpp",
"string": "cpp",
"string_view": "cpp"
"string_view": "cpp",
"unordered_map": "cpp"
},
},
// tasks.json section
Expand Down
18 changes: 13 additions & 5 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
#elif (DISP_HOR_RES == 480) && (DISP_VER_RES == 480)
#include "esp-ui-phone_480_480_stylesheet/src/esp_ui_phone_480_480_stylesheet.h"
#define EXAMPLE_ESP_UI_PHONE_DARK_STYLESHEET() ESP_UI_PHONE_480_480_DARK_STYLESHEET()
#elif (DISP_HOR_RES == 320) && (DISP_VER_RES == 240)
#include "esp-ui-phone_320_240_stylesheet/src/esp_ui_phone_320_240_stylesheet.h"
#define EXAMPLE_ESP_UI_PHONE_DARK_STYLESHEET() ESP_UI_PHONE_320_240_DARK_STYLESHEET()
#endif
#endif

Expand Down Expand Up @@ -126,14 +129,13 @@ int main(int argc, char **argv)
// ESP_UI_CHECK_FALSE_RETURN(phone->getCoreHome().showContainerBorder(), 1, "Show container border failed");

/* Install apps */
bool enable_navigation_bar = phone->getStylesheet()->home.flags.enable_navigation_bar;
PhoneAppSimpleConf *phone_app_simple_conf = new PhoneAppSimpleConf(true, enable_navigation_bar);
PhoneAppSimpleConf *phone_app_simple_conf = new PhoneAppSimpleConf(true, true);
ESP_UI_CHECK_NULL_RETURN(phone_app_simple_conf, 1, "Create phone app simple conf failed");
ESP_UI_CHECK_FALSE_RETURN((phone->installApp(phone_app_simple_conf) >= 0), 1, "Install phone app simple conf failed");
PhoneAppComplexConf *phone_app_complex_conf = new PhoneAppComplexConf(true, enable_navigation_bar);
PhoneAppComplexConf *phone_app_complex_conf = new PhoneAppComplexConf(true, true);
ESP_UI_CHECK_NULL_RETURN(phone_app_complex_conf, 1, "Create phone app complex conf failed");
ESP_UI_CHECK_FALSE_RETURN((phone->installApp(phone_app_complex_conf) >= 0), 1, "Install phone app complex conf failed");
PhoneAppSquareline *phone_app_squareline = new PhoneAppSquareline(true, enable_navigation_bar);
PhoneAppSquareline *phone_app_squareline = new PhoneAppSquareline(true, true);
ESP_UI_CHECK_NULL_RETURN(phone_app_squareline, 1, "Create phone app squareline failed");
ESP_UI_CHECK_FALSE_RETURN((phone->installApp(phone_app_squareline) >= 0), 1, "Install phone app squareline failed");

Expand Down Expand Up @@ -164,9 +166,15 @@ static void on_clock_update_timer_cb(struct _lv_timer_t *t)
time(&now);
localtime_r(&now, &timeinfo);
is_time_pm = (timeinfo.tm_hour >= 12);

ESP_UI_CHECK_FALSE_EXIT(phone->getHome().getStatusBar()->setClock(timeinfo.tm_hour, timeinfo.tm_min, is_time_pm),
"Refresh status bar failed");

lv_mem_monitor_t mon;
lv_mem_monitor(&mon);
uint32_t free_kb = mon.free_size / 1024;
uint32_t total_kb = mon.total_size / 1024;
ESP_UI_CHECK_FALSE_EXIT(phone->getHome().getRecentsScreen()->setMemoryLabel(free_kb, total_kb, 0, 0),
"Refresh memory label failed");
}

/**
Expand Down

0 comments on commit e8015dd

Please sign in to comment.