elk
elk copied to clipboard
Timer function makes esp32 reboot.
When I use timer in JS code it makes esp32 crash. The code runs for some minutes, but then it crashes. Any idea of what should be?
` 7c8a3 2 JS.h:2071:js_timer_fn Calling JS: main(); Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump: PC : 0x40128533 PS : 0x00060a30 A0 : 0x8012c2ae A1 : 0x3ffb2540 A2 : 0xbff503a8 A3 : 0x3fff03a8 A4 : 0x7ff60000 A5 : 0x00000e2c A6 : 0x3f401905 A7 : 0x00000004 A8 : 0xfffffffc A9 : 0x00000000 A10 : 0x00000000 A11 : 0x3ffceb14 A12 : 0x3ffc3ca8 A13 : 0x00000011 A14 : 0x3ffccfb8 A15 : 0x00000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c EXCVADDR: 0xbff503a8 LBEG : 0x401284ac LEND : 0x40128500 LCOUNT : 0x00000002
Backtrace:0x40144900:0x3ffb25100x401487b1:0x3ffb2540 0x401489e9:0x3ffb2570 0x40148a71:0x3ffb2590 0x40148af9:0x3ffb25b0 0x40148bc5:0x3ffb25d0 0x40148cb5:0x3ffb25f0 0x40148d5d:0x3ffb2610 0x40148de1:0x3ffb2630 0x40147831:0x3ffb2650 0x40147a29:0x3ffb2690 0x40147bb1:0x3ffb26d0 0x40147d69:0x3ffb2700 0x40146067:0x3ffb2720 0x4014919d:0x3ffb2770 0x400ea921:0x3ffb27b0 0x4011fb4e:0x3ffb27d0 0x40150629:0x3ffb2820
#0 0x40144900:0x3ffb2510 in lkp at .pio/libdeps/latest_stable/elk/elk.c:589 #1 0x401487b1:0x3ffb2540 in lookup at .pio/libdeps/latest_stable/elk/elk.c:606 (inlined by) js_call_dot at .pio/libdeps/latest_stable/elk/elk.c:979 (inlined by) js_postfix at .pio/libdeps/latest_stable/elk/elk.c:995 (inlined by) js_unary at .pio/libdeps/latest_stable/elk/elk.c:1014 #2 0x401489e9:0x3ffb2570 in js_mul_div_rem at .pio/libdeps/latest_stable/elk/elk.c:1019 #3 0x40148a71:0x3ffb2590 in js_plus_minus at .pio/libdeps/latest_stable/elk/elk.c:1024 #4 0x40148af9:0x3ffb25b0 in js_shifts at .pio/libdeps/latest_stable/elk/elk.c:1028 #5 0x40148bc5:0x3ffb25d0 in js_comparison at .pio/libdeps/latest_stable/elk/elk.c:1033 #6 0x40148cb5:0x3ffb25f0 in js_equality at .pio/libdeps/latest_stable/elk/elk.c:1038 #7 0x40148d5d:0x3ffb2610 in js_bitwise_and at .pio/libdeps/latest_stable/elk/elk.c:1042 #8 0x40148de1:0x3ffb2630 in js_bitwise_xor at .pio/libdeps/latest_stable/elk/elk.c:1046 #9 0x40147831:0x3ffb2650 in js_bitwise_or at .pio/libdeps/latest_stable/elk/elk.c:1050 (inlined by) js_logical_and at .pio/libdeps/latest_stable/elk/elk.c:1054 #10 0x40147a29:0x3ffb2690 in js_logical_or at .pio/libdeps/latest_stable/elk/elk.c:1072 #11 0x40147bb1:0x3ffb26d0 in js_ternary at .pio/libdeps/latest_stable/elk/elk.c:1090 #12 0x40147d69:0x3ffb2700 in js_assignment at .pio/libdeps/latest_stable/elk/elk.c:1112 #13 0x40146067:0x3ffb2720 in js_expr at .pio/libdeps/latest_stable/elk/elk.c:1122 (inlined by) js_stmt at .pio/libdeps/latest_stable/elk/elk.c:1309 #14 0x4014919d:0x3ffb2770 in js_eval at .pio/libdeps/latest_stable/elk/elk.c:1398
`
this is the JS code executed.
` let load= { dox: 1, aux: 0 };
let main = function() { load.aux = load.aux ? 0 : 1; //inverte variavel auxliar gpio.set(load.dox, load.aux); };
let timer_main = timer.create(1000, 'main');
let cleanup = function() { timer.delete(timer_main); }; `