Browse Source

update eez-framework

master
Martin Vladic 2 years ago
parent
commit
6c8402683f
  1. 2
      eez-framework
  2. 2
      lvgl-template-web.eez-project
  3. 24
      src/ui/images.c
  4. 34
      src/ui/screens.c
  5. 6
      src/ui/screens.h
  6. 6
      src/ui/ui.c
  7. 302
      src/ui/ui_image_log_eez.c
  8. 326
      src/ui/ui_image_logo_lvgl.c

2
eez-framework

@ -1 +1 @@
Subproject commit 8335a8c5337753a779c308a6c1be8e40dec4934c
Subproject commit 5938dac098c98f7d63b6c6a4f20f3d38b4e6ea17

2
lvgl-template-web.eez-project

@ -88,7 +88,7 @@
{
"objID": "cb1d0e99-b8a8-43f7-815f-e6a8f7f5fe6f",
"fileName": "ui.c",
"template": "#include \"ui.h\"\n#include \"screens.h\"\n#include \"images.h\"\n#include \"flow_def.h\"\n\nvoid ui_init() {\n eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images));\n}\n\nvoid ui_tick() {\n eez_flow_tick();\n tick_screen(g_currentScreen);\n}\n"
"template": "#include \"ui.h\"\n#include \"screens.h\"\n#include \"images.h\"\n#include \"flow_def.h\"\n\n//${eez-studio LVGL_ACTIONS_ARRAY_DEF}\n\nvoid ui_init() {\n eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images), actions);\n}\n\nvoid ui_tick() {\n eez_flow_tick();\n tick_screen(g_currentScreen);\n}\n"
}
],
"destinationFolder": "src/ui",

24
src/ui/images.c

File diff suppressed because one or more lines are too long

34
src/ui/screens.c

@ -5,24 +5,28 @@
#include "ui.h"
objects_t objects;
lv_obj_t *tick_value_change_obj;
static void event_handler_cb_main_button_1(lv_event_t *e) {
static void event_handler_cb_main__obj_button_1(lv_event_t *e) {
lv_event_code_t event = lv_event_get_code(e);
void *flowState = e->user_data;
if (event == LV_EVENT_PRESSED) {
flowPropagateValue(0, 3, 1);
flowPropagateValue(flowState, 3, 1);
}
}
static void event_handler_cb_main_button_2(lv_event_t *e) {
static void event_handler_cb_main__obj_button_2(lv_event_t *e) {
lv_event_code_t event = lv_event_get_code(e);
void *flowState = e->user_data;
if (event == LV_EVENT_PRESSED) {
flowPropagateValue(0, 5, 1);
flowPropagateValue(flowState, 5, 1);
}
}
void create_screen_main() {
void *flowState = getFlowState(0, 0);
lv_obj_t *obj = lv_obj_create(0);
objects.main = obj;
objects.Main = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 800, 480);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
@ -46,17 +50,19 @@ void create_screen_main() {
}
{
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_1 = obj;
objects._obj_label_0 = 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_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);
}
{
lv_obj_t *obj = lv_btn_create(parent_obj);
objects._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, 0);
lv_obj_add_event_cb(obj, event_handler_cb_main__obj_button_1, LV_EVENT_ALL, flowState);
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
{
@ -73,9 +79,10 @@ void create_screen_main() {
}
{
lv_obj_t *obj = lv_btn_create(parent_obj);
objects._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, 0);
lv_obj_add_event_cb(obj, event_handler_cb_main__obj_button_2, LV_EVENT_ALL, flowState);
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
{
@ -94,10 +101,15 @@ void create_screen_main() {
}
void tick_screen_main() {
void *flowState = getFlowState(0, 0);
{
const char *new_val = evalTextProperty(0, 2, 2, "Failed to evaluate Text in Label widget");
const char *cur_val = lv_label_get_text(objects.label_1);
if (strcmp(new_val, cur_val) != 0) lv_label_set_text(objects.label_1, new_val);
const char *new_val = evalTextProperty(flowState, 2, 2, "Failed to evaluate Text in Label widget");
const char *cur_val = lv_label_get_text(objects._obj_label_0);
if (strcmp(new_val, cur_val) != 0) {
tick_value_change_obj = objects._obj_label_0;
lv_label_set_text(objects._obj_label_0, new_val);
tick_value_change_obj = NULL;
}
}
}

6
src/ui/screens.h

@ -8,8 +8,10 @@ extern "C" {
#endif
typedef struct _objects_t {
lv_obj_t *main;
lv_obj_t *label_1;
lv_obj_t *Main;
lv_obj_t *_obj_button_1;
lv_obj_t *_obj_button_2;
lv_obj_t *_obj_label_0;
} objects_t;
extern objects_t objects;

6
src/ui/ui.c

@ -3,8 +3,12 @@
#include "images.h"
#include "flow_def.h"
ActionExecFunc actions[] = {
};
void ui_init() {
eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images));
eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images), actions);
}
void ui_tick() {

302
src/ui/ui_image_log_eez.c

File diff suppressed because one or more lines are too long

326
src/ui/ui_image_logo_lvgl.c

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save