Skip to content

Adding extension support for LVGL project with EnumVariableTypes and StructureVariableTypes registering#952

Open
dhugoexe wants to merge 1 commit intoeez-open:masterfrom
dhugoexe:master
Open

Adding extension support for LVGL project with EnumVariableTypes and StructureVariableTypes registering#952
dhugoexe wants to merge 1 commit intoeez-open:masterfrom
dhugoexe:master

Conversation

@dhugoexe
Copy link

@dhugoexe dhugoexe commented Mar 3, 2026

Here is a proposal for implementing extension (PEXT) support for the LVGL project.

This feature allows users to import custom actions, structure types, and enumeration types.

Note that this does not support object variable types, as they are only used for Dashboard projects.

The "eez-studio-types" package will also need to be modified in order to compile the extension upstream (before importing it into the project).

Here is a usage example within an extension:

import type { IEezFlowEditor } from "./eez-types"; // custom version of "eez-studio-types"
import { ACTIONS } from "./custom-actions";


const Extension = {
    preInstalled: false,
    extensionType: "pext",

    eezFlowExtensionInit: (eezFlowEditor: IEezFlowEditor) => {
        const { registerActionComponent, registerEnumVariableType, registerStructureVariableType } = eezFlowEditor;

        for (const def of ACTIONS) {
            // already implemented before
            registerActionComponent(def);
        }

        registerStructureVariableType({
            name: "program_spindle",
            fields: [
                { name: "active", type: "boolean" },
                { name: "force", type: "float" },
                { name: "adjustForce", type: "float" }
            ]
        });

        registerStructureVariableType({
            name: "program",
            fields: [
                { name: "name", type: "string" },
                { name: "oldName", type: "string" },
                { name: "createdOn", type: "integer" },
                { name: "createdBy", type: "string" },
                { name: "modifiedOn", type: "integer" },
                { name: "modifiedBy", type: "string" },
                { name: "spindle1", type: "struct:Extension-name/program_spindle" },
                { name: "spindle2", type: "struct:Extension-name/program_spindle" },
                { name: "spindle3", type: "struct:Extension-name/program_spindle" },
                { name: "spindle4", type: "struct:Extension-name/program_spindle" },
                { name: "spindle5", type: "struct:Extension-name/program_spindle" }
            ]
        });

        registerEnumVariableType({
            name: "TarStatus",
            members: [
                { name: "TAR_FAILED", value: -1 },
                { name: "TAR_SUCCESS", value: 0 },
                { name: "TATAR_DEFAULT", value: 1 }
            ]
        });
    }
};

Note that you should use a modified version of "eez-studio-types" package with corresponding interface for compilating this extension.

PS: I have also developed features for native implementation support of imported actions (for on-target execution), as well as the ability to import extensions from a Git repository (same principle as for templates), in case anyone finds this useful for the project.

@mvladic
Copy link
Contributor

mvladic commented Mar 3, 2026

Do you have an extension example with which I can test it?

@dhugoexe
Copy link
Author

dhugoexe commented Mar 3, 2026

@mvladic you can use this sample extension: https://github.com/dhugoexe/eez-extension-sample

@mvladic
Copy link
Contributor

mvladic commented Mar 4, 2026

Maybe I'm missing something, but I don't see any real value of these improvements to the extensions interface. User defined structure and enumeration types can already be created in Studio and they are supported in LVGL projects. Actions are already supported by the extensions interface, but they are only available for the execution inside Studio simulator. What would be more interesting is to allow defining custom actions from the extension that would be able not only to execute inside Studio simulator but also on the target device - which means these actions should define C code that will be generated along with other generated C code.

If you can explain what real problem you are solving with these changes I will reconsider to marge this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants