diff --git a/packages/project-editor/build/assets.ts b/packages/project-editor/build/assets.ts index a55f7609..3f6ea514 100644 --- a/packages/project-editor/build/assets.ts +++ b/packages/project-editor/build/assets.ts @@ -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"; @@ -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; } = {}; diff --git a/packages/project-editor/build/flows.ts b/packages/project-editor/build/flows.ts index e4ed91f8..8e497330 100644 --- a/packages/project-editor/build/flows.ts +++ b/packages/project-editor/build/flows.ts @@ -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, @@ -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; @@ -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};` ); diff --git a/packages/project-editor/flow/components/component-types.ts b/packages/project-editor/flow/components/component-types.ts index d92ecf2a..0c6db5e5 100644 --- a/packages/project-editor/flow/components/component-types.ts +++ b/packages/project-editor/flow/components/component-types.ts @@ -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; diff --git a/packages/project-editor/flow/runtime/eez_runtime.wasm b/packages/project-editor/flow/runtime/eez_runtime.wasm index 6f04c095..756aa96f 100644 Binary files a/packages/project-editor/flow/runtime/eez_runtime.wasm and b/packages/project-editor/flow/runtime/eez_runtime.wasm differ diff --git a/packages/project-editor/flow/runtime/lvgl_runtime_v8.3.wasm b/packages/project-editor/flow/runtime/lvgl_runtime_v8.3.wasm index fddf5f2d..a6bfb6b9 100644 Binary files a/packages/project-editor/flow/runtime/lvgl_runtime_v8.3.wasm and b/packages/project-editor/flow/runtime/lvgl_runtime_v8.3.wasm differ diff --git a/packages/project-editor/flow/runtime/lvgl_runtime_v9.0.wasm b/packages/project-editor/flow/runtime/lvgl_runtime_v9.0.wasm index 8a284795..55a394bb 100644 Binary files a/packages/project-editor/flow/runtime/lvgl_runtime_v9.0.wasm and b/packages/project-editor/flow/runtime/lvgl_runtime_v9.0.wasm differ diff --git a/resources/eez-framework-amalgamation/eez-flow.cpp b/resources/eez-framework-amalgamation/eez-flow.cpp index 23cee72e..0602b4fe 100644 --- a/resources/eez-framework-amalgamation/eez-flow.cpp +++ b/resources/eez-framework-amalgamation/eez-flow.cpp @@ -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 * @@ -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(); @@ -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; } diff --git a/resources/eez-framework-amalgamation/eez-flow.h b/resources/eez-framework-amalgamation/eez-flow.h index bc25186e..c803bd55 100644 --- a/resources/eez-framework-amalgamation/eez-flow.h +++ b/resources/eez-framework-amalgamation/eez-flow.h @@ -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 * @@ -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, diff --git a/wasm/eez-framework b/wasm/eez-framework index ac84fe0e..b4f42bf8 160000 --- a/wasm/eez-framework +++ b/wasm/eez-framework @@ -1 +1 @@ -Subproject commit ac84fe0e07a96635c7c1920fbbc2712f6fc42cd3 +Subproject commit b4f42bf8825f781873c71338a28722f165545500