Instruction Access Fault on ESP32-C3
After some seconds the esp32-c3 crashes in wrench code. Here is the complete encoded exception.
Guru Meditation Error: Core 0 panic'ed (Instruction access fault). Exception was unhandled.
Core 0 register dump:
MEPC : 0x00000080 RA : 0x4200e6de SP : 0x3fca0910 GP : 0x3fc8e400
TP : 0x3fc7fdf4 T0 : 0x00000000 T1 : 0x00000001 T2 : 0x00000000
S0/FP : 0x3fcb5ae8 S1 : 0x3fcb58ff A0 : 0x3fcb5ae8 A1 : 0x3fcb5b00
A2 : 0x4200a57e A3 : 0x4200a53e A4 : 0x3fc908b0 A5 : 0x00000080
#0 0x4200a57e in wr_addI(int, int) at src/system/wrench/wrench.cpp:10998
A6 : 0x00000065 A7 : 0x00000001 S2 : 0x3fcb5b00 S3 : 0x3fcb5af8
S4 : 0x4200a53e S5 : 0x3fcb5900 S6 : 0x3fcb5ae0 S7 : 0x3fcb5a40
#0 0x4200a53e in addF(float, float) at src/system/wrench/wrench.cpp:10990
S8 : 0x3fcb59e0 S9 : 0x00000000 S10 : 0x3fcb27b4 S11 : 0xab3a8a0a
T3 : 0x00000000 T4 : 0x00000000 T5 : 0x00000000 T6 : 0x00000000
MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x00000001 MTVAL : 0x00000080
MHARTID : 0x00000000
Stack memory:
3fca0910: 0x00000000 0x00000000 0x3fcb5ad8 0x93746460 0x00000000 0x00000000 0x4200d338 0x4200d19c
#0 0x4200d338 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11575
#1 0x4200d19c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11493
3fca0930: 0x4200d1da 0x4200d1f8 0x4200d206 0x4200d37c 0x4200d494 0x4200d53e 0x4200d5bc 0x4200d5e4
#0 0x4200d1da in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11501
#1 0x4200d1f8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11509
#2 0x4200d206 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11516
#3 0x4200d37c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11606
#4 0x4200d494 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11689
#5 0x4200d53e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11727
#6 0x4200d5bc in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11785
#7 0x4200d5e4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11792
3fca0950: 0x4200d664 0x4200d6ca 0x4200d824 0x4200d784 0x4200d866 0x4200d898 0x4200d94a 0x4200d9b0
#0 0x4200d664 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11834
#1 0x4200d6ca in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11857
#2 0x4200d824 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11939
#3 0x4200d784 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11915
#4 0x4200d866 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11957
#5 0x4200d898 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11966
#6 0x4200d94a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11997
#7 0x4200d9b0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12008
3fca0970: 0x4200d9c6 0x4200d9d0 0x4200da4e 0x4200da9c 0x4200dac4 0x4200dacc 0x4200db06 0x4200db26
#0 0x4200d9c6 in WRValue::init() at src/system/wrench/wrench.h:759
(inlined by) wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12014
#1 0x4200d9d0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12019
#2 0x4200da4e in WRValue::operator=(WRValue const&) at src/system/wrench/wrench.h:885
(inlined by) wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12059
#3 0x4200da9c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12072
#4 0x4200dac4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12079
#5 0x4200dacc in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12085
#6 0x4200db06 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12091
#7 0x4200db26 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12098
3fca0990: 0x4200dbe2 0x4200db5e 0x4200dbca 0x4200dbf2 0x4200dc30 0x4200dc88 0x4200dcb0 0x4200dcd8
#0 0x4200dbe2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12120
#1 0x4200db5e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12106
#2 0x4200dbca in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12113
#3 0x4200dbf2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12149
#4 0x4200dc30 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12165
#5 0x4200dc88 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12192
#6 0x4200dcb0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12200
#7 0x4200dcd8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12206
3fca09b0: 0x4200dcfc 0x4200dd20 0x4200dd44 0x4200e518 0x4200e568 0x4200e572 0x4200e57c 0x4200e586
#0 0x4200dcfc in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12207
#1 0x4200dd20 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12208
#2 0x4200dd44 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12209
#3 0x4200e518 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12549
#4 0x4200e568 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12550
#5 0x4200e572 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12551
#6 0x4200e57c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12552
#7 0x4200e586 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12553
3fca09d0: 0x4200e590 0x4200e59a 0x4200e5b8 0x4200e5ca 0x4200e5dc 0x4200e5ee 0x4200e600 0x4200e612
#0 0x4200e590 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12556
#1 0x4200e59a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12571
#2 0x4200e5b8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12572
#3 0x4200e5ca in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12573
#4 0x4200e5dc in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12574
#5 0x4200e5ee in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12575
#6 0x4200e600 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12576
#7 0x4200e612 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12577
3fca09f0: 0x4200e624 0x4200e636 0x4200e648 0x4200dd68 0x4200dd9e 0x4200ddc4 0x4200ddde 0x4200de26
#0 0x4200e624 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12578
#1 0x4200e636 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12579
#2 0x4200e648 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12582
#3 0x4200dd68 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12213
#4 0x4200dd9e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12221
#5 0x4200ddc4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12228
#6 0x4200ddde in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12235
#7 0x4200de26 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12243
3fca0a10: 0x4200ebe4 0x4200ec34 0x4200ec3e 0x4200ec9e 0x4200ecb0 0x4200ecd4 0x4200ecc2 0x4200ece6
#0 0x4200ebe4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12895
#1 0x4200ec34 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12896
#2 0x4200ec3e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12897
#3 0x4200ec9e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12898
#4 0x4200ecb0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12899
#5 0x4200ecd4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12903
#6 0x4200ecc2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12900
#7 0x4200ece6 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12917
3fca0a30: 0x4200f06a 0x4200f046 0x4200f0e2 0x4200efd8 0x4200f0d0 0x4200f058 0x4200f0f4 0x4200f13e
#0 0x4200f06a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13005
#1 0x4200f046 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12994
#2 0x4200f0e2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13009
#3 0x4200efd8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12993
#4 0x4200f0d0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13006
#5 0x4200f058 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12997
#6 0x4200f0f4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13017
#7 0x4200f13e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13032
3fca0a50: 0x4200f11a 0x4200f164 0x4200f12c 0x4200f176 0x4200ecf8 0x4200edac 0x4200ed16 0x4200edca
#0 0x4200f11a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13018
#1 0x4200f164 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13033
#2 0x4200f12c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13021
#3 0x4200f176 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13036
#4 0x4200ecf8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12929
#5 0x4200edac in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12936
#6 0x4200ed16 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12930
#7 0x4200edca in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12937
3fca0a70: 0x4200ed70 0x4200ee24 0x4200ed8e 0x4200ee42 0x4200ed34 0x4200ede8 0x4200ed52 0x4200ee06
#0 0x4200ed70 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12933
#1 0x4200ee24 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12940
#2 0x4200ed8e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12934
#3 0x4200ee42 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12941
#4 0x4200ed34 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12931
#5 0x4200ede8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12938
#6 0x4200ed52 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12932
#7 0x4200ee06 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12939
3fca0a90: 0x4200f1c8 0x4200f252 0x4200f1b6 0x4200f240 0x4200f188 0x4200f20e 0x4200f1a4 0x4200f22e
#0 0x4200f1c8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13059
#1 0x4200f252 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13083
#2 0x4200f1b6 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13052
#3 0x4200f240 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13075
#4 0x4200f188 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13048
#5 0x4200f20e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13071
#6 0x4200f1a4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13049
#7 0x4200f22e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13072
3fca0ab0: 0x4200f1ea 0x4200f274 0x4200f1fc 0x4200f286 0x4200f2d8 0x4200f35a 0x4200f2c6 0x4200f348
#0 0x4200f1ea in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13060
#1 0x4200f274 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13084
#2 0x4200f1fc in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13063
#3 0x4200f286 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13087
#4 0x4200f2d8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13106
#5 0x4200f35a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13128
#6 0x4200f2c6 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13099
#7 0x4200f348 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13121
3fca0ad0: 0x4200f298 0x4200f31a 0x4200f2b4 0x4200f336 0x4200f2f6 0x4200f378 0x4200f308 0x4200f38a
#0 0x4200f298 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13095
#1 0x4200f31a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13117
#2 0x4200f2b4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13096
#3 0x4200f336 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13118
#4 0x4200f2f6 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13107
#5 0x4200f378 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13129
#6 0x4200f308 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13110
#7 0x4200f38a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13132
3fca0af0: 0x4200f41c 0x4200f39c 0x4200f40a 0x4200f3c0 0x4200f3e4 0x4200f3d2 0x4200f540 0x4200f4e4
#0 0x4200f41c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13154
#1 0x4200f39c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13139
#2 0x4200f40a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13151
#3 0x4200f3c0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13140
#4 0x4200f3e4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13150
#5 0x4200f3d2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13143
#6 0x4200f540 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13201
#7 0x4200f4e4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13186
3fca0b10: 0x4200f52e 0x4200f4c0 0x4200f508 0x4200f4f6 0x4200f4ae 0x4200f42e 0x4200f49c 0x4200f452
#0 0x4200f52e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13198
#1 0x4200f4c0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13185
#2 0x4200f508 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13197
#3 0x4200f4f6 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13189
#4 0x4200f4ae in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13177
#5 0x4200f42e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13162
#6 0x4200f49c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13174
#7 0x4200f452 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13163
3fca0b30: 0x4200f476 0x4200f464 0x4200f5d2 0x4200f576 0x4200f5c0 0x4200f552 0x4200f59a 0x4200f588
#0 0x4200f476 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13173
#1 0x4200f464 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13166
#2 0x4200f5d2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13224
#3 0x4200f576 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13210
#4 0x4200f5c0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13221
#5 0x4200f552 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13209
#6 0x4200f59a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13220
#7 0x4200f588 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:13213
3fca0b50: 0x4200e4b4 0x4200e4e6 0x4200e91e 0x4200e944 0x4200e95c 0x4200e964 0x4200e96c 0x4200e97a
#0 0x4200e4b4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12537
#1 0x4200e4e6 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12544
#2 0x4200e91e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12685
#3 0x4200e944 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12699
#4 0x4200e95c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12707
#5 0x4200e964 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12713
#6 0x4200e96c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12719
#7 0x4200e97a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12725
3fca0b70: 0x4200e988 0x4200e996 0x4200e724 0x4200e7f4 0x4200dfd0 0x4200e014 0x4200e022 0x4200e65a
#0 0x4200e988 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12730
#1 0x4200e996 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12736
#2 0x4200e724 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12615
#3 0x4200e7f4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12646
#4 0x4200dfd0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12342
#5 0x4200e014 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12354
#6 0x4200e022 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12370
#7 0x4200e65a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12592
3fca0b90: 0x4200e66c 0x4200e6a2 0x4200e67e 0x4200e690 0x4200e6f2 0x4200e6fc 0x4200e706 0x4200e710
#0 0x4200e66c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12593
#1 0x4200e6a2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12596
#2 0x4200e67e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12594
#3 0x4200e690 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12595
#4 0x4200e6f2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12597
#5 0x4200e6fc in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12598
#6 0x4200e706 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12599
#7 0x4200e710 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12600
3fca0bb0: 0x4200e71a 0x4200e75e 0x4200e770 0x4200e7a6 0x4200e782 0x4200e794 0x4200e7c2 0x4200e7cc
#0 0x4200e71a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12603
#1 0x4200e75e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12620
#2 0x4200e770 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12621
#3 0x4200e7a6 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12624
#4 0x4200e782 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12622
#5 0x4200e794 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12623
#6 0x4200e7c2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12625
#7 0x4200e7cc in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12626
3fca0bd0: 0x4200e7d6 0x4200e7e0 0x4200e7ea 0x4200de62 0x4200de98 0x4200e06c 0x4200e08c 0x4200df1a
#0 0x4200e7d6 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12627
#1 0x4200e7e0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12628
#2 0x4200e7ea in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12631
#3 0x4200de62 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12251
#4 0x4200de98 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12259
#5 0x4200e06c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12389
#6 0x4200e08c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12397
#7 0x4200df1a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12273
3fca0bf0: 0x4200dec8 0x4200df4c 0x4200dfc2 0x4200df28 0x4200df9e 0x4200e7fe 0x4200e858 0x4200e86a
#0 0x4200dec8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12266
#1 0x4200df4c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12297
#2 0x4200dfc2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12328
#3 0x4200df28 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12283
#4 0x4200df9e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12313
#5 0x4200e7fe in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12653
#6 0x4200e858 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12654
#7 0x4200e86a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12655
3fca0c10: 0x4200e87c 0x4200e88e 0x4200e8e8 0x4200e8fa 0x4200e90c 0x4200eefa 0x4200ef0c 0x4200eec4
#0 0x4200e87c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12658
#1 0x4200e88e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12668
#2 0x4200e8e8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12669
#3 0x4200e8fa in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12670
#4 0x4200e90c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12673
#5 0x4200eefa in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12949
#6 0x4200ef0c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12956
#7 0x4200eec4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12944
3fca0c30: 0x4200ee60 0x4200eed6 0x4200eee8 0x4200efb0 0x4200efc2 0x4200ef7a 0x4200ef22 0x4200ef8c
#0 0x4200ee60 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12943
#1 0x4200eed6 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12945
#2 0x4200eee8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12946
#3 0x4200efb0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12974
#4 0x4200efc2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12981
#5 0x4200ef7a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12969
#6 0x4200ef22 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12968
#7 0x4200ef8c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12970
3fca0c50: 0x4200ef9e 0x4200e9a4 0x4200ea0a 0x4200ea64 0x4200ea7e 0x4200e0b8 0x4200e0dc 0x4200e10c
#0 0x4200ef9e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12971
#1 0x4200e9a4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12742
#2 0x4200ea0a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12755
#3 0x4200ea64 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12769
#4 0x4200ea7e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12778
#5 0x4200e0b8 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12406
#6 0x4200e0dc in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12414
#7 0x4200e10c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12423
3fca0c70: 0x4200e120 0x4200e144 0x4200e174 0x4200e188 0x4200e19c 0x4200ea98 0x4200eabe 0x4200eae4
#0 0x4200e120 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12430
#1 0x4200e144 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12438
#2 0x4200e174 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12447
#3 0x4200e188 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12454
#4 0x4200e19c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12461
#5 0x4200ea98 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12787
#6 0x4200eabe in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12797
#7 0x4200eae4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12807
3fca0c90: 0x4200eb0a 0x4200eb1c 0x4200eb2e 0x4200eb40 0x4200eb52 0x4200eb64 0x4200eb8a 0x4200eb9c
#0 0x4200eb0a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12817
#1 0x4200eb1c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12824
#2 0x4200eb2e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12831
#3 0x4200eb40 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12838
#4 0x4200eb52 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12845
#5 0x4200eb64 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12852
#6 0x4200eb8a in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12862
#7 0x4200eb9c in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12869
3fca0cb0: 0x4200ebae 0x4200ebc0 0x4200ebd2 0x4200e1b0 0x4200e1ea 0x4200e224 0x4200e29e 0x4200e2b4
#0 0x4200ebae in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12876
#1 0x4200ebc0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12883
#2 0x4200ebd2 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12890
#3 0x4200e1b0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12471
#4 0x4200e1ea in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12478
#5 0x4200e224 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12483
#6 0x4200e29e in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12484
#7 0x4200e2b4 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12485
3fca0cd0: 0x4200e2ca 0x4200e2e0 0x4200e2f0 0x4200e3c8 0x4200e44c 0x4200da46 0x4200d9fa 0x4200da20
#0 0x4200e2ca in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12486
#1 0x4200e2e0 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:12487
#2 0x4200e2f0 in wr_callFunction(WRContext*, WRFunction*, WRV00000000 0x00000001 0x600c0000 0x00000000
#0 0x4200d268 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11541
#1 0x4200d2cc in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11557
#2 0x4200d314 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11567
#3 0x4200d368 in wr_callFunction(WRContext*, WRFunction*, WRValue const*, int) at src/system/wrench/wrench.cpp:11601
If you need more information, please let me know!
Edit:
I use the newest wrench Version (6.0.18) and there is more the enough heap available
Thank you! any chance I could get a copy of the program it was running?
The wrench program? Sure
var roadpieces[12][13];
var is_on[12];
var car_x = 6;
var car_y = 2;
var ref_point = 4;
var keep_state = 2;
var loop_counter = 0;
var points = 0;
var loose_state = false;
var distance;
function init() {
reset();
set_controls(0b00001010);
}
function game_loop() {
if (loose_state) return;
points++;
if (is_animation_running()) return;
set_tps(get_current_tps() + 0.013 / (get_current_tps() / 10));
set_status(str::format("Points: %d", points));
if (keep_state < 0 && random(0, 10) > 4) {
if (random(0, 9) > 4) {
if (ref_point > 0) {
ref_point--;
keep_state = 7;
}
} else {
if (ref_point < 6) {
ref_point++;
keep_state = 7;
}
}
}
keep_state--;
for (var y = 0; y < 12; y++) {
for (var x = 0; x < 12; x++) {
roadpieces[x][y] = roadpieces[x][y + 1];
}
}
for (var i = 0; i < 12; i++) {
roadpieces[i][12] = false;
}
roadpieces[ref_point][12] = true;
if (points > 300) {
distance = 4;
} else {
distance = 5;
}
roadpieces[ref_point + distance][12] = true;
if (loop_counter >= 3) {
loop_counter = 0;
}
for (var i = 0; i < 12; i++) {
is_on[i] = false;
if ((i + loop_counter) % 3 == 0) {
is_on[i] = true;
}
}
loop_counter++;
if (roadpieces[car_x][car_y] || roadpieces[car_x][car_y + 1]) {
loose_state = true;
set_controls(0b00100000);
run_animation_splash(car_x, car_y, 0xFF0000, true, 1000, 1000);
}
}
function draw() {
if (is_animation_running()) return;
if (loose_state) {
clear();
number(1, 4, points, 0xFF0000);
return;
}
for (var y = 0; y < 12; y++) {
for (var x = 0; x < 12; x++) {
if (roadpieces[x][y]) {
if (is_on[y]) {
set(x, y, 0x00FF00);
} else {
set(x, y, 0xFFFFFF);
}
} else {
off(x, y);
}
}
}
set(car_x, car_y, 0xFFFF00);
set(car_x, car_y + 1, 0xFFFF00);
}
function clean_up() {
}
function on_event(event) {
if (event == 2) {
if (car_x > 0) {
car_x--;
}
}
if (event == 3) {
if (car_x < 11) {
car_x++;
}
}
if (event == 5) {
loose_state = false;
reset();
set_controls(0b00001010);
}
}
function reset() {
car_x = 5;
car_y = 2;
ref_point = 4;
keep_state = 2;
loop_counter = 0;
points = 0;
for (var x = 0; x < 12; x++) {
for (var y = 0; y < 13; y++) {
roadpieces[x][y] = y == 12 && (x <= ref_point || x >= ref_point + 5);
}
}
for (var i = 0; i < 12; i++) {
is_on[i] = false;
}
set_tps(10);
}
Custom defined function:
//
// Created by T.Arnold on 19.12.2024.
//
#ifndef WRENCHWRAPPER_H
#define WRENCHWRAPPER_H
#include <animations/Splash.h>
#include "wrench/wrench.h"
#include "ControlManager.h"
struct ControlElements
{
ControlManager* cm;
MatrixManager* mm;
};
namespace wrench_wrapper
{
inline void print(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
char buf[128];
for( int i=0; i<argn; ++i )
{
printf( "%s\n", argv[i].asString(buf, 128) );
}
}
inline void set_status(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn == 0) return;
auto* ce = static_cast<ControlElements*>(usr);
char buf[128];
String status = "";
for (int i=0;i<argn;i++) {
status += argv[i].asString(buf, 128);
}
ce->cm->set_status(status);
}
inline void get_status(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
auto* ce = static_cast<ControlElements*>(usr);
wr_makeString(c, &retVal, ce->cm->get_status().c_str(), strlen(ce->cm->get_status().c_str()));
}
inline void get_current_tps(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
auto* ce = static_cast<ControlElements*>(usr);
wr_makeFloat(&retVal, ce->mm->get_current_tps());
}
inline void set_tps(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 1) return;
auto* ce = static_cast<ControlElements*>(usr);
ce->mm->set_tps(argv[0].asFloat());
wr_makeInt(&retVal, 1);
}
inline void get_controls(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
auto* ce = static_cast<ControlElements*>(usr);
wr_makeInt(&retVal, ce->cm->get_controls());
}
inline void set_controls(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 1) return;
auto ce = static_cast<ControlElements*>(usr);
ce->cm->set_controls(argv[0].asInt());
wr_makeInt(&retVal, 1);
}
inline void reset_controls(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
auto ce = static_cast<ControlElements*>(usr);
ce->cm->reset();
wr_makeInt(&retVal, 1);
}
inline void is_animation_running(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
auto ce = static_cast<ControlElements*>(usr);
wr_makeInt(&retVal, ce->cm->is_animation_running());
}
/*void run_animation(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr) {
if (argn != 2) return;
ControlElements* ce = static_cast<ControlElements*>(usr);
Animation* anim = new Animation(); // Assuming Animation has a default constructor
ce->cm->run_animation(anim, argv[0].asInt(), argv[1].asInt());
wr_makeInt(&retVal, 1);
}
*/
inline void stop_animation(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
auto ce = static_cast<ControlElements*>(usr);
ce->cm->stop_animation();
wr_makeInt(&retVal, 1);
}
inline void set_pixel(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 3) return;
auto ce = static_cast<ControlElements*>(usr);
ce->mm->set(argv[0].asInt(), argv[1].asInt(), argv[2].asInt());
wr_makeInt(&retVal, 1);
}
inline void off_pixel(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 2) return;
auto* ce = static_cast<ControlElements*>(usr);
ce->mm->off(argv[0].asInt(), argv[1].asInt());
wr_makeInt(&retVal, 1);
}
inline void fill_matrix(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 1) return;
auto ce = static_cast<ControlElements*>(usr);
ce->mm->fill(argv[0].asInt());
wr_makeInt(&retVal, 1);
}
inline void clear_matrix(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
auto ce = static_cast<ControlElements*>(usr);
ce->mm->clear();
wr_makeInt(&retVal, 1);
}
inline void draw_line(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 5) return;
auto ce = static_cast<ControlElements*>(usr);
ce->mm->line(argv[0].asInt(), argv[1].asInt(), argv[2].asInt(), argv[3].asInt(), argv[4].asInt());
wr_makeInt(&retVal, 1);
}
inline void draw_rect_filled(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 5) return;
auto ce = static_cast<ControlElements*>(usr);
ce->mm->rect(argv[0].asInt(), argv[1].asInt(), argv[2].asInt(), argv[3].asInt(), argv[4].asInt(),true); //make fillable controlable
wr_makeInt(&retVal, 1);
}
inline void draw_rect(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 5) return;
auto ce = static_cast<ControlElements*>(usr);
ce->mm->rect(argv[0].asInt(), argv[1].asInt(), argv[2].asInt(), argv[3].asInt(), argv[4].asInt()); //make fillable controlable
wr_makeInt(&retVal, 1);
}
inline void draw_circle(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 4) return;
auto ce = static_cast<ControlElements*>(usr);
ce->mm->circle(argv[0].asInt(), argv[1].asInt(), argv[2].asInt(), argv[3].asInt());
wr_makeInt(&retVal, 1);
}
inline void draw_number(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 4) return;
auto ce = static_cast<ControlElements*>(usr);
ce->mm->number(argv[0].asInt(), argv[1].asInt(), argv[2].asInt(), argv[3].asInt());
wr_makeInt(&retVal, 1);
}
//animations
inline void run_animation_splash(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 6) return;
auto ce = static_cast<ControlElements*>(usr);
auto anim = new Splash(argv[0].asInt(), argv[1].asInt(), argv[2].asInt(), argv[3].asInt() > 0);
ce->cm->run_animation(anim, argv[4].asInt(), argv[5].asInt());
wr_makeInt(&retVal, 1);
}
inline void wrench_random(WRContext* c, const WRValue* argv, const int argn, WRValue& retVal, void* usr)
{
if (argn != 2) return;
wr_makeInt(&retVal, random(argv[0].asInt(), argv[1].asInt()));
}
static void register_wrench_functions(WRState* w, ControlElements* ce)
{
wr_registerFunction(w, "print", wrench_wrapper::print, &ce); // bind a function
wr_registerFunction(w, "set_status", wrench_wrapper::set_status, ce);
wr_registerFunction(w, "get_status", wrench_wrapper::get_status, ce);
wr_registerFunction(w, "get_controls", wrench_wrapper::get_controls, ce);
wr_registerFunction(w, "set_controls", wrench_wrapper::set_controls, ce);
wr_registerFunction(w, "get_current_tps", wrench_wrapper::get_current_tps, ce);
wr_registerFunction(w, "set_tps", wrench_wrapper::set_tps, ce);
wr_registerFunction(w, "reset_controls", wrench_wrapper::reset_controls, ce);
wr_registerFunction(w, "is_animation_running", wrench_wrapper::is_animation_running, ce);
// wr_registerFunction(w, "run_animation", wrench_wrapper::run_animation, ce);
wr_registerFunction(w, "stop_animation", wrench_wrapper::stop_animation, ce);
wr_registerFunction(w, "set", wrench_wrapper::set_pixel, ce);
wr_registerFunction(w, "off", wrench_wrapper::off_pixel, ce);
wr_registerFunction(w, "fill", wrench_wrapper::fill_matrix, ce);
wr_registerFunction(w, "clear", wrench_wrapper::clear_matrix, ce);
wr_registerFunction(w, "line", wrench_wrapper::draw_line, ce);
wr_registerFunction(w, "rect", wrench_wrapper::draw_rect, ce);
wr_registerFunction(w, "rect_filled", wrench_wrapper::draw_rect_filled, ce);
wr_registerFunction(w, "circle", wrench_wrapper::draw_circle, ce);
wr_registerFunction(w, "number", wrench_wrapper::draw_number, ce);
//animations
wr_registerFunction(w, "run_animation_splash", wrench_wrapper::run_animation_splash, ce);
//utils
wr_registerFunction(w, "random", wrench_wrapper::wrench_random, ce);
}
}
#endif //WRENCHWRAPPER_H
The last executed function was set before the crash occurred
perfect, okay I'm diving in on this now
One notable addition would be that the code works perfectly on an esp8266. Maybe the RISC-V architecture of the esp32 c3 breaks the interpreter.
this is a very tricky one to figure out, I have an ESP32-c3 to test on and so far everything I've tried has worked, I'll keep pushing it around
Great that you have the same hardware. I'll try to create a minimal example to reproduce tomorrow.
it appears you are using wrench_compact? could you try it with that off? the esp32 has gobs of flash and should have no trouble running it that way, it will be faster too. would be interesting if you get the same crash
I just confirmed the crash also happens in non compact mode
I realized that the crash only occurs when the function function on_event(event) is called. Maybe it's because there is a parameter associated?
Can you think of a reason why the esp8266 cares and the esp32-c3 doesn't?
So if you fix the out-of-bounds does the crash go away?
Two parts to that.. firstly there is a bounds-check on every reference, but if the array is found to be out of bounds, it's expanded. Since the only way to do this is to re-allocate memory, the old container is copied to the new and then thrown away. This means any references to the old become stale.
So wrench uses garbage collection so internally that memory should hang around if any old objects have access to it, but in this case there is a problem. The new data might change, while an old reference might have access to the old, so it's answer is in valid memory, but WRONG.
So I fixed that by storing references as array + index, in other words:
var road[10]; // create a blank array of 10 values var r1 road[1]; // r1 does NOT refer to road[1] it refers to "road, value at index 1"
Therefore:
var r2 = r1; // r1 goes to "road" indexes it to 1, and then puts that value into r2
Importantly, if the memory in "road" was re-allocated, that won't matter because it's indexed each time it's asked for. What I didn't account for was nested arrays. The crash could be related to re-allocating the array (due to the overrun) when it's more than one dimensional.
in any case this:
roadpieces[x][y] = roadpieces[x][y + 1];
is completely legal and handled even if it's out of bounds, so that's not the crash, likewise:
roadpieces[i][12] = false;
technically roadpieces was initialized with [12][12] which means valid indexes are 0-11, but again this is transparently handled by wrench.
So the takeaway is, if you init roadpieces to [13][13] does the crash go away?
On Thu, Aug 21, 2025 at 6:50 AM Tim Arnold @.***> wrote:
timarnoldev left a comment (jingoro2112/wrench#54) https://github.com/jingoro2112/wrench/issues/54#issuecomment-3210024755
I realized that the crash only occurs when the function function on_event(event) is called. Maybe it's because there is an parameter?
Can you think of a reason why the esp8266 cares and the esp32-c3 doesn't?
— Reply to this email directly, view it on GitHub https://github.com/jingoro2112/wrench/issues/54#issuecomment-3210024755, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALIKA457WEYNJUHEJJRK433OWP5VAVCNFSM6AAAAACEERMLW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEMJQGAZDINZVGU . You are receiving this because you commented.Message ID: @.***>
Thanks for your detailed analysis.
Unfortunately the crash occurs either way.
But I never got it to crash when I don't call the function function on_event(event).
okay good to know, how are you calling on_event? are you getting the call vector once and fast-calling it or looking it up each time? Not that it should matter since those vectors are static, just trying to nail down where the fault is occurring. Could you show me the c call to the even please? Also how you are constructing the 'event' value
On Thu, Aug 21, 2025 at 9:58 AM Tim Arnold @.***> wrote:
timarnoldev left a comment (jingoro2112/wrench#54) https://github.com/jingoro2112/wrench/issues/54#issuecomment-3210732749
Thanks for your detailed analysis. Unfortunately the crash occurs either way. But I never got it to crash when I don't call the function function on_event(event).
— Reply to this email directly, view it on GitHub https://github.com/jingoro2112/wrench/issues/54#issuecomment-3210732749, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALIKAYXSZSDOQ5VD4LWXZL3OXGBRAVCNFSM6AAAAACEERMLW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEMJQG4ZTENZUHE . You are receiving this because you commented.Message ID: @.***>
WRValue val;
wr_makeInt(&val, Event::LEFT);
wr_callFunction(wc, "on_event", &val, 1);
wc is the WrenchContext and Event::LEFT is an enum and should resolve to an integer.
I call this function only when the users presses a button. I can do that a few times before the crash occurs.