Skip to content

Commit f6ab29e

Browse files
committed
1 parent 097d62e commit f6ab29e

File tree

18 files changed

+740
-256
lines changed

18 files changed

+740
-256
lines changed

packages/main/main.ts

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ app.on("ready", async function () {
5656
const { bringHomeWindowToFocus } =
5757
require("main/home-window") as typeof HomeWindowModule;
5858
bringHomeWindowToFocus();
59-
6059
const { openFile } = require("main/menu");
6160
openFile(commandLine[commandLine.length - 1]);
6261
});

packages/project-editor/core/object.ts

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const enum PropertyType {
5050

5151
GUID,
5252

53+
NumberArrayAsString,
5354
StringArray,
5455
ConfigurationReference,
5556
Any,
@@ -79,6 +80,7 @@ export const TYPE_NAMES: { [key in PropertyType]: string } = {
7980
[PropertyType.Python]: "Python",
8081
[PropertyType.CPP]: "CPP",
8182
[PropertyType.GUID]: "GUID",
83+
[PropertyType.NumberArrayAsString]: "NumberArrayAsString",
8284
[PropertyType.StringArray]: "StringArray",
8385
[PropertyType.ConfigurationReference]: "ConfigurationReference",
8486
[PropertyType.Any]: "Any",

packages/project-editor/flow/runtime/cpp/lvgl-runtime/common/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ EM_PORT_API(void) init(uint32_t wasmModuleId, uint32_t debuggerMessageSubsciptio
333333

334334
initialized = true;
335335

336-
// dump_custom_styles();
336+
//dump_custom_styles();
337337
}
338338

339339
EM_PORT_API(bool) mainLoop() {

packages/project-editor/flow/runtime/cpp/lvgl-runtime/v9.0/lv_conf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@
780780
#define LV_USE_MONKEY 0
781781

782782
/*1: Enable grid navigation*/
783-
#define LV_USE_GRIDNAV 0
783+
#define LV_USE_GRIDNAV 1
784784

785785
/*1: Enable lv_obj fragment*/
786786
#define LV_USE_FRAGMENT 0

packages/project-editor/flow/runtime/lvgl_runtime_v8.3.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -969,20 +969,20 @@ function dbg(text) {
969969
// === Body ===
970970

971971
var ASM_CONSTS = {
972-
1036472: ($0) => { startToDebuggerMessage($0); },
973-
1036504: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
974-
1036579: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
975-
1036654: ($0) => { finishToDebuggerMessage($0); },
976-
1036687: ($0, $1) => { return getLvglImageByName($0, UTF8ToString($1)); },
977-
1036740: ($0, $1, $2) => { lvglObjAddStyle($0, $1, $2); },
978-
1036773: ($0, $1, $2) => { lvglObjRemoveStyle($0, $1, $2); },
979-
1036809: ($0, $1, $2, $3, $4, $5) => { return eez_mqtt_init($0, UTF8ToString($1), UTF8ToString($2), $3, UTF8ToString($4), UTF8ToString($5)); },
980-
1036915: ($0, $1) => { return eez_mqtt_deinit($0, $1); },
981-
1036951: ($0, $1) => { return eez_mqtt_connect($0, $1); },
982-
1036988: ($0, $1) => { return eez_mqtt_disconnect($0, $1); },
983-
1037028: ($0, $1, $2) => { return eez_mqtt_subscribe($0, $1, UTF8ToString($2)); },
984-
1037085: ($0, $1, $2) => { return eez_mqtt_unsubscribe($0, $1, UTF8ToString($2)); },
985-
1037144: ($0, $1, $2, $3) => { return eez_mqtt_publish($0, $1, UTF8ToString($2), UTF8ToString($3)); }
972+
1036552: ($0) => { startToDebuggerMessage($0); },
973+
1036584: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
974+
1036659: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
975+
1036734: ($0) => { finishToDebuggerMessage($0); },
976+
1036767: ($0, $1) => { return getLvglImageByName($0, UTF8ToString($1)); },
977+
1036820: ($0, $1, $2) => { lvglObjAddStyle($0, $1, $2); },
978+
1036853: ($0, $1, $2) => { lvglObjRemoveStyle($0, $1, $2); },
979+
1036889: ($0, $1, $2, $3, $4, $5) => { return eez_mqtt_init($0, UTF8ToString($1), UTF8ToString($2), $3, UTF8ToString($4), UTF8ToString($5)); },
980+
1036995: ($0, $1) => { return eez_mqtt_deinit($0, $1); },
981+
1037031: ($0, $1) => { return eez_mqtt_connect($0, $1); },
982+
1037068: ($0, $1) => { return eez_mqtt_disconnect($0, $1); },
983+
1037108: ($0, $1, $2) => { return eez_mqtt_subscribe($0, $1, UTF8ToString($2)); },
984+
1037165: ($0, $1, $2) => { return eez_mqtt_unsubscribe($0, $1, UTF8ToString($2)); },
985+
1037224: ($0, $1, $2, $3) => { return eez_mqtt_publish($0, $1, UTF8ToString($2), UTF8ToString($3)); }
986986
};
987987

988988

Binary file not shown.

packages/project-editor/lvgl/lvgl-constants.ts

+8
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ export const LV_FLEX_ALIGN_SPACE_EVENLY = 3;
187187
export const LV_FLEX_ALIGN_SPACE_AROUND = 4;
188188
export const LV_FLEX_ALIGN_SPACE_BETWEEN = 5;
189189

190+
export const LV_GRID_ALIGN_START = 0;
191+
export const LV_GRID_ALIGN_CENTER = 1;
192+
export const LV_GRID_ALIGN_END = 2;
193+
export const LV_GRID_ALIGN_STRETCH = 3;
194+
export const LV_GRID_ALIGN_SPACE_EVENLY = 4;
195+
export const LV_GRID_ALIGN_SPACE_AROUND = 5;
196+
export const LV_GRID_ALIGN_SPACE_BETWEEN = 6;
197+
190198
const LV_SCROLLBAR_MODE_OFF = 0;
191199
const LV_SCROLLBAR_MODE_ON = 1;
192200
const LV_SCROLLBAR_MODE_ACTIVE = 2;

packages/project-editor/lvgl/page-runtime.ts

+33-11
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,30 @@ export abstract class LVGLPageRuntime {
220220
return cashedFont.fontPtr;
221221
}
222222

223-
strings: number[] = [];
223+
pointers: number[] = [];
224224

225225
allocateUTF8(str: string, free: boolean) {
226226
const stringPtr = this.wasm.allocateUTF8(str);
227227
if (free) {
228-
this.strings.push(stringPtr);
228+
this.pointers.push(stringPtr);
229229
}
230230
return stringPtr;
231231
}
232232

233-
freeStrings() {
234-
for (const stringPtr of this.strings) {
235-
this.wasm._free(stringPtr);
233+
allocateInt32Array(arr: number[], free: boolean) {
234+
const ptr = this.wasm._malloc(arr.length * 4);
235+
if (free) {
236+
this.pointers.push(ptr);
236237
}
237-
this.strings = [];
238+
this.wasm.HEAP32.set(arr, ptr / 4);
239+
return ptr;
240+
}
241+
242+
freePointers() {
243+
for (const ptr of this.pointers) {
244+
this.wasm._free(ptr);
245+
}
246+
this.pointers = [];
238247
}
239248

240249
static detachRuntimeFromPage(page: Page) {
@@ -306,6 +315,7 @@ export class LVGLPageEditorRuntime extends LVGLPageRuntime {
306315
autorRunDispose: IReactionDisposer | undefined;
307316
dispose2: IReactionDisposer | undefined;
308317
requestAnimationFrameId: number | undefined;
318+
wasError: boolean = false;
309319

310320
constructor(
311321
page: Page,
@@ -378,6 +388,17 @@ export class LVGLPageEditorRuntime extends LVGLPageRuntime {
378388
return;
379389
}
380390

391+
this.project._store.lastRevision;
392+
393+
if (this.wasError) {
394+
setTimeout(() => {
395+
this.unmount();
396+
this.wasError = false;
397+
this.mount();
398+
});
399+
return;
400+
}
401+
381402
if (this.dispose2) {
382403
this.dispose2();
383404
this.dispose2 = undefined;
@@ -393,7 +414,7 @@ export class LVGLPageEditorRuntime extends LVGLPageRuntime {
393414

394415
this.wasm._lvglClearTimeline();
395416

396-
this.freeStrings();
417+
this.freePointers();
397418

398419
this.createStyles();
399420

@@ -460,10 +481,7 @@ export class LVGLPageEditorRuntime extends LVGLPageRuntime {
460481
});
461482
} catch (e) {
462483
console.error(e);
463-
setTimeout(() => {
464-
this.unmount();
465-
this.mount();
466-
});
484+
this.wasError = true;
467485
}
468486
});
469487
}
@@ -500,6 +518,10 @@ export class LVGLPageEditorRuntime extends LVGLPageRuntime {
500518
this.displayWidth,
501519
this.displayHeight
502520
);
521+
} else {
522+
if (this.wasError) {
523+
this.ctx.clearRect(0, 0, this.displayWidth, this.displayHeight);
524+
}
503525
}
504526

505527
this.requestAnimationFrameId = window.requestAnimationFrame(this.tick);

0 commit comments

Comments
 (0)