Browse Source

added counter demo

master
Martin Vladic 2 years ago
parent
commit
e5f24af82e
  1. BIN
      assets/fonts/Montserrat-SemiBold.ttf
  2. BIN
      assets/fonts/ui_font_small_font.bin
  3. 3971
      assets/fonts/ui_font_small_font.c
  4. BIN
      assets/log_eez.png
  5. BIN
      assets/logo_lvgl.png
  6. 1
      build/index.html
  7. 10
      lv_conf.h
  8. 23
      lv_drv_conf.h
  9. 15
      main.c
  10. 42
      src/ui/flow_def.cpp
  11. 2
      src/ui/flow_def.h
  12. 1
      src/ui/fonts.h
  13. 26
      src/ui/images.c
  14. 4
      src/ui/images.h
  15. 90
      src/ui/screens.c
  16. 6
      src/ui/screens.h
  17. 3971
      src/ui/ui_font_small_font.c
  18. 4186
      ui.eez-project

BIN
assets/fonts/Montserrat-SemiBold.ttf

Binary file not shown.

BIN
assets/fonts/ui_font_small_font.bin

Binary file not shown.

3971
assets/fonts/ui_font_small_font.c

File diff suppressed because it is too large Load Diff

BIN
assets/log_eez.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
assets/logo_lvgl.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

1
build/index.html

File diff suppressed because one or more lines are too long

10
lv_conf.h

@ -585,22 +585,22 @@ typedef void * lv_user_data_t;
====================*/ ====================*/
/*Show some widget*/ /*Show some widget*/
#define LV_USE_DEMO_WIDGETS 1 #define LV_USE_DEMO_WIDGETS 0
#if LV_USE_DEMO_WIDGETS #if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0 #define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif #endif
/*Demonstrate the usage of encoder and keyboard*/ /*Demonstrate the usage of encoder and keyboard*/
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
/*Benchmark your system*/ /*Benchmark your system*/
#define LV_USE_DEMO_BENCHMARK 1 #define LV_USE_DEMO_BENCHMARK 0
/*Stress test for LVGL*/ /*Stress test for LVGL*/
#define LV_USE_DEMO_STRESS 1 #define LV_USE_DEMO_STRESS 0
/*Music player demo*/ /*Music player demo*/
#define LV_USE_DEMO_MUSIC 1 #define LV_USE_DEMO_MUSIC 0
#if LV_USE_DEMO_MUSIC #if LV_USE_DEMO_MUSIC
# define LV_DEMO_MUSIC_SQUARE 0 # define LV_DEMO_MUSIC_SQUARE 0
# define LV_DEMO_MUSIC_LANDSCAPE 1 # define LV_DEMO_MUSIC_LANDSCAPE 1

23
lv_drv_conf.h

@ -84,13 +84,13 @@ extern int monitor_hor_res, monitor_ver_res;
/*------------------- /*-------------------
* Monitor of PC * Monitor of PC
*-------------------*/ *-------------------*/
#define USE_MONITOR 1 #define USE_SDL 1
#if USE_MONITOR #if USE_SDL
#define MONITOR_HOR_RES monitor_hor_res #define SDL_HOR_RES monitor_hor_res
#define MONITOR_VER_RES monitor_ver_res #define SDL_VER_RES monitor_ver_res
#define MONITOR_ZOOM 1 /* Scale window by this factor (useful when simulating small screens) */ #define SDL_ZOOM 1 /* Scale window by this factor (useful when simulating small screens) */
#define MONITOR_SDL_INCLUDE_PATH <SDL2/SDL.h> /*Eclipse: <SDL2/SDL.h> Visual Studio: <SDL.h>*/ #define SDL_INCLUDE_PATH <SDL2/SDL.h> /*Eclipse: <SDL2/SDL.h> Visual Studio: <SDL.h>*/
#define MONITOR_VIRTUAL_MACHINE 1 /*Different rendering should be used if running in a Virtual machine*/ #define SDL_VIRTUAL_MACHINE 1 /*Different rendering should be used if running in a Virtual machine*/
#endif #endif
/*---------------- /*----------------
@ -190,16 +190,14 @@ extern int monitor_hor_res, monitor_ver_res;
/*--------------------------------------- /*---------------------------------------
* Mouse or touchpad on PC (using SDL) * Mouse or touchpad on PC (using SDL)
*-------------------------------------*/ *-------------------------------------*/
#define USE_MOUSE 1 #if USE_SDL
#if USE_MOUSE
/*No settings*/ /*No settings*/
#endif #endif
/*------------------------------------------- /*-------------------------------------------
* Mousewheel as encoder on PC (using SDL) * Mousewheel as encoder on PC (using SDL)
*------------------------------------------*/ *------------------------------------------*/
#define USE_MOUSEWHEEL 1 #if USE_SDL
#if USE_MOUSEWHEEL
/*No settings*/ /*No settings*/
#endif #endif
@ -219,8 +217,7 @@ extern int monitor_hor_res, monitor_ver_res;
/*------------------------------- /*-------------------------------
* Keyboard of a PC (using SDL) * Keyboard of a PC (using SDL)
*------------------------------*/ *------------------------------*/
#define USE_KEYBOARD 1 #if USE_SDL
#if USE_KEYBOARD
/*No settings*/ /*No settings*/
#endif #endif

15
main.c

@ -13,7 +13,7 @@
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <emscripten.h> #include <emscripten.h>
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
#include "lv_drivers/display/monitor.h" #include "lv_drivers/sdl/sdl.h"
#include "lv_drivers/indev/mouse.h" #include "lv_drivers/indev/mouse.h"
#include "lv_drivers/indev/mousewheel.h" #include "lv_drivers/indev/mousewheel.h"
#include "lv_drivers/indev/keyboard.h" #include "lv_drivers/indev/keyboard.h"
@ -114,7 +114,7 @@ void do_loop(void *arg)
static void hal_init(void) static void hal_init(void)
{ {
/* Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/ /* Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/
monitor_init(); sdl_init();
/*Create a display buffer*/ /*Create a display buffer*/
static lv_disp_draw_buf_t disp_buf1; static lv_disp_draw_buf_t disp_buf1;
@ -125,7 +125,7 @@ static void hal_init(void)
static lv_disp_drv_t disp_drv; static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv); /*Basic initialization*/ lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.draw_buf = &disp_buf1; disp_drv.draw_buf = &disp_buf1;
disp_drv.flush_cb = monitor_flush; /*Used when `LV_VDB_SIZE != 0` in lv_conf.h (buffered drawing)*/ disp_drv.flush_cb = sdl_display_flush; /*Used when `LV_VDB_SIZE != 0` in lv_conf.h (buffered drawing)*/
disp_drv.hor_res = monitor_hor_res; disp_drv.hor_res = monitor_hor_res;
disp_drv.ver_res = monitor_ver_res; disp_drv.ver_res = monitor_ver_res;
disp1 = lv_disp_drv_register(&disp_drv); disp1 = lv_disp_drv_register(&disp_drv);
@ -135,27 +135,24 @@ static void hal_init(void)
/* Add the mouse as input device /* Add the mouse as input device
* Use the 'mouse' driver which reads the PC's mouse*/ * Use the 'mouse' driver which reads the PC's mouse*/
mouse_init();
static lv_indev_drv_t indev_drv_1; static lv_indev_drv_t indev_drv_1;
lv_indev_drv_init(&indev_drv_1); /*Basic initialization*/ lv_indev_drv_init(&indev_drv_1); /*Basic initialization*/
indev_drv_1.type = LV_INDEV_TYPE_POINTER; indev_drv_1.type = LV_INDEV_TYPE_POINTER;
/*This function will be called periodically (by the library) to get the mouse position and state*/ /*This function will be called periodically (by the library) to get the mouse position and state*/
indev_drv_1.read_cb = mouse_read; indev_drv_1.read_cb = sdl_mouse_read;
lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv_1); lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv_1);
keyboard_init();
static lv_indev_drv_t indev_drv_2; static lv_indev_drv_t indev_drv_2;
lv_indev_drv_init(&indev_drv_2); /*Basic initialization*/ lv_indev_drv_init(&indev_drv_2); /*Basic initialization*/
indev_drv_2.type = LV_INDEV_TYPE_KEYPAD; indev_drv_2.type = LV_INDEV_TYPE_KEYPAD;
indev_drv_2.read_cb = keyboard_read; indev_drv_2.read_cb = sdl_keyboard_read;
lv_indev_t *kb_indev = lv_indev_drv_register(&indev_drv_2); lv_indev_t *kb_indev = lv_indev_drv_register(&indev_drv_2);
//lv_indev_set_group(kb_indev, g); //lv_indev_set_group(kb_indev, g);
mousewheel_init();
static lv_indev_drv_t indev_drv_3; static lv_indev_drv_t indev_drv_3;
lv_indev_drv_init(&indev_drv_3); /*Basic initialization*/ lv_indev_drv_init(&indev_drv_3); /*Basic initialization*/
indev_drv_3.type = LV_INDEV_TYPE_ENCODER; indev_drv_3.type = LV_INDEV_TYPE_ENCODER;
indev_drv_3.read_cb = mousewheel_read; indev_drv_3.read_cb = sdl_mousewheel_read;
lv_indev_t * enc_indev = lv_indev_drv_register(&indev_drv_3); lv_indev_t * enc_indev = lv_indev_drv_register(&indev_drv_3);
//lv_indev_set_group(enc_indev, g); //lv_indev_set_group(enc_indev, g);

42
src/ui/flow_def.cpp

@ -3,17 +3,39 @@
namespace eez { namespace eez {
// ASSETS DEFINITION // ASSETS DEFINITION
const uint8_t assets[152] = { const uint8_t assets[508] = {
0x7E, 0x65, 0x65, 0x7A, 0x03, 0x00, 0x06, 0x00, 0x08, 0x01, 0x00, 0x00, 0x6E, 0x24, 0x00, 0x00, 0x7E, 0x65, 0x65, 0x7A, 0x03, 0x00, 0x06, 0x00, 0xB8, 0x03, 0x00, 0x00, 0x6E, 0x24, 0x00, 0x00,
0x00, 0x28, 0x00, 0x01, 0x00, 0x17, 0x38, 0x0C, 0x00, 0xC0, 0x20, 0x03, 0xE0, 0x01, 0x01, 0x00, 0x00, 0x28, 0x00, 0x01, 0x00, 0x17, 0x38, 0x0C, 0x00, 0xC0, 0x20, 0x03, 0xE0, 0x01, 0x01, 0x00,
0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x08, 0x00, 0x13, 0x54, 0x08, 0x00, 0x97, 0x58, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x08, 0x00, 0x13, 0x54, 0x08, 0x00, 0xA6, 0x58, 0x00, 0x00,
0x00, 0x02, 0x00, 0x00, 0x00, 0xE0, 0x2C, 0x00, 0x13, 0x5C, 0x08, 0x00, 0x53, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x78, 0x03, 0x2C, 0x00, 0x13, 0x5C, 0x08, 0x00, 0xF3, 0x06, 0x68,
0x00, 0x90, 0x20, 0x00, 0x13, 0x98, 0x30, 0x00, 0x2F, 0x9C, 0x00, 0x01, 0x00, 0x0F, 0xF6, 0x03, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x09,
0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x00, 0xFF, 0xFF, 0x08, 0x42, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9C, 0x38, 0x00, 0x13, 0xC0, 0x18, 0x00, 0x2E, 0x84, 0x03, 0x78, 0x00, 0xF6,
0x10, 0x27, 0x1C, 0x00, 0x00, 0x4C, 0x00, 0x13, 0xC0, 0x4C, 0x00, 0xF3, 0x03, 0xC8, 0x00, 0x00, 0x27, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x00, 0xFF, 0xFF, 0x08, 0x42, 0xC4, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0x00, 0x00, 0xCC, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, 0xD4, 0x00, 0x89, 0x00, 0xE4, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x24, 0x01, 0x00, 0x00, 0x44, 0x01, 0x00,
0x00, 0x1A, 0xE0, 0x50, 0x00, 0x5F, 0xE8, 0x00, 0x00, 0x00, 0xF8, 0x68, 0x00, 0x00, 0x16, 0x01, 0x00, 0x64, 0x01, 0x00, 0x00, 0x84, 0x01, 0x00, 0x00, 0xA4, 0x01, 0x00, 0x00, 0xCC, 0x01, 0x00,
0x0B, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0xF8, 0x01, 0x00, 0x00, 0x10, 0x27, 0x40, 0x00, 0x00, 0x58, 0x00, 0x22, 0x08, 0x02, 0x68,
0x00, 0x6E, 0x10, 0x02, 0x00, 0x00, 0xFF, 0xFF, 0x20, 0x00, 0x13, 0x14, 0x20, 0x00, 0x13, 0x1C,
0x20, 0x00, 0x17, 0x11, 0x20, 0x00, 0x00, 0x93, 0x00, 0x13, 0x20, 0x20, 0x00, 0x13, 0x2C, 0x20,
0x00, 0x1B, 0x12, 0x40, 0x00, 0x22, 0x30, 0x02, 0x08, 0x00, 0x1F, 0x38, 0x40, 0x00, 0x00, 0x00,
0x18, 0x00, 0x13, 0x40, 0x40, 0x00, 0x1F, 0x48, 0x40, 0x00, 0x04, 0x13, 0x4C, 0x40, 0x00, 0x1F,
0x54, 0x40, 0x00, 0x04, 0x13, 0x5C, 0x40, 0x00, 0x13, 0x64, 0x20, 0x00, 0x22, 0xEF, 0x03, 0x10,
0x00, 0x26, 0x68, 0x02, 0x28, 0x00, 0x00, 0x10, 0x00, 0x13, 0x6C, 0x20, 0x00, 0x00, 0x0C, 0x00,
0x26, 0x70, 0x02, 0x28, 0x00, 0x1B, 0x74, 0x28, 0x00, 0x17, 0x78, 0x28, 0x00, 0x13, 0x7C, 0x1C,
0x00, 0x1B, 0x07, 0x78, 0x01, 0xF3, 0x4E, 0x80, 0x02, 0x00, 0x00, 0x84, 0x02, 0x00, 0x00, 0x88,
0x02, 0x00, 0x00, 0x94, 0x02, 0x00, 0x00, 0x98, 0x02, 0x00, 0x00, 0x9C, 0x02, 0x00, 0x00, 0xA8,
0x02, 0x00, 0x00, 0xAC, 0x02, 0x00, 0x00, 0xB0, 0x02, 0x00, 0x00, 0xB4, 0x02, 0x00, 0x00, 0xC0,
0x02, 0x00, 0x00, 0xC4, 0x02, 0x00, 0x00, 0xC8, 0x02, 0x00, 0x00, 0xD4, 0x02, 0x00, 0x00, 0xE0,
0x02, 0x00, 0x00, 0xE4, 0x02, 0x00, 0x00, 0xE8, 0x02, 0x00, 0x00, 0xF4, 0x02, 0x00, 0x00, 0xF8,
0x02, 0x00, 0x00, 0xFC, 0x02, 0x00, 0x00, 0x08, 0x03, 0x00, 0x00, 0x14, 0x03, 0x00, 0x00, 0x18,
0x03, 0x00, 0x00, 0x1C, 0xE8, 0x01, 0x53, 0x28, 0x03, 0x00, 0x00, 0x34, 0xA4, 0x00, 0x50, 0x3C,
0x03, 0x00, 0x00, 0x48, 0x18, 0x00, 0x13, 0xE0, 0x04, 0x00, 0x08, 0x8D, 0x00, 0x0F, 0x14, 0x00,
0x09, 0x3F, 0x40, 0x00, 0xE0, 0x2C, 0x00, 0x0D, 0x01, 0xAC, 0x02, 0x04, 0x5C, 0x02, 0x0F, 0x60,
0x00, 0x14, 0x01, 0xD8, 0x02, 0x0F, 0x34, 0x00, 0x09, 0x07, 0x28, 0x00, 0x6A, 0x58, 0x03, 0x00,
0x00, 0x5C, 0x03, 0x14, 0x00, 0xE3, 0x64, 0x03, 0x00, 0x00, 0x68, 0x03, 0x00, 0x00, 0x70, 0x03,
0x00, 0x00, 0x74, 0x03, 0xA8, 0x00, 0x00, 0x09, 0x02, 0x34, 0xC0, 0x00, 0xE0, 0x0C, 0x00, 0x40,
0x01, 0xC0, 0x00, 0xE0, 0x78, 0x01, 0xFF, 0x03, 0x08, 0x00, 0x01, 0x00, 0x88, 0x03, 0x00, 0x00,
0x98, 0x03, 0x00, 0x00, 0xA8, 0x03, 0x00, 0x00, 0x03, 0x03, 0x68, 0x00, 0x03, 0x08, 0x01, 0x00,
0x04, 0xB0, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };
} // namespace eez } // namespace eez

2
src/ui/flow_def.h

@ -18,6 +18,6 @@ enum ColorsEnum {
COLOR_ID_CUSTOM_UNDEFINED = 2 COLOR_ID_CUSTOM_UNDEFINED = 2
}; };
extern const uint8_t assets[152]; extern const uint8_t assets[508];
} // namespace eez } // namespace eez

1
src/ui/fonts.h

@ -3,6 +3,7 @@
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
extern const lv_font_t ui_font_small_font;
#endif /*EEZ_LVGL_UI_FONTS_H*/ #endif /*EEZ_LVGL_UI_FONTS_H*/

26
src/ui/images.c

File diff suppressed because one or more lines are too long

4
src/ui/images.h

@ -3,13 +3,15 @@
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
extern const lv_img_dsc_t img_log_eez;
extern const lv_img_dsc_t img_logo_lvgl;
typedef struct _ext_img_desc_t { typedef struct _ext_img_desc_t {
const char *name; const char *name;
const lv_img_dsc_t *img_dsc; const lv_img_dsc_t *img_dsc;
} ext_img_desc_t; } ext_img_desc_t;
extern const ext_img_desc_t images[0]; extern const ext_img_desc_t images[2];
#endif /*EEZ_LVGL_UI_IMAGES_H*/ #endif /*EEZ_LVGL_UI_IMAGES_H*/

90
src/ui/screens.c

@ -4,6 +4,20 @@
#include "actions.h" #include "actions.h"
#include "../flow.h" #include "../flow.h"
static void event_handler_cb_main_button_1(lv_event_t *e) {
lv_event_code_t event = lv_event_get_code(e);
if (event == LV_EVENT_PRESSED) {
flowPropagateValue(0, 3, 1);
}
}
static void event_handler_cb_main_button_2(lv_event_t *e) {
lv_event_code_t event = lv_event_get_code(e);
if (event == LV_EVENT_PRESSED) {
flowPropagateValue(0, 5, 1);
}
}
main_t *create_screen_main() { main_t *create_screen_main() {
main_t *screen = (main_t *)lv_mem_alloc(sizeof(main_t)); main_t *screen = (main_t *)lv_mem_alloc(sizeof(main_t));
lv_obj_t *obj = lv_obj_create(0); lv_obj_t *obj = lv_obj_create(0);
@ -13,18 +27,90 @@ main_t *create_screen_main() {
{ {
lv_obj_t *parent_obj = obj; lv_obj_t *parent_obj = obj;
{ {
// image_1
lv_obj_t *obj = lv_img_create(parent_obj);
screen->obj_image_1 = obj;
lv_obj_set_pos(obj, 130, 79);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_img_set_src(obj, &img_log_eez);
lv_obj_add_flag(obj, LV_OBJ_FLAG_ADV_HITTEST);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
}
{
// image_2
lv_obj_t *obj = lv_img_create(parent_obj);
screen->obj_image_2 = obj;
lv_obj_set_pos(obj, 457, 79);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_img_set_src(obj, &img_logo_lvgl);
lv_obj_add_flag(obj, LV_OBJ_FLAG_ADV_HITTEST);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
}
{
// label_1 // label_1
lv_obj_t *obj = lv_label_create(parent_obj); lv_obj_t *obj = lv_label_create(parent_obj);
screen->obj_label_1 = obj; screen->obj_label_1 = obj;
lv_obj_set_pos(obj, 356, 232); lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "Hello, world!"); lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// button_1
lv_obj_t *obj = lv_btn_create(parent_obj);
screen->obj_button_1 = obj;
lv_obj_set_pos(obj, 268, 348);
lv_obj_set_size(obj, 100, 40);
lv_obj_add_event_cb(obj, event_handler_cb_main_button_1, LV_EVENT_ALL, screen);
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
{
lv_obj_t *parent_obj = obj;
{
// label_2
lv_obj_t *obj = lv_label_create(parent_obj);
screen->obj_label_2 = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "+");
lv_obj_set_style_text_font(obj, &lv_font_montserrat_48, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// button_2
lv_obj_t *obj = lv_btn_create(parent_obj);
screen->obj_button_2 = obj;
lv_obj_set_pos(obj, 408, 348);
lv_obj_set_size(obj, 100, 40);
lv_obj_add_event_cb(obj, event_handler_cb_main_button_2, LV_EVENT_ALL, screen);
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
{
lv_obj_t *parent_obj = obj;
{
// label_3
lv_obj_t *obj = lv_label_create(parent_obj);
screen->obj_label_3 = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "-");
lv_obj_set_style_text_font(obj, &lv_font_montserrat_48, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
} }
} }
return screen; return screen;
} }
void tick_screen_main(main_t *screen) { void tick_screen_main(main_t *screen) {
{
const char *new_val = evalTextProperty(0, 2, 2, "Failed to evaluate Text in Label widget");
const char *cur_val = lv_label_get_text(screen->obj_label_1);
if (strcmp(new_val, cur_val) != 0) lv_label_set_text(screen->obj_label_1, new_val);
}
} }

6
src/ui/screens.h

@ -10,7 +10,13 @@ extern "C" {
typedef struct _main_t { typedef struct _main_t {
lv_obj_t *screen_obj; lv_obj_t *screen_obj;
lv_obj_t *obj_image_1;
lv_obj_t *obj_image_2;
lv_obj_t *obj_label_1; lv_obj_t *obj_label_1;
lv_obj_t *obj_button_1;
lv_obj_t *obj_label_2;
lv_obj_t *obj_button_2;
lv_obj_t *obj_label_3;
} main_t; } main_t;
main_t *create_screen_main(); main_t *create_screen_main();

3971
src/ui/ui_font_small_font.c

File diff suppressed because it is too large Load Diff

4186
ui.eez-project

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save