Skip to content

Commit

Permalink
do not add LVGL widgets to the execution queue
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jan 30, 2025
1 parent 49cd2d5 commit 4f35420
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 52 deletions.
4 changes: 3 additions & 1 deletion packages/project-editor/build/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ import {
} from "project-editor/build/helper";
import {
FIRST_DASHBOARD_ACTION_COMPONENT_TYPE,
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE,
FIRST_LVGL_WIDGET_COMPONENT_TYPE
} from "project-editor/flow/components/component-types";

import { DummyDataBuffer, DataBuffer } from "project-editor/build/data-buffer";
Expand Down Expand Up @@ -170,6 +171,7 @@ export class Assets {
} = {};
nextDashboardActionComponentId = FIRST_DASHBOARD_ACTION_COMPONENT_TYPE;
nextDashboardWidgetComponentId = FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE;
nextLVGLWidgetComponentId = FIRST_LVGL_WIDGET_COMPONENT_TYPE;
dashboardComponentTypeToNameMap: {
[componentType: number]: string;
} = {};
Expand Down
14 changes: 12 additions & 2 deletions packages/project-editor/build/flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import {
import { makeEndInstruction } from "project-editor/flow/expression/instructions";
import {
FIRST_DASHBOARD_ACTION_COMPONENT_TYPE,
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE,
FIRST_LVGL_WIDGET_COMPONENT_TYPE
} from "project-editor/flow/components/component-types";
import {
BASIC_TYPE_NAMES,
Expand Down Expand Up @@ -107,7 +108,12 @@ function getComponentIdOfComponent(assets: Assets, component: Component) {
if (component instanceof ProjectEditor.ActionComponentClass) {
flowComponentId = assets.nextDashboardActionComponentId++;
} else {
flowComponentId = assets.nextDashboardWidgetComponentId++;
if (assets.projectStore.projectTypeTraits.isLVGL) {
flowComponentId = assets.nextLVGLWidgetComponentId++;
} else {
flowComponentId =
assets.nextDashboardWidgetComponentId++;
}
}
assets.dashboardComponentClassNameToComponentIdMap[name] =
flowComponentId;
Expand Down Expand Up @@ -529,6 +535,10 @@ export function buildFlowDefs(assets: Assets) {
`${TAB}FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE = ${FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE}`
);

componentTypeEnumItems.push(
`${TAB}FIRST_LVGL_WIDGET_COMPONENT_TYPE = ${FIRST_LVGL_WIDGET_COMPONENT_TYPE}`
);

defs.push(
`enum ComponentTypes {\n${componentTypeEnumItems.join(",\n")}\n};`
);
Expand Down
2 changes: 2 additions & 0 deletions packages/project-editor/flow/components/component-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ export const COMPONENT_TYPE_SET_COLOR_THEME_ACTION = 1045;

export const FIRST_DASHBOARD_ACTION_COMPONENT_TYPE = 10000;
export const FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE = 20000;

export const FIRST_LVGL_WIDGET_COMPONENT_TYPE = 30000;
Binary file modified packages/project-editor/flow/runtime/eez_runtime.wasm
Binary file not shown.
Binary file modified packages/project-editor/flow/runtime/lvgl_runtime_v8.3.wasm
Binary file not shown.
Binary file modified packages/project-editor/flow/runtime/lvgl_runtime_v9.0.wasm
Binary file not shown.
91 changes: 45 additions & 46 deletions resources/eez-framework-amalgamation/eez-flow.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Autogenerated on January 29, 2025 3:46:07 PM from eez-framework commit bc909755c9b83d15689e53474f6339176a299ac7 */
/* Autogenerated on January 30, 2025 2:10:05 PM from eez-framework commit ac84fe0e07a96635c7c1920fbbc2712f6fc42cd3 */
/*
* eez-framework
*
Expand Down Expand Up @@ -7539,53 +7539,49 @@ extern "C" void flowPropagateValueUint32(void *flowState, unsigned componentInde
}
extern "C" void flowPropagateValueLVGLEvent(void *flowState, unsigned componentIndex, unsigned outputIndex, lv_event_t *event) {
lv_event_code_t event_code = lv_event_get_code(event);
if (eez::flow::hasAnyDataConnection((eez::flow::FlowState *)flowState, componentIndex, outputIndex)) {
uint32_t code = (uint32_t)event_code;
void *currentTarget = (void *)lv_event_get_current_target(event);
void *target = (void *)lv_event_get_target(event);
void *userDataPointer = lv_event_get_user_data(event);
int32_t userData = *((int32_t*)(&userDataPointer));
uint32_t key = 0;
if (event_code == LV_EVENT_KEY || (event_code == LV_EVENT_VALUE_CHANGED &&
#if LVGL_VERSION_MAJOR >= 9
lv_obj_check_type((lv_obj_t*)target, &lv_buttonmatrix_class)
#else
lv_obj_check_type((lv_obj_t*)target, &lv_btnmatrix_class)
#endif
)) {
uint32_t *param = (uint32_t *)lv_event_get_param(event);
key = param ? *param : 0;
}
int32_t gestureDir = (int32_t)LV_DIR_NONE;
if (event_code == LV_EVENT_GESTURE) {
#if LVGL_VERSION_MAJOR >= 9
lv_indev_wait_release(lv_indev_active());
#else
lv_indev_wait_release(lv_indev_get_act());
#endif
gestureDir = (int32_t)lv_indev_get_gesture_dir(
#if LVGL_VERSION_MAJOR >= 9
lv_indev_active()
#else
lv_indev_get_act()
#endif
);
}
int32_t rotaryDiff = 0;
#if LVGL_VERSION_MAJOR >= 9
if (event_code == LV_EVENT_ROTARY) {
rotaryDiff = lv_event_get_rotary_diff(event);
}
#endif
eez::flow::propagateValue(
(eez::flow::FlowState *)flowState, componentIndex, outputIndex,
eez::Value::makeLVGLEventRef(
code, currentTarget, target, userData, key, gestureDir, rotaryDiff, 0xe7f23624
)
uint32_t code = (uint32_t)event_code;
void *currentTarget = (void *)lv_event_get_current_target(event);
void *target = (void *)lv_event_get_target(event);
void *userDataPointer = lv_event_get_user_data(event);
int32_t userData = *((int32_t*)(&userDataPointer));
uint32_t key = 0;
if (event_code == LV_EVENT_KEY || (event_code == LV_EVENT_VALUE_CHANGED &&
#if LVGL_VERSION_MAJOR >= 9
lv_obj_check_type((lv_obj_t*)target, &lv_buttonmatrix_class)
#else
lv_obj_check_type((lv_obj_t*)target, &lv_btnmatrix_class)
#endif
)) {
uint32_t *param = (uint32_t *)lv_event_get_param(event);
key = param ? *param : 0;
}
int32_t gestureDir = (int32_t)LV_DIR_NONE;
if (event_code == LV_EVENT_GESTURE) {
#if LVGL_VERSION_MAJOR >= 9
lv_indev_wait_release(lv_indev_active());
#else
lv_indev_wait_release(lv_indev_get_act());
#endif
gestureDir = (int32_t)lv_indev_get_gesture_dir(
#if LVGL_VERSION_MAJOR >= 9
lv_indev_active()
#else
lv_indev_get_act()
#endif
);
} else {
eez::flow::propagateValue((eez::flow::FlowState *)flowState, componentIndex, outputIndex);
}
int32_t rotaryDiff = 0;
#if LVGL_VERSION_MAJOR >= 9
if (event_code == LV_EVENT_ROTARY) {
rotaryDiff = lv_event_get_rotary_diff(event);
}
#endif
eez::flow::propagateValue(
(eez::flow::FlowState *)flowState, componentIndex, outputIndex,
eez::Value::makeLVGLEventRef(
code, currentTarget, target, userData, key, gestureDir, rotaryDiff, 0xe7f23624
)
);
if (!lv_disp_get_default()->rendering_in_progress) {
g_currentLVGLEvent = event;
eez::flow::tick();
Expand Down Expand Up @@ -10089,6 +10085,9 @@ bool isComponentReadyToRun(FlowState *flowState, unsigned componentIndex) {
if (component->type == defs_v3::COMPONENT_TYPE_LABEL_IN_ACTION) {
return false;
}
if (component->type > defs_v3::FIRST_LVGL_WIDGET_COMPONENT_TYPE) {
return false;
}
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) {
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions resources/eez-framework-amalgamation/eez-flow.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Autogenerated on January 29, 2025 3:46:07 PM from eez-framework commit bc909755c9b83d15689e53474f6339176a299ac7 */
/* Autogenerated on January 30, 2025 2:10:05 PM from eez-framework commit ac84fe0e07a96635c7c1920fbbc2712f6fc42cd3 */
/*
* eez-framework
*
Expand Down Expand Up @@ -294,7 +294,8 @@ enum ComponentTypes {
COMPONENT_TYPE_LVGL_ACTION = 1044,
COMPONENT_TYPE_SET_COLOR_THEME_ACTION = 1045,
FIRST_DASHBOARD_ACTION_COMPONENT_TYPE = 10000,
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE = 20000
FIRST_DASHBOARD_WIDGET_COMPONENT_TYPE = 20000,
FIRST_LVGL_WIDGET_COMPONENT_TYPE = 30000
};
enum Component_CONTAINER_WIDGET_Properties {
CONTAINER_WIDGET_PROPERTY_DATA = 0,
Expand Down
2 changes: 1 addition & 1 deletion wasm/eez-framework

0 comments on commit 4f35420

Please sign in to comment.