3.5b1 Reset reason: StuckInSpinLoop?
-
@dc42 Now I prevented it from crashing by moving a global set to a later place...
if global.lastDisplayContent != var.displayContent set global.lastDisplayContent = var.displayContent while iterations < global.displayLEDCount ;M150 R{param.C[0]} U{param.C[1]} B{param.C[2]} P{iterations < var.activeLEDs ? var.brightness : 0} S1 F1 ;3.5+ var isFrame = iterations < 8 || iterations > 55 var isProgress = false ;todo var isActive = var.isFrame || var.isProgress M150 R255 U0 B0 P{var.isActive ? var.brightness : 0} S1 F1 M150 R0 U0 B0 P0 S1 F0 ;announce last LED with a dummy
becomes:
if global.lastDisplayContent != var.displayContent while iterations < global.displayLEDCount ;M150 R{param.C[0]} U{param.C[1]} B{param.C[2]} P{iterations < var.activeLEDs ? var.brightness : 0} S1 F1 ;3.5+ var isFrame = iterations < 8 || iterations > 55 var isProgress = false ;todo var isActive = var.isFrame || var.isProgress M150 R255 U0 B0 P{var.isActive ? var.brightness : 0} S1 F1 M150 R0 U0 B0 P0 S1 F0 ;announce last LED with a dummy set global.lastDisplayContent = var.displayContent
Note how line #2 moved. This somewhat aligns with the crash in daemon.g where a global set also had critical impact on it...
-
@Diamondback what values do you set for the global variables before running this macro? I tried the following values, but it doesn't crash.
global displayLEDCount=20
global lastDisplayContent="none"
global displayDefaultBrightness=10 -
global displayLEDCount = 64 global displayDefaultBrightness = 10 global lastDisplayContent = ""
The more I play around with it, the more I think it's a timing issue... Sometimes I can do things fine by updating the 64 dotstar pixels with 500ms delay between them but not with 100ms etc.
-
@Diamondback said in 3.5b1 Reset reason: StuckInSpinLoop?:
global displayLEDCount = 64
global displayDefaultBrightness = 10
global lastDisplayContent = ""It still doesn't crash for me. Perhaps it depends on what global variables you have created already? Can you share your whole config.g file and any macros that it calls?
-
@dc42
config.g;M929 S3 ;enable debug logging ;M575 P1 S1 B57600 ;Enable PanelDue Port G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"V-Core Toolchanger" ; set printer name ; Enable network M552 P0.0.0.0 S1 M669 K1 ; select CoreXY mode G4 S2 ; wait for expansion boards to start ; Drives ;XY1: back left ;XY2: back right M569 P0.2 S0 ; stepper XY1 M569 P0.3 S0 ; stepper XY2 M569 P0.4 S1 ; stepper Coupler M569 P100.0 S0 ; stepper E0 M569 P100.1 S0 ; stepper E1 M569 P100.2 S0 ; stepper E2 M569 P100.3 S0 ; stepper E3 M569 P0.0 S0 ; stepper Z1 M569 P0.1 S0 ; stepper Z2 M569 P0.5 S0 ; stepper Z3 M584 X0.3 Y0.2 C0.4 ; set drive mapping (motion system X Y C) M584 E100.0:100.1:100.2:100.3 ; set drive mapping (extruders) M584 Z0.0:0.1:0.5 ; set drive mapping (motion system Z) ;Leadscrew order (starting back center, then clockwise): ;1: back center ;2: front right ;3: front left M671 X-12:216:-203 Y222:-179:-179 S30 ; set Z leadscrew positions ; Axis Limits if !exists(global.hasRunInit) global minY = -266 global maxY = 115 M208 X-148:160 Y{global.minY,global.maxY} ; set axis minima & maxima M208 C0:250 Z-2:270 ; set axis minima & maxima M92 X80.00 Y80.00 ; X/Y: 1.8°/step ;M92 X160.00 Y160.00 ; X/Y: 0.9°/step M92 C200.00 ; C: E3D coupler M92 Z800.00 ; Z: TR8x4 leadscrews M350 X16 Y16 I1 ; configure microstepping with interpolation M350 C16 Z16 I1 ; configure microstepping with interpolation M566 X600 Y600 C2 Z50 ; set maximum instantaneous speed changes (mm/min) M203 X30000 Y30000 C10000 Z2000 ; set maximum speeds (mm/min) M201 X5000 Y5000 C500 Z350 ; set accelerations (mm/s^2) M204 P500 T5000 ;M204 P5000 T5000 M906 X2000 Y2000 ; set motor currents (mA) and motor idle factor in per cent M906 C700 ; set motor currents (mA) and motor idle factor in per cent M906 Z1500 ; set motor currents (mA) and motor idle factor in per cent M906 E500:500:500:500 ; set motor currents (mA) and motor idle factor in per cent (4x LGX) M906 I50 ;only a single idle factor allowed for ALL steppers M84 S30 ; Set idle timeout ;=================== Extruder ====================== M92 E408:408:408:408 ; set steps per mm M350 E16:16:16:16 I1 ; configure microstepping M566 E500:500:500:500 ; set maximum instantaneous speed changes (mm/min) ; used to be at 1200 M203 E15000:15000:15000:15000 ; set maximum speeds (mm/min) M201 E3000:3000:3000:3000 ; set accelerations (mm/s^2) ;==================================================== ; Endstops M574 X2 S1 P"0.io0.in" ; configure active-high endstop for high end on X via pin xstop M574 Y1 S1 P"0.io1.in" ; configure active-high endstop for high end on Y via pin ystop M574 Z0 ; No Z-Endstop (use as probe instead) ; Z-Probe if !exists(global.hasRunInit) global zProbeSpeedFeed = 300 global zProbeSpeedFeedLevel = 1500 global zProbeSpeedTravel = 20000 global zProbeDiveHeightLevel = 30 global zProbeDiveHeightMesh = 3 global zProbePin = "0.io2.in" global zProbeType = 8 global zProbeTriggerValue = 200 global minXMesh = -146 global maxXMesh = 150 global minYMesh = -150 global maxYMesh = 150 global meshPointSpacing = 30 M558 K0 P{global.zProbeType} C{global.zProbePin} H{global.zProbeDiveHeightMesh} F{global.zProbeSpeedFeed} T{global.zProbeSpeedTravel} ; Z Endstop/probe M558 K2 P8 C"0.io4.in" H10 F100 T20000 ; tool length switch G31 K0 X0 Y0 Z0 P200 ;G31 K1 X0 Y0 Z0 P200 G31 K2 X0 Y0 Z0 P200 ;G31 K0 X0 Y0 Z0 P{global.zProbeTriggerValue} ; set Z probe trigger value, offset and trigger height, offsets here are hardcoded in leveling macro as well M557 X{global.minXMesh, global.maxXMesh} Y{global.minYMesh, global.maxYMesh} S{global.meshPointSpacing} ; define mesh grid M376 H30 ; Set bed correction taper ; Heaters M308 S0 P"100.temp0" Y"thermistor" T100000 B3950 ; configure sensor 0 as thermistor M950 H0 C"100.out0" T0 Q10 ; create bed heater output and map it to sensor 0 M143 H0 S121 ; set temperature limit for heater 0 to 121C M307 H0 B0 R0.676 C345.1 D2.68 S1.00 V24.3 ; Bed PID Tuning M140 H0 ; map heated bed to heater 0 M308 S1 P"0.temp1" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 1 as thermistor M950 H1 C"0.out1" T1 ; create nozzle heater output and map it to sensor 1 M143 H1 S301 ; set temperature limit for heater 1 to 301C M308 S2 P"0.temp2" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 2 as thermistor M950 H2 C"0.out2" T2 ; create nozzle heater output and map it to sensor 2 M143 H2 S301 ; set temperature limit for heater 2 to 301C M308 S3 P"100.temp1" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 3 as thermistor M950 H3 C"100.out1" T3 ; create nozzle heater output and map it to sensor 3 M143 H3 S301 ; set temperature limit for heater 3 to 301C M308 S4 P"100.temp2" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 2 as thermistor M950 H4 C"100.out2" T4 ; create nozzle heater output and map it to sensor 2 M143 H4 S301 ; set temperature limit for heater 2 to 301C M302 S190 R190 ;Cold extrusion settings M307 H1 R4.637 K0.673:0.218 D2.31 E1.35 S1.00 B0 V24.2 ; PID Tuning T0 M307 H2 R4.174 K0.555:0.276 D1.96 E1.35 S1.00 B0 V24.2 ; PID Tuning T1 M307 H3 R4.301 K0.536:0.105 D1.89 E1.35 S1.00 B0 V24.2 ; PID Tuning T2 M307 H4 R3.780 K0.576:0.060 D1.57 E1.35 S1.00 B0 V24.2 ; PID Tuning T3 ; Fans M950 F0 C"0.out7" ; Hotend Fan Tool 0 M106 P0 S255 L255 H1 T50 C"T0 Hotend" ; Hotend Fan Tool 0 M950 F1 C"0.out4" Q50 ; Layer Fan Tool 0 M106 P1 S0 H-1 C"T0" ; Layer Fan Tool 0 M950 F2 C"0.out8" ; Hotend Fan Tool 1 M106 P2 S255 L255 H2 T50 C"T1 Hotend" ; Hotend Fan Tool 1 M950 F3 C"0.out5" Q50 ; Layer Fan Tool 1 M106 P3 S0 H-1 C"T1" ; Layer Fan Tool 1 M950 F4 C"100.out5" ; Hotend Fan Tool 2 M106 P4 S255 L255 H3 T50 C"T2 Hotend" ; Hotend Fan Tool 2 M950 F5 C"100.out3" Q50 ; Layer Fan Tool 2 M106 P5 S0 H-1 C"T2" ; Layer Fan Tool 2 M950 F6 C"100.out6" ; Hotend Fan Tool 3 M106 P6 S255 L255 H4 T50 C"T3 Hotend" ; Hotend Fan Tool 3 M950 F7 C"100.out4" Q50 ; Layer Fan Tool 3 M106 P7 S0 H-1 C"T3" ; Layer Fan Tool 3 ;Static layer fan M950 F8 C"0.out0" Q65535 ; static layer fan M106 P8 S0 H-1 I1 L0.2 C"RSCS" ; Tools M563 P0 D0 H1 F1 ; define tool 0 G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C M563 P1 D1 H2 F3 ; define tool 1 G10 P1 R0 S0 ; set initial tool 1 active and standby temperatures to 0C M563 P2 D2 H3 F5 ; define tool 2 G10 P2 R0 S0 ; set initial tool 2 active and standby temperatures to 0C M563 P3 D3 H4 F7 ; define tool 3 G10 P3 R0 S0 ; set initial tool 3 active and standby temperatures to 0C M563 P4 S"Pen" ; define tool 4 (Pen) ;Dock present switches M950 J0 C"0.io7.in" ; Tool 0 Dock switch M950 J1 C"0.io8.in" ; Tool 1 Dock switch M950 J2 C"100.io5.in" ; Tool 2 Dock switch M950 J3 C"100.io6.in" ; Tool 3 Dock switch ;additional tool related switches M950 J4 C"0.io3.in" ;potential toolhead tool present switch, not installed atm, but already wired up inside the box ;Filament sensors, not installed atm, but already wired up inside the box M591 D0 P4 C"100.io0.in" S1 L23.2 R70:150 E5 M591 D1 P4 C"100.io1.in" S1 L23.2 R70:150 E5 M591 D2 P4 C"100.io2.in" S1 L23.2 R70:150 E5 M591 D3 P4 C"100.io3.in" S1 L23.2 R70:150 E5 M950 S0 C"0.out9" Q333 ;PebbleWiper Servo M280 P0 S70 ;Servo in idle position M950 P1 C"0.io5.out" ;Light switch PWM ;Toolhead Dotstar M150 X0 ;Accelerometer M955 P0 C"spi.cs2+spi.cs3" ;Inputshaping ;M593 P"zvddd" F70 S0.2 ; Miscellaneous M98 P"/macros/Misc/ToolheadDisplay/InitToolheadDisplay" M98 P"/macros/Misc/Lights/On" M98 P"/sys/config-tools.g" if !exists(global.hasRunInit) global pebbleFeedSpeedDefault = 300 global pebbleFeedSpeed = global.pebbleFeedSpeedDefault global deactivateToolAfterFilamentChange = false global displayActiveToolOnHead = true global hasRunInit = true global daemonActive = false
InitToolheadDisplay
if !exists(global.displayLEDCount) global displayLEDCount = 64 global displayDefaultBrightness = 10 global lastDisplayContent = "" ;global displayDigit = {null, null, null, null, null, null, null, null, null, null} ;enable once we can set individual elements of arrays ;set global.displayDigit[0] = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,0}} ;set global.displayDigit[1] = {{0,0,1,1,1,0,0,0},{0,0,1,1,1,1,0,0},{0,0,1,1,1,1,1,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0}} ;set global.displayDigit[2] = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{0,1,1,1,0,0,0,0},{0,0,0,1,1,1,0,0},{0,0,0,0,0,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1}} ;set global.displayDigit[3] = {{0,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{0,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1}} if !exists(global.displayChar0) && boards[0].firmwareVersion != "3.4.5" global displayChar0 = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,0,0,1,1,1},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,0}} global displayChar1 = {{0,0,1,1,1,0,0,0},{0,0,1,1,1,1,0,0},{0,0,1,1,1,1,1,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,1,1,0,0,0}} global displayChar2 = {{0,1,1,1,1,1,1,0},{1,1,1,1,1,1,1,1},{1,1,1,0,0,1,1,1},{0,1,1,1,0,0,0,0},{0,0,0,1,1,1,0,0},{0,0,0,0,0,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1}} global displayChar3 = {{0,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{0,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1},{1,1,1,0,0,0,0,0},{1,1,1,1,1,1,1,1},{0,1,1,1,1,1,1,1}} global RGBOff = {0,0,0,0} global RGBRed = {255,0,0,25} global RGBGreen = {0,255,0,10} global RGBBlue = {0,0,255,45} global RGBWhite = {255,255,255,10}
Lights/On
M42 P1 S230
config-tools.g
if !exists(global.hasRunInit) ;global toolNozzleSizes = {0,0,0,0} ;global toolNozzleMaterials = {"brass","brass","brass","brass"} global tool0NozzleSize = "0.0" global tool1NozzleSize = "0.0" global tool2NozzleSize = "0.0" global tool3NozzleSize = "0.0" global tool0NozzleMaterial = "" global tool1NozzleMaterial = "" global tool2NozzleMaterial = "" global tool3NozzleMaterial = "" M98 P"/sys/config-tools-size.g" M98 P"/sys/config-tools-material.g" ;Z-Offset: If nozzle is too close to bed _reduce_ offset (negative number becomes more negative) ; If nozzle is too far away, _increase_ offset (negative number becomes less negative) ;Tool offsets G10 P0 X-8.340 Y39.270 Z-4.190 G10 P1 X-8.480 Y39.310 Z-4.020 G10 P2 X-8.180 Y38.930 Z-4.200 G10 P3 X-8.360 Y39.060 Z-4.506 G10 P4 X0 Y46.5 Z-20.000 ; set tool 4 axis offsets ; Filament Nozzle PA R-Distance R-Speed ; -------------- -------- ----- ------------ --------- ; Generic PETG 0.25 0.175 0.6 2100 ; --- 0.3 0.13 0.6 2100 ; --- 0.4 0.1 0.6 2100 ; --- 0.6 0.05 0.6 2100 ; --- 0.8 0.03 0.6 2100 ; Generic PLA 0.25 0.0 0.6 2100 ; --- 0.3 0.0 0.6 2100 ; --- 0.4 0.08 0.6 2100 ; --- 0.6 0.0 0.6 2100 ; --- 0.8 0.0 0.6 2100 ; BioFusion 0.25 0.0 0.6 2100 ; --- 0.3 0.09 0.6 2100 ; --- 0.4 0.07 0.6 2100 ; --- 0.6 0.0 0.6 2100 ; --- 0.8 0.035 0.6 2100 ; PA-CF 0.3 0.0 0.6 2100 ; --- 0.4 0.0 0.6 2100 ; PC-CF 0.3 0.0 0.6 2100 ; --- 0.4 0.0 0.6 2100 ; PA12 0.25 0.0 0.6 2100 ; --- 0.3 0.0 0.6 2100 ; --- 0.4 0.13 0.6 2100 ; --- 0.6 0.0 0.6 2100 ; --- 0.8 0.0 0.6 2100 ; Wood 0.8 0.04 0.6 2100 ; TPU 0.4 0.0 1.0 2100 ;https://ozh.github.io/ascii-tables/
config-tools-size.g
set global.tool0NozzleSize = "0.4" set global.tool1NozzleSize = "0.4" set global.tool2NozzleSize = "0.4" set global.tool3NozzleSize = "0.6"
config-tools-material.g
set global.tool0NozzleMaterial = "brass" set global.tool1NozzleMaterial = "brass" set global.tool2NozzleMaterial = "brass" set global.tool3NozzleMaterial = "nozzlex" ;set global.toolNozzleMaterials = {"brass","brass","brass","nozzlex"}
-
@Diamondback thanks.
I still couldn't make it crash with your files, but I eventually got a crash with a similar M122 report to yours after running this macro several times:
var activeLEDs=10 while iterations < 1000 var displayContent = "progress" ^ var.activeLEDs set global.lastDisplayContent = var.displayContent echo "Done"
-
@dc42 Yea it seems quite random what exactly triggers it, the only things in common for me seem to be some of interaction with custom variables/arrays and possibly the dotstar LEDs, ofc, either one could be a coincidence...
-
@Diamondback I suspect it's an interaction between DWC polling the object model (which involves reading some values from the heap) and garbage collection of the heap taking place because string or array variables are being reassigned.
-
@dc42 I played around with the DWC polling time this morning but didn't get any immediate results, I'll play around with it some more and see if I can maybe make it go away by setting it much higher?
-
@Diamondback my next step will be to disconnect DWC completely and then see if I can provoke the reset by sending the command to run the macro over USB.
-
@dc42 Hm, I guess I can try the same by having the issue triggered by daemon.g and not having any browser connected to it? Or does DWC still do stuff in the background then somehow?
-
Confirmed, if I send the command over USB with DWC not connected, it doesn't reset. If I connect DWC and send the command over USB, it resets.
-
@Diamondback please try the firmware at https://www.dropbox.com/sh/z9f9v517t9txqh9/AACG2Dycr_EghlN4p1HsYVUNa?dl=0. It fixes the case that I was able to reproduce. The change is quite extensive, so please use it with caution.
-
@dc42 Will do! This includes the previous array memory leak fix?
-
@Diamondback yes it does. If you get any resets, please post a subsequent M122 report.
-
@dc42 Looking promising so far, no more resets atm.
I also yesterday played around more with the DWC polling frequency between 50ms and 60s and as you assumed, with lower values it was happening much quicker. -
-
-
@dc42 happy to report, no further resets over the day Many thanks!