Skip to content

Commit 4f35420

Browse files
committed
do not add LVGL widgets to the execution queue
1 parent 49cd2d5 commit 4f35420

File tree

9 files changed

+66
-52
lines changed

9 files changed

+66
-52
lines changed

packages/project-editor/build/assets.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ import {
8080
} from "project-editor/build/helper";
8181
import {
8282
FIRST_DASHBOARD_ACTION_COMPONENT_TYPE,
83-
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE
83+
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE,
84+
FIRST_LVGL_WIDGET_COMPONENT_TYPE
8485
} from "project-editor/flow/components/component-types";
8586

8687
import { DummyDataBuffer, DataBuffer } from "project-editor/build/data-buffer";
@@ -170,6 +171,7 @@ export class Assets {
170171
} = {};
171172
nextDashboardActionComponentId = FIRST_DASHBOARD_ACTION_COMPONENT_TYPE;
172173
nextDashboardWidgetComponentId = FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE;
174+
nextLVGLWidgetComponentId = FIRST_LVGL_WIDGET_COMPONENT_TYPE;
173175
dashboardComponentTypeToNameMap: {
174176
[componentType: number]: string;
175177
} = {};

packages/project-editor/build/flows.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ import {
3939
import { makeEndInstruction } from "project-editor/flow/expression/instructions";
4040
import {
4141
FIRST_DASHBOARD_ACTION_COMPONENT_TYPE,
42-
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE
42+
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE,
43+
FIRST_LVGL_WIDGET_COMPONENT_TYPE
4344
} from "project-editor/flow/components/component-types";
4445
import {
4546
BASIC_TYPE_NAMES,
@@ -107,7 +108,12 @@ function getComponentIdOfComponent(assets: Assets, component: Component) {
107108
if (component instanceof ProjectEditor.ActionComponentClass) {
108109
flowComponentId = assets.nextDashboardActionComponentId++;
109110
} else {
110-
flowComponentId = assets.nextDashboardWidgetComponentId++;
111+
if (assets.projectStore.projectTypeTraits.isLVGL) {
112+
flowComponentId = assets.nextLVGLWidgetComponentId++;
113+
} else {
114+
flowComponentId =
115+
assets.nextDashboardWidgetComponentId++;
116+
}
111117
}
112118
assets.dashboardComponentClassNameToComponentIdMap[name] =
113119
flowComponentId;
@@ -529,6 +535,10 @@ export function buildFlowDefs(assets: Assets) {
529535
`${TAB}FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE = ${FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE}`
530536
);
531537

538+
componentTypeEnumItems.push(
539+
`${TAB}FIRST_LVGL_WIDGET_COMPONENT_TYPE = ${FIRST_LVGL_WIDGET_COMPONENT_TYPE}`
540+
);
541+
532542
defs.push(
533543
`enum ComponentTypes {\n${componentTypeEnumItems.join(",\n")}\n};`
534544
);

packages/project-editor/flow/components/component-types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,5 @@ export const COMPONENT_TYPE_SET_COLOR_THEME_ACTION = 1045;
7777

7878
export const FIRST_DASHBOARD_ACTION_COMPONENT_TYPE = 10000;
7979
export const FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE = 20000;
80+
81+
export const FIRST_LVGL_WIDGET_COMPONENT_TYPE = 30000;
Binary file not shown.
Binary file not shown.
Binary file not shown.

resources/eez-framework-amalgamation/eez-flow.cpp

+45-46
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Autogenerated on January 29, 2025 3:46:07 PM from eez-framework commit bc909755c9b83d15689e53474f6339176a299ac7 */
1+
/* Autogenerated on January 30, 2025 2:10:05 PM from eez-framework commit ac84fe0e07a96635c7c1920fbbc2712f6fc42cd3 */
22
/*
33
* eez-framework
44
*
@@ -7539,53 +7539,49 @@ extern "C" void flowPropagateValueUint32(void *flowState, unsigned componentInde
75397539
}
75407540
extern "C" void flowPropagateValueLVGLEvent(void *flowState, unsigned componentIndex, unsigned outputIndex, lv_event_t *event) {
75417541
lv_event_code_t event_code = lv_event_get_code(event);
7542-
if (eez::flow::hasAnyDataConnection((eez::flow::FlowState *)flowState, componentIndex, outputIndex)) {
7543-
uint32_t code = (uint32_t)event_code;
7544-
void *currentTarget = (void *)lv_event_get_current_target(event);
7545-
void *target = (void *)lv_event_get_target(event);
7546-
void *userDataPointer = lv_event_get_user_data(event);
7547-
int32_t userData = *((int32_t*)(&userDataPointer));
7548-
uint32_t key = 0;
7549-
if (event_code == LV_EVENT_KEY || (event_code == LV_EVENT_VALUE_CHANGED &&
7550-
#if LVGL_VERSION_MAJOR >= 9
7551-
lv_obj_check_type((lv_obj_t*)target, &lv_buttonmatrix_class)
7552-
#else
7553-
lv_obj_check_type((lv_obj_t*)target, &lv_btnmatrix_class)
7554-
#endif
7555-
)) {
7556-
uint32_t *param = (uint32_t *)lv_event_get_param(event);
7557-
key = param ? *param : 0;
7558-
}
7559-
int32_t gestureDir = (int32_t)LV_DIR_NONE;
7560-
if (event_code == LV_EVENT_GESTURE) {
7561-
#if LVGL_VERSION_MAJOR >= 9
7562-
lv_indev_wait_release(lv_indev_active());
7563-
#else
7564-
lv_indev_wait_release(lv_indev_get_act());
7565-
#endif
7566-
gestureDir = (int32_t)lv_indev_get_gesture_dir(
7567-
#if LVGL_VERSION_MAJOR >= 9
7568-
lv_indev_active()
7569-
#else
7570-
lv_indev_get_act()
7571-
#endif
7572-
);
7573-
}
7574-
int32_t rotaryDiff = 0;
7575-
#if LVGL_VERSION_MAJOR >= 9
7576-
if (event_code == LV_EVENT_ROTARY) {
7577-
rotaryDiff = lv_event_get_rotary_diff(event);
7578-
}
7579-
#endif
7580-
eez::flow::propagateValue(
7581-
(eez::flow::FlowState *)flowState, componentIndex, outputIndex,
7582-
eez::Value::makeLVGLEventRef(
7583-
code, currentTarget, target, userData, key, gestureDir, rotaryDiff, 0xe7f23624
7584-
)
7542+
uint32_t code = (uint32_t)event_code;
7543+
void *currentTarget = (void *)lv_event_get_current_target(event);
7544+
void *target = (void *)lv_event_get_target(event);
7545+
void *userDataPointer = lv_event_get_user_data(event);
7546+
int32_t userData = *((int32_t*)(&userDataPointer));
7547+
uint32_t key = 0;
7548+
if (event_code == LV_EVENT_KEY || (event_code == LV_EVENT_VALUE_CHANGED &&
7549+
#if LVGL_VERSION_MAJOR >= 9
7550+
lv_obj_check_type((lv_obj_t*)target, &lv_buttonmatrix_class)
7551+
#else
7552+
lv_obj_check_type((lv_obj_t*)target, &lv_btnmatrix_class)
7553+
#endif
7554+
)) {
7555+
uint32_t *param = (uint32_t *)lv_event_get_param(event);
7556+
key = param ? *param : 0;
7557+
}
7558+
int32_t gestureDir = (int32_t)LV_DIR_NONE;
7559+
if (event_code == LV_EVENT_GESTURE) {
7560+
#if LVGL_VERSION_MAJOR >= 9
7561+
lv_indev_wait_release(lv_indev_active());
7562+
#else
7563+
lv_indev_wait_release(lv_indev_get_act());
7564+
#endif
7565+
gestureDir = (int32_t)lv_indev_get_gesture_dir(
7566+
#if LVGL_VERSION_MAJOR >= 9
7567+
lv_indev_active()
7568+
#else
7569+
lv_indev_get_act()
7570+
#endif
75857571
);
7586-
} else {
7587-
eez::flow::propagateValue((eez::flow::FlowState *)flowState, componentIndex, outputIndex);
75887572
}
7573+
int32_t rotaryDiff = 0;
7574+
#if LVGL_VERSION_MAJOR >= 9
7575+
if (event_code == LV_EVENT_ROTARY) {
7576+
rotaryDiff = lv_event_get_rotary_diff(event);
7577+
}
7578+
#endif
7579+
eez::flow::propagateValue(
7580+
(eez::flow::FlowState *)flowState, componentIndex, outputIndex,
7581+
eez::Value::makeLVGLEventRef(
7582+
code, currentTarget, target, userData, key, gestureDir, rotaryDiff, 0xe7f23624
7583+
)
7584+
);
75897585
if (!lv_disp_get_default()->rendering_in_progress) {
75907586
g_currentLVGLEvent = event;
75917587
eez::flow::tick();
@@ -10089,6 +10085,9 @@ bool isComponentReadyToRun(FlowState *flowState, unsigned componentIndex) {
1008910085
if (component->type == defs_v3::COMPONENT_TYPE_LABEL_IN_ACTION) {
1009010086
return false;
1009110087
}
10088+
if (component->type > defs_v3::FIRST_LVGL_WIDGET_COMPONENT_TYPE) {
10089+
return false;
10090+
}
1009210091
if ((component->type < defs_v3::COMPONENT_TYPE_START_ACTION && component->type != defs_v3::COMPONENT_TYPE_USER_WIDGET_WIDGET) || component->type >= defs_v3::FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE) {
1009310092
return true;
1009410093
}

resources/eez-framework-amalgamation/eez-flow.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Autogenerated on January 29, 2025 3:46:07 PM from eez-framework commit bc909755c9b83d15689e53474f6339176a299ac7 */
1+
/* Autogenerated on January 30, 2025 2:10:05 PM from eez-framework commit ac84fe0e07a96635c7c1920fbbc2712f6fc42cd3 */
22
/*
33
* eez-framework
44
*
@@ -294,7 +294,8 @@ enum ComponentTypes {
294294
COMPONENT_TYPE_LVGL_ACTION = 1044,
295295
COMPONENT_TYPE_SET_COLOR_THEME_ACTION = 1045,
296296
FIRST_DASHBOARD_ACTION_COMPONENT_TYPE = 10000,
297-
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE = 20000
297+
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE = 20000,
298+
FIRST_LVGL_WIDGET_COMPONENT_TYPE = 30000
298299
};
299300
enum Component_CONTAINER_WIDGET_Properties {
300301
CONTAINER_WIDGET_PROPERTY_DATA = 0,

0 commit comments

Comments
 (0)