mirror of
https://github.com/m5stack/lv_m5_emulator.git
synced 2026-05-20 11:19:24 -07:00
Support importing UI projects from EEZ Studio
This commit is contained in:
@@ -128,4 +128,31 @@ The emulator support zoom and rotate the window at runtime. So you can easily zo
|
||||
LVGL tasks can overflow the default stack. Allocate a larger stack to ensure GUI stability.
|
||||
|
||||
3. **Fine-tune `LV_BUFFER_LINE` for faster rendering**
|
||||
A larger draw buffer (more lines) reduces flush operations and improves drawing speed.
|
||||
A larger draw buffer (more lines) reduces flush operations and improves drawing speed.
|
||||
|
||||
4. **Use the standard C allocator for large pools**
|
||||
Set `LV_USE_STDLIB_MALLOC = LV_STDLIB_CLIB` to make LVGL call the system’s `malloc`/`free`, allowing bigger memory pools when required.
|
||||
|
||||
|
||||
## EEZ Studio – Key Notes
|
||||
|
||||
1. **Choose the LVGL version and display resolution in the settings**
|
||||
<div align=center>
|
||||
<img src="support/eez_studio_setting_01.png"width="70%">
|
||||
</div>
|
||||
|
||||
2. **Update LVGL header includes**
|
||||
<div align=center>
|
||||
<img src="support/eez_studio_setting_02.png"width="70%">
|
||||
</div>
|
||||
|
||||
3. **Copy the eez studio project `ui` folder into `src` path**
|
||||
<div align=center>
|
||||
<img src="support/eez_studio_ui_import.png"width="30%">
|
||||
</div>
|
||||
|
||||
4. **Uncomment `USE_EEZ_STUDIO` in the `platformio.ini` file**
|
||||
```bash
|
||||
; EEZ Studio Project
|
||||
; -D USE_EEZ_STUDIO
|
||||
```
|
||||
@@ -23,6 +23,9 @@ build_flags =
|
||||
-D LVGL_USE_V8=1 ; lvgl v8
|
||||
-D LVGL_USE_V9=0 ; lvgl v9
|
||||
|
||||
; EEZ Studio Project
|
||||
; -D USE_EEZ_STUDIO
|
||||
|
||||
lib_deps =
|
||||
https://github.com/m5stack/M5GFX#develop
|
||||
lvgl=https://github.com/lvgl/lvgl/archive/refs/tags/v8.4.0.zip ; lvgl v8
|
||||
|
||||
+28
-12
@@ -2,25 +2,34 @@
|
||||
#include "lvgl_port_m5stack.hpp"
|
||||
#include "demos/lv_demos.h"
|
||||
|
||||
#ifdef USE_EEZ_STUDIO
|
||||
#include "ui/ui.h"
|
||||
|
||||
// EEZ Studio specific actions
|
||||
/*
|
||||
extern "C" void action_example_for_eez(lv_event_t* e)
|
||||
{
|
||||
// Example action for EEZ Studio
|
||||
// You can add your own logic here
|
||||
// The following code demonstrates how to change the UI
|
||||
lv_obj_t *label = lv_label_create(lv_scr_act());
|
||||
lv_label_set_text(label, "Hello EEZ Studio!");
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
void user_app(void)
|
||||
{
|
||||
#ifndef USE_EEZ_STUDIO
|
||||
// You can test the lvgl default demo
|
||||
// /*
|
||||
if (lvgl_port_lock()) {
|
||||
#if LVGL_USE_V8 == 1
|
||||
lv_demo_widgets();
|
||||
#elif LVGL_USE_V9 == 1
|
||||
// lv_demo_widgets not work proerly with v9 for now :(
|
||||
#if defined(ARDUINO) && defined(ESP_PLATFORM)
|
||||
lv_demo_benchmark();
|
||||
#else
|
||||
// lv_demo_stress not work properly with actual devices for now :(
|
||||
lv_demo_stress();
|
||||
#endif
|
||||
#endif
|
||||
// lv_demo_widgets();
|
||||
// lv_demo_music();
|
||||
// lv_demo_stress();
|
||||
lvgl_port_unlock();
|
||||
}
|
||||
// */
|
||||
|
||||
// Or you can create your own lvgl app here
|
||||
/*
|
||||
@@ -35,4 +44,11 @@ void user_app(void)
|
||||
lvgl_port_unlock();
|
||||
}
|
||||
*/
|
||||
#else
|
||||
// Or you can initialize the UI for EEZ Studio if you are using it
|
||||
if (lvgl_port_lock()) {
|
||||
ui_init();
|
||||
lvgl_port_unlock();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
#include <cstdlib> // for aligned_alloc
|
||||
#include <cstring> // for memset
|
||||
|
||||
#ifdef USE_EEZ_STUDIO
|
||||
#include "ui/ui.h"
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO) && defined(ESP_PLATFORM)
|
||||
static SemaphoreHandle_t xGuiSemaphore;
|
||||
#elif !defined(ARDUINO) && (__has_include(<SDL2/SDL.h>) || __has_include(<SDL.h>))
|
||||
@@ -28,6 +32,9 @@ static void lvgl_rtos_task(void *pvParameter)
|
||||
while (1) {
|
||||
if (pdTRUE == xSemaphoreTake(xGuiSemaphore, portMAX_DELAY)) {
|
||||
lv_timer_handler();
|
||||
#ifdef USE_EEZ_STUDIO
|
||||
ui_tick();
|
||||
#endif
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 312 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 220 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Reference in New Issue
Block a user