add Shutter control breaking everything

This commit is contained in:
2025-11-09 11:55:18 +01:00
parent bb1eee6cda
commit 6b83634e72
39 changed files with 29637 additions and 1575 deletions
+16
View File
@@ -0,0 +1,16 @@
#ifndef EEZ_LVGL_UI_EVENTS_H
#define EEZ_LVGL_UI_EVENTS_H
#include <lvgl/lvgl.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_EVENTS_H*/
+16
View File
@@ -0,0 +1,16 @@
#ifndef EEZ_LVGL_UI_FONTS_H
#define EEZ_LVGL_UI_FONTS_H
#include <lvgl/lvgl.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_FONTS_H*/
+5
View File
@@ -0,0 +1,5 @@
#include "images.h"
const ext_img_desc_t images[1] = {
0
};
+26
View File
@@ -0,0 +1,26 @@
#ifndef EEZ_LVGL_UI_IMAGES_H
#define EEZ_LVGL_UI_IMAGES_H
#include <lvgl/lvgl.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef EXT_IMG_DESC_T
#define EXT_IMG_DESC_T
typedef struct _ext_img_desc_t {
const char *name;
const lv_img_dsc_t *img_dsc;
} ext_img_desc_t;
#endif
extern const ext_img_desc_t images[1];
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_IMAGES_H*/
+347
View File
@@ -0,0 +1,347 @@
#include <string.h>
#include "screens.h"
#include "images.h"
#include "fonts.h"
#include "actions.h"
#include "vars.h"
#include "styles.h"
#include "ui.h"
#include <string.h>
objects_t objects;
lv_obj_t *tick_value_change_obj;
void create_screen_rollo_pos() {
lv_obj_t *obj = lv_obj_create(0);
objects.rollo_pos = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 240, 240);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_arc_create(parent_obj);
lv_obj_set_pos(obj, 88, 95);
lv_obj_set_size(obj, 93, 87);
lv_arc_set_range(obj, 0, 900);
lv_arc_set_value(obj, 0);
lv_arc_set_bg_start_angle(obj, 270);
lv_arc_set_bg_end_angle(obj, 90);
lv_obj_add_flag(obj, LV_OBJ_FLAG_ADV_HITTEST);
add_style_arc(obj);
lv_obj_set_style_arc_width(obj, 4, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_width(obj, 4, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
lv_obj_t *obj = lv_slider_create(parent_obj);
objects.obj0 = obj;
lv_obj_set_pos(obj, 75, 68);
lv_obj_set_size(obj, 3, 140);
lv_slider_set_range(obj, 100, 0);
lv_slider_set_value(obj, 50, LV_ANIM_OFF);
add_style_slider(obj);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffa2f321), LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(obj, 6, LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(obj, 6, LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(obj, 6, LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(obj, 6, LV_PART_KNOB | LV_STATE_DEFAULT);
}
{
lv_obj_t *obj = lv_btn_create(parent_obj);
lv_obj_set_pos(obj, 10, 100);
lv_obj_set_size(obj, 40, 40);
add_style_button(obj);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "X");
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
lv_obj_t *obj = lv_obj_create(parent_obj);
objects.obj1 = obj;
lv_obj_set_pos(obj, 99, 63);
lv_obj_set_size(obj, 18, 150);
lv_obj_set_style_pad_left(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE|LV_OBJ_FLAG_CLICK_FOCUSABLE|LV_OBJ_FLAG_GESTURE_BUBBLE|LV_OBJ_FLAG_PRESS_LOCK|LV_OBJ_FLAG_SCROLLABLE|LV_OBJ_FLAG_SCROLL_CHAIN_HOR|LV_OBJ_FLAG_SCROLL_CHAIN_VER|LV_OBJ_FLAG_SCROLL_ELASTIC|LV_OBJ_FLAG_SCROLL_MOMENTUM|LV_OBJ_FLAG_SCROLL_WITH_ARROW|LV_OBJ_FLAG_SNAPPABLE);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xfffafafa), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(obj, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff000000), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_radius(obj, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
{
lv_obj_t *parent_obj = obj;
{
// lam0
lv_obj_t *obj = lv_label_create(parent_obj);
objects.lam0 = obj;
lv_obj_set_pos(obj, 7, 3);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_long_mode(obj, LV_LABEL_LONG_CLIP);
lv_label_set_text(obj, "(");
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// lam1
lv_obj_t *obj = lv_label_create(parent_obj);
objects.lam1 = obj;
lv_obj_set_pos(obj, 7, 19);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "(");
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// lam2
lv_obj_t *obj = lv_label_create(parent_obj);
objects.lam2 = obj;
lv_obj_set_pos(obj, 7, 35);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "(");
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// lam3
lv_obj_t *obj = lv_label_create(parent_obj);
objects.lam3 = obj;
lv_obj_set_pos(obj, 7, 51);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "(");
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffffffff), LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// lam4
lv_obj_t *obj = lv_label_create(parent_obj);
objects.lam4 = obj;
lv_obj_set_pos(obj, 7, 67);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "(");
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// lam5
lv_obj_t *obj = lv_label_create(parent_obj);
objects.lam5 = obj;
lv_obj_set_pos(obj, 7, 83);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "(");
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// lam6
lv_obj_t *obj = lv_label_create(parent_obj);
objects.lam6 = obj;
lv_obj_set_pos(obj, 7, 99);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "(");
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// lam7
lv_obj_t *obj = lv_label_create(parent_obj);
objects.lam7 = obj;
lv_obj_set_pos(obj, 7, 115);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "(");
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// lam8
lv_obj_t *obj = lv_label_create(parent_obj);
objects.lam8 = obj;
lv_obj_set_pos(obj, 7, 131);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "(");
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
lv_obj_t *obj = lv_btn_create(parent_obj);
lv_obj_set_pos(obj, 193, 100);
lv_obj_set_size(obj, 40, 40);
add_style_button(obj);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "OK");
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 49, 9);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "Endposition\n\"Fenster Rechts\"\nfür taste AUF speichern");
lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_12, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
tick_screen_rollo_pos();
}
void tick_screen_rollo_pos() {
}
void create_screen_menu() {
lv_obj_t *obj = lv_obj_create(0);
objects.menu = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 240, 240);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_buttonmatrix_create(parent_obj);
objects.obj2 = obj;
lv_obj_set_pos(obj, 25, 25);
lv_obj_set_size(obj, 190, 190);
static const char *map[6] = {
"Temp",
"Historie",
"\n",
"Rollos",
"Debug",
NULL,
};
lv_buttonmatrix_set_map(obj, map);
lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff15171a), LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
tick_screen_menu();
}
void tick_screen_menu() {
}
void create_screen_rollos() {
lv_obj_t *obj = lv_obj_create(0);
objects.rollos = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 240, 240);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_dropdown_create(parent_obj);
lv_obj_set_pos(obj, 60, 20);
lv_obj_set_size(obj, 120, LV_SIZE_CONTENT);
lv_dropdown_set_options(obj, "Türe\nFenster\nBeide");
lv_dropdown_set_selected(obj, 1);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_10, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_10, LV_PART_SELECTED | LV_STATE_DEFAULT);
}
{
lv_obj_t *obj = lv_buttonmatrix_create(parent_obj);
lv_obj_set_pos(obj, 62, 59);
lv_obj_set_size(obj, 145, 139);
static const char *map[9] = {
"^",
"#",
"\n",
"STOP",
"#",
"\n",
"\\/",
"#",
NULL,
};
static lv_buttonmatrix_ctrl_t ctrl_map[6] = {
5,
1,
5,
1,
5,
1,
};
lv_buttonmatrix_set_map(obj, map);
lv_buttonmatrix_set_ctrl_map(obj, ctrl_map);
lv_obj_set_style_pad_top(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_column(obj, 8, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
lv_obj_t *obj = lv_btn_create(parent_obj);
lv_obj_set_pos(obj, 4, 100);
lv_obj_set_size(obj, 40, 40);
add_style_button(obj);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_label_create(parent_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);
}
}
}
}
tick_screen_rollos();
}
void tick_screen_rollos() {
}
typedef void (*tick_screen_func_t)();
tick_screen_func_t tick_screen_funcs[] = {
tick_screen_rollo_pos,
tick_screen_menu,
tick_screen_rollos,
};
void tick_screen(int screen_index) {
tick_screen_funcs[screen_index]();
}
void tick_screen_by_id(enum ScreensEnum screenId) {
tick_screen_funcs[screenId - 1]();
}
void create_screens() {
lv_disp_t *dispp = lv_disp_get_default();
lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT);
lv_disp_set_theme(dispp, theme);
create_screen_rollo_pos();
create_screen_menu();
create_screen_rollos();
}
+55
View File
@@ -0,0 +1,55 @@
#ifndef EEZ_LVGL_UI_SCREENS_H
#define EEZ_LVGL_UI_SCREENS_H
#include <lvgl/lvgl.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _objects_t {
lv_obj_t *rollo_pos;
lv_obj_t *menu;
lv_obj_t *rollos;
lv_obj_t *obj0;
lv_obj_t *obj1;
lv_obj_t *lam0;
lv_obj_t *lam1;
lv_obj_t *lam2;
lv_obj_t *lam3;
lv_obj_t *lam4;
lv_obj_t *lam5;
lv_obj_t *lam6;
lv_obj_t *lam7;
lv_obj_t *lam8;
lv_obj_t *obj2;
} objects_t;
extern objects_t objects;
enum ScreensEnum {
SCREEN_ID_ROLLO_POS = 1,
SCREEN_ID_MENU = 2,
SCREEN_ID_ROLLOS = 3,
};
void create_screen_rollo_pos();
void tick_screen_rollo_pos();
void create_screen_menu();
void tick_screen_menu();
void create_screen_rollos();
void tick_screen_rollos();
void tick_screen_by_id(enum ScreensEnum screenId);
void tick_screen(int screen_index);
void create_screens();
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_SCREENS_H*/
+22
View File
@@ -0,0 +1,22 @@
#ifndef EEZ_LVGL_UI_STRUCTS_H
#define EEZ_LVGL_UI_STRUCTS_H
#if defined(EEZ_FOR_LVGL)
#include <eez/flow/flow.h>
#include <stdint.h>
#include <stdbool.h>
#include "vars.h"
using namespace eez;
#endif
#endif /*EEZ_LVGL_UI_STRUCTS_H*/
+144
View File
@@ -0,0 +1,144 @@
#include "styles.h"
#include "images.h"
#include "fonts.h"
#include "ui.h"
#include "screens.h"
//
// Style: Button
//
void init_style_button_MAIN_DEFAULT(lv_style_t *style) {
lv_style_set_bg_color(style, lv_color_hex(0xff2f3237));
};
lv_style_t *get_style_button_MAIN_DEFAULT() {
static lv_style_t *style;
if (!style) {
style = lv_malloc(sizeof(lv_style_t));
lv_style_init(style);
init_style_button_MAIN_DEFAULT(style);
}
return style;
};
void add_style_button(lv_obj_t *obj) {
lv_obj_add_style(obj, get_style_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};
void remove_style_button(lv_obj_t *obj) {
lv_obj_remove_style(obj, get_style_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
};
//
// Style: arc
//
void init_style_arc_INDICATOR_DEFAULT(lv_style_t *style) {
lv_style_set_arc_color(style, lv_color_hex(0xff56f321));
};
lv_style_t *get_style_arc_INDICATOR_DEFAULT() {
static lv_style_t *style;
if (!style) {
style = lv_malloc(sizeof(lv_style_t));
lv_style_init(style);
init_style_arc_INDICATOR_DEFAULT(style);
}
return style;
};
void init_style_arc_KNOB_DEFAULT(lv_style_t *style) {
lv_style_set_bg_color(style, lv_color_hex(0xffa2f321));
};
lv_style_t *get_style_arc_KNOB_DEFAULT() {
static lv_style_t *style;
if (!style) {
style = lv_malloc(sizeof(lv_style_t));
lv_style_init(style);
init_style_arc_KNOB_DEFAULT(style);
}
return style;
};
void add_style_arc(lv_obj_t *obj) {
lv_obj_add_style(obj, get_style_arc_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_add_style(obj, get_style_arc_KNOB_DEFAULT(), LV_PART_KNOB | LV_STATE_DEFAULT);
};
void remove_style_arc(lv_obj_t *obj) {
lv_obj_remove_style(obj, get_style_arc_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_remove_style(obj, get_style_arc_KNOB_DEFAULT(), LV_PART_KNOB | LV_STATE_DEFAULT);
};
//
// Style: slider
//
void init_style_slider_MAIN_DEFAULT(lv_style_t *style) {
lv_style_set_bg_color(style, lv_color_hex(0xff2f3237));
lv_style_set_bg_opa(style, 255);
};
lv_style_t *get_style_slider_MAIN_DEFAULT() {
static lv_style_t *style;
if (!style) {
style = lv_malloc(sizeof(lv_style_t));
lv_style_init(style);
init_style_slider_MAIN_DEFAULT(style);
}
return style;
};
void init_style_slider_INDICATOR_DEFAULT(lv_style_t *style) {
lv_style_set_bg_color(style, lv_color_hex(0xff56f321));
lv_style_set_shadow_width(style, 10);
lv_style_set_shadow_color(style, lv_color_hex(0xff56f321));
};
lv_style_t *get_style_slider_INDICATOR_DEFAULT() {
static lv_style_t *style;
if (!style) {
style = lv_malloc(sizeof(lv_style_t));
lv_style_init(style);
init_style_slider_INDICATOR_DEFAULT(style);
}
return style;
};
void add_style_slider(lv_obj_t *obj) {
lv_obj_add_style(obj, get_style_slider_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_style(obj, get_style_slider_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
};
void remove_style_slider(lv_obj_t *obj) {
lv_obj_remove_style(obj, get_style_slider_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_remove_style(obj, get_style_slider_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
};
//
//
//
void add_style(lv_obj_t *obj, int32_t styleIndex) {
typedef void (*AddStyleFunc)(lv_obj_t *obj);
static const AddStyleFunc add_style_funcs[] = {
add_style_button,
add_style_arc,
add_style_slider,
};
add_style_funcs[styleIndex](obj);
}
void remove_style(lv_obj_t *obj, int32_t styleIndex) {
typedef void (*RemoveStyleFunc)(lv_obj_t *obj);
static const RemoveStyleFunc remove_style_funcs[] = {
remove_style_button,
remove_style_arc,
remove_style_slider,
};
remove_style_funcs[styleIndex](obj);
}
+33
View File
@@ -0,0 +1,33 @@
#ifndef EEZ_LVGL_UI_STYLES_H
#define EEZ_LVGL_UI_STYLES_H
#include <lvgl/lvgl.h>
#ifdef __cplusplus
extern "C" {
#endif
// Style: Button
lv_style_t *get_style_button_MAIN_DEFAULT();
void add_style_button(lv_obj_t *obj);
void remove_style_button(lv_obj_t *obj);
// Style: arc
lv_style_t *get_style_arc_INDICATOR_DEFAULT();
lv_style_t *get_style_arc_KNOB_DEFAULT();
void add_style_arc(lv_obj_t *obj);
void remove_style_arc(lv_obj_t *obj);
// Style: slider
lv_style_t *get_style_slider_MAIN_DEFAULT();
lv_style_t *get_style_slider_INDICATOR_DEFAULT();
void add_style_slider(lv_obj_t *obj);
void remove_style_slider(lv_obj_t *obj);
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_STYLES_H*/
+56
View File
@@ -0,0 +1,56 @@
#if defined(EEZ_FOR_LVGL)
#include <eez/core/vars.h>
#endif
#include "ui.h"
#include "screens.h"
#include "images.h"
#include "actions.h"
#include "vars.h"
#if defined(EEZ_FOR_LVGL)
void ui_init() {
eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images), actions);
}
void ui_tick() {
eez_flow_tick();
tick_screen(g_currentScreen);
}
#else
#include <string.h>
static int16_t currentScreen = -1;
static lv_obj_t *getLvglObjectFromIndex(int32_t index) {
if (index == -1) {
return 0;
}
return ((lv_obj_t **)&objects)[index];
}
void loadScreen(enum ScreensEnum screenId) {
currentScreen = screenId - 1;
lv_obj_t *screen = getLvglObjectFromIndex(currentScreen);
lv_scr_load_anim(screen, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
}
void ui_init() {
create_screens();
undefined
}
void ui_tick() {
tick_screen(currentScreen);
}
#endif
+33
View File
@@ -0,0 +1,33 @@
#ifndef EEZ_LVGL_UI_GUI_H
#define EEZ_LVGL_UI_GUI_H
#include <lvgl/lvgl.h>
#if defined(EEZ_FOR_LVGL)
#include <eez/flow/lvgl_api.h>
#endif
#if !defined(EEZ_FOR_LVGL)
#include "screens.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
void ui_init();
void ui_tick();
#if !defined(EEZ_FOR_LVGL)
void loadScreen(enum ScreensEnum screenId);
#endif
#ifdef __cplusplus
}
#endif
#endif // EEZ_LVGL_UI_GUI_H
+29
View File
@@ -0,0 +1,29 @@
#ifndef EEZ_LVGL_UI_VARS_H
#define EEZ_LVGL_UI_VARS_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
// enum declarations
// Flow global variables
enum FlowGlobalVariables {
FLOW_GLOBAL_VARIABLE_NONE
};
// Native global variables
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_VARS_H*/
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff