Skip to content

Commit 65311c5

Browse files
committed
#229 ui_create_groups added
1 parent d1975b8 commit 65311c5

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

packages/project-editor/lvgl/build.ts

+27-3
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ export class LVGLBuild extends Build {
361361
build.line("");
362362
build.line(`extern groups_t groups;`);
363363
build.line("");
364+
build.line(`void ui_create_groups();`);
365+
build.line("");
364366
}
365367

366368
// objects
@@ -435,6 +437,8 @@ export class LVGLBuild extends Build {
435437

436438
if (this.project.lvglGroups.groups.length > 0) {
437439
build.line(`groups_t groups;`);
440+
build.line("static bool groups_created = false;");
441+
build.line("");
438442
}
439443

440444
build.line(`objects_t objects;`);
@@ -722,10 +726,13 @@ export class LVGLBuild extends Build {
722726
build.line("");
723727
}
724728

725-
build.line("void create_screens() {");
726-
build.indent();
727-
728729
if (this.project.lvglGroups.groups.length > 0) {
730+
build.line("void ui_create_groups() {");
731+
build.indent();
732+
733+
build.line("if (!groups_created) {");
734+
build.indent();
735+
729736
this.project.lvglGroups.groups.forEach(group => {
730737
build.line(
731738
`${build.getGroupVariableName(group)} = lv_group_create();`
@@ -734,6 +741,23 @@ export class LVGLBuild extends Build {
734741
build.line(
735742
"eez_flow_init_groups((lv_group_t **)&groups, sizeof(groups) / sizeof(lv_group_t *));"
736743
);
744+
745+
build.line("groups_created = true;");
746+
747+
build.unindent();
748+
build.line("}");
749+
750+
build.unindent();
751+
build.line("}");
752+
753+
build.line("");
754+
}
755+
756+
build.line("void create_screens() {");
757+
build.indent();
758+
759+
if (this.project.lvglGroups.groups.length > 0) {
760+
build.line("ui_create_groups();");
737761
build.line("");
738762
}
739763

0 commit comments

Comments
 (0)