[3.5 rc1+] Error while changing filament
-
Hey,
I'm getting a weird error while using the DWC "change filament" functionality:Error: M701: Unload the current filament before you attempt to load another one Error: Push(): stack overflow on HTTP
I guess the first line is a follow-up to the stack overflow error?
Any clue what might be happening here? I think this started with the 3.5rc1.M122:
=== Diagnostics === RepRapFirmware for Duet 3 MB6HC version 3.5.0-rc.1+ (2023-11-01 10:30:38) running on Duet 3 MB6HC v1.02 or later (standalone mode) Board ID: 08DJM-9P63L-DJ3T0-6J1F4-3S06S-9A1V9 Used output buffers: 3 of 40 (33 max) === RTOS === Static ram: 154836 Dynamic ram: 132700 of which 20 recycled Never used RAM 29620, free system stack 136 words Tasks: NETWORK(1,ready,36.2%,147) ETHERNET(5,nWait,0.3%,117) ACCEL(6,nWait,0.0%,348) HEAT(3,nWait,0.0%,325) Move(4,nWait,0.0%,216) CanReceiv(6,nWait,0.0%,795) CanSender(5,nWait,0.0%,334) CanClock(7,delaying,0.0%,350) TMC(4,nWait,8.3%,59) MAIN(1,running,55.1%,103) IDLE(0,ready,0.0%,30), total 100.0% Owned mutexes: === Platform === Last reset 00:24:14 ago, cause: software Last software reset at 2023-11-12 12:49, reason: User, Gcodes spinning, available RAM 29468, slot 2 Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x00400000 BFAR 0x00000000 SP 0x00000000 Task MAIN Freestk 0 n/a Error status: 0x00 MCU temperature: min 40.9, current 42.1, max 42.2 Supply voltage: min 23.5, current 23.8, max 23.9, under voltage events: 0, over voltage events: 0, power good: yes 12V rail voltage: min 12.2, current 12.3, max 12.5, under voltage events: 0 Heap OK, handles allocated/used 495/405, heap memory allocated/used/recyclable 24576/24388/1184, gc cycles 337 Events: 0 queued, 0 completed Driver 0: standstill, SG min 0, mspos 456, reads 35702, writes 19 timeouts 0 Driver 1: standstill, SG min 0, mspos 360, reads 35703, writes 19 timeouts 0 Driver 2: standstill, SG min 0, mspos 424, reads 35703, writes 19 timeouts 0 Driver 3: standstill, SG min 0, mspos 904, reads 35703, writes 19 timeouts 0 Driver 4: standstill, SG min 0, mspos 520, reads 35699, writes 23 timeouts 0 Driver 5: standstill, SG min 0, mspos 408, reads 35703, writes 19 timeouts 0 Date/time: 2023-11-12 13:13:54 Slowest loop: 13.69ms; fastest: 0.05ms === Storage === Free file entries: 19 SD card 0 detected, interface speed: 25.0MBytes/sec SD card longest read time 3.1ms, write time 2.3ms, max retries 0 === Move === DMs created 125, segments created 6, maxWait 1308373ms, bed compensation in use: none, height map offset 0.000, ebfmin 0.00, ebfmax 0.00 no step interrupt scheduled Moves shaped first try 0, on retry 0, too short 0, wrong shape 0, maybepossible 0 === DDARing 0 === Scheduled moves 28, completed 28, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 1], CDDA state -1 === DDARing 1 === Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1 === Heat === Bed heaters 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0 Heater 0 is on, I-accum = 0.0 Heater 1 is on, I-accum = 0.2 === GCodes === Movement locks held by null, null HTTP is idle in state(s) 0 Telnet is idle in state(s) 0 File is idle in state(s) 0 USB is idle in state(s) 0 Aux is idle in state(s) 0 Trigger is idle in state(s) 0 Queue is idle in state(s) 0 LCD is idle in state(s) 0 SBC is idle in state(s) 0 Daemon is doing "G4 P500" in state(s) 0 0, running macro Aux2 is idle in state(s) 0 Autopause is idle in state(s) 0 File2 is idle in state(s) 0 Queue2 is idle in state(s) 0 Q0 segments left 0, axes/extruders owned 0x8000000f Code queue 0 is empty Q1 segments left 0, axes/extruders owned 0x0000000 Code queue 1 is empty === Filament sensors === check 0 clear 0 Extruder 0: no data received, errs: frame 0 parity 0 ovrun 0 pol 0 ovdue 0 Extruder 1: no data received, errs: frame 0 parity 0 ovrun 0 pol 0 ovdue 0 Extruder 2: no data received, errs: frame 0 parity 0 ovrun 0 pol 0 ovdue 0 Extruder 3: no data received, errs: frame 0 parity 0 ovrun 0 pol 0 ovdue 0 === CAN === Messages queued 13155, received 29867, lost 0, errs 0, boc 0 Longest wait 1ms for reply type 6042, peak Tx sync delay 10, free buffers 50 (min 49), ts 7274/7273/0 Tx timeouts 0,0,0,0,0,0 === Network === Slowest loop: 40.94ms; fastest: 0.03ms Responder states: MQTT(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0) Telnet(0) HTTP sessions: 1 of 8 = Ethernet = Interface state: active Error counts: 0 0 0 1 0 0 Socket states: 5 2 2 2 2 0 0 0 === WiFi === Interface state: disabled Module is disabled Failed messages: pending 0, notrdy 0, noresp 0 Socket states: 0 0 0 0 0 0 0 0 === Multicast handler === Responder is inactive, messages received 0, responses 0
-
@Diamondback Please share your filament unload.g/load.g/config.g files and all other macros that they call.
-
@chrishamm
Actual filament files: (I've picked one specific filament, there are many more like this)
load.gM98 P"/macros/FilamentConfig/PETG/load"
unload.g
M98 P"/macros/FilamentConfig/PETG/unload"
config.g
M98 P"/macros/FilamentConfig/PETG/config"
Filament specific redirection layer: (Each filament type has its own set of macros with the same code but different parameters)
/macros/FilamentConfig/PETG/load:
M98 P"/macros/FilamentConfig/Generic/load" T230 S210 R150 F{global.pebbleFeedSpeedDefault}
/macros/FilamentConfig/PETG/unload:
M98 P"/macros/FilamentConfig/Generic/unload" T240
/macros/FilamentConfig/PETG/config:
M98 P"/macros/FilamentConfig/Generic/config" N"PETG - Generic"
Generic macros:
/macros/FilamentConfig/Generic/load:set global.toolheadDisplayState = "filamentLoad" var extrusionTemp = var.T var extrusionMinTemp = var.S var retractionMinTemp = var.R set global.pebbleFeedSpeed = var.F ;apply commanded pebble feed speed M98 P"/macros/Misc/Lights/On" M291 P"Heating for purge" R"Filament" S0 T5 M98 P"/macros/Toolchanging/HomeIfNotHomed" var previousTemp = tools[state.currentTool].active[0] M568 P{state.currentTool} S{var.extrusionTemp} R0 M116 P{state.currentTool} M302 S{var.extrusionMinTemp} R{var.retractionMinTemp} ;Cold extrusion settings if move.axes[1].userPosition > 0 ;make sure we do not try to move to the purge location without being far away from the dock G90 G1 Y0 F25000 G1 X-70 F25000 G1 Y-220 F25000 M400 M98 P"/macros/Misc/Beep" M291 P"Ready to feed new filament?" R"Filament Loading" S2 var keepFeeding = true while var.keepFeeding == true G1 E300 F3000 M400 M291 S4 P"Filament loaded correctly?" R"Filament Loading" K{"Yes", "No, feed again"} if input == 0 set var.keepFeeding = false M98 P"/macros/Tool/Purge" M568 P{state.currentTool} S{var.previousTemp} R0 M116 P{state.currentTool} M98 P"/macros/Misc/Beep" set global.toolheadDisplayState = "idle" set global.deactivateToolAfterFilamentChange = true
/macros/FilamentConfig/Generic/unload:
set global.toolheadDisplayState = "filamentUnload" var releaseTemp = var.T M98 P"/macros/Misc/Lights/On" var previousTemp = tools[state.currentTool].active[0] M568 P{state.currentTool} S{var.releaseTemp} R0 M116 P{state.currentTool} M98 P"/macros/Misc/Beep" G91 G1 E-10 F3000 G4 S2 G1 E-30 F10000 M291 P"Ready to pull out filament?" R"Filament" S2 G1 E-500 F5000 G90 M400 M568 P{state.currentTool} S{var.previousTemp} R0 M116 P{state.currentTool} M98 P"/macros/Misc/Beep" set global.toolheadDisplayState = "idle" set global.deactivateToolAfterFilamentChange = true
/macros/FilamentConfig/Generic/config:
if state.currentTool < 0 M99 var pressureAdvance = 0 var retractionDistance = 0.5 var retractionSpeed = 2000 var zHopDistance = 0 var minExtrudeTemp = 180 var pebbleFeedSpeed = global.pebbleFeedSpeedDefault var name = param.N var nozzleSize = global.toolNozzleSizes[state.currentTool] M98 P"/macros/FilamentConfig/Generic/GetFilamentSettingsWithNameAndSize" N{var.name} S{var.nozzleSize} if global.lastMacroResult == null var errMsg = "Can't find filament settings for filament '" ^ var.name ^ "' and " ^ var.nozzleSize ^ "mm nozzle , falling back to defaults!" echo {var.errMsg} M291 P{var.errMsg} R"Filament Config" S2 else set var.pressureAdvance = global.lastMacroResult[0] set var.retractionDistance = global.lastMacroResult[1] set var.retractionSpeed = global.lastMacroResult[2] set var.zHopDistance = global.lastMacroResult[3] set var.minExtrudeTemp = global.lastMacroResult[4] set var.pebbleFeedSpeed = global.lastMacroResult[5] var minRetractTemp = var.minExtrudeTemp - 30 echo "Using filament settings: " ^ var.name ^ " with " ^ var.nozzleSize ^ "mm nozzle, Retraction: " ^ var.retractionDistance ^ "mm@" ^ var.retractionSpeed ^ "mm/min, Z-Hop: " ^ var.zHopDistance echo "PA: " ^ var.pressureAdvance ^ ", minimum extrusion temperature: " ^ var.minExtrudeTemp ^ ", pebble feed speed: " ^ var.pebbleFeedSpeed M207 S{var.retractionDistance} F{var.retractionSpeed} Z{var.zHopDistance} ;retraction settings M572 D{tools[state.currentTool].extruders[0]} S{var.pressureAdvance} ;pressure advance settings M302 S{var.minExtrudeTemp} R{var.minRetractTemp} ;cold extrusion settings set global.pebbleFeedSpeed = var.pebbleFeedSpeed ;set pebble feed speed
In order of appearance...
/macros/Misc/Lights/On:M42 P1 S230
/macros/Toolchanging/HomeIfNotHomed:
if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed || !move.axes[3].homed echo "Not all axis homed, starting full homing process" G28
/macros/Misc/Beep
M300 S500 P400
/macros/Tool/Purge:
M98 P"/macros/Toolchanging/Wiper/PrimeBrush" R15 G90 M564 S1
/macros/Toolchanging/Wiper/PrimeBrush:
var primeRepeats = 4 if exists(var.R) set var.primeRepeats = var.R M98 P"/macros/Toolchanging/Wiper/PrimeBrushPebbleDisk" R{var.primeRepeats}
/macros/Toolchanging/Wiper/PrimeBrushPebbleDisk:
if state.currentTool < 0 echo "Can't Prime & Brush, no tool selected!" M99 var brushStartPositionX = -80 var brushStartPositionY = -220 var brushEndPositionX = -130 var brushEndPositionY = -220 var pebblePositionX = -151.0 var pebblePositionY = -220.0 var diskStep = 50 var wiperHeightPurgeInitial = 20.6 var wiperHeightPurgeBulk = var.wiperHeightPurgeInitial - 1.5 var wiperHeightRotate = var.wiperHeightPurgeBulk - 2 var wiperHeightIdle = var.wiperHeightPurgeInitial - 5 var wiperHeightBrush = var.wiperHeightPurgeInitial + 0.5 var wiperPurgeAmountPrime = 2 var wiperPurgeAmountInitial = 2 var wiperPurgeAmountBulk = 3 var wiperHeightFeedrate = 3000 if state.currentTool < 0 echo "Can't Prime & Brush, no tool selected!" M99 if heat.heaters[tools[state.currentTool].heaters[0]].current > heat.coldExtrudeTemperature M106 S255 M564 S0 G90 G1 W{var.wiperHeightIdle} F{var.wiperHeightFeedrate} G1 X{var.brushStartPositionX} Y{var.brushStartPositionY} F25000 G1 W{var.wiperHeightBrush} F{var.wiperHeightFeedrate} G1 X{var.brushEndPositionX} Y{var.brushEndPositionY} F25000 G1 W{var.wiperHeightPurgeBulk} F{var.wiperHeightFeedrate} G1 X{var.pebblePositionX} Y{var.pebblePositionY} F25000 var primeRepeats = 10 if exists(var.R) set var.primeRepeats = var.R while iterations < var.primeRepeats G92 D0 M83 M106 S255 G90 G1 W{var.wiperHeightPurgeInitial} F5000 ;G11 if iterations == 0 G1 E{var.wiperPurgeAmountPrime} F{global.pebbleFeedSpeed} else G0 E1 F3000 G1 E{var.wiperPurgeAmountInitial} F{global.pebbleFeedSpeed} M106 S255 ;G1 W{var.wiperHeightPurgeBulk} F5000 G1 W{var.wiperHeightPurgeBulk} E{var.wiperPurgeAmountBulk} F{global.pebbleFeedSpeed/7} G4 P400 G0 E-1 F3000 ;G10 G90 G92 D0 G1 W{var.wiperHeightRotate} D{var.diskStep} F10000 G91 ;G1 D{var.diskStep} F20000 G90 G90 M106 S0 G1 W{var.wiperHeightPurgeBulk} F{var.wiperHeightFeedrate} G1 X{var.brushEndPositionX} Y{var.brushEndPositionY} F25000 G1 W{var.wiperHeightBrush} F{var.wiperHeightFeedrate} G1 X{var.brushStartPositionX} Y{var.brushStartPositionY} F25000 M564 S1 else echo "Skipping Prime & Brush due to unheated tool"
/macros/FilamentConfig/Generic/GetFilamentSettingsWithNameAndSize:
set global.lastMacroResult = null if !exists(param.N) || !exists(param.S) M99 var name = param.N var size = param.S while iterations < #global.filamentSettings if global.filamentSettings[iterations][0] == var.name var nozzleSizeId = -1 while iterations < #global.nozzleSizeMap if global.nozzleSizeMap[iterations] == var.size set var.nozzleSizeId = iterations if var.nozzleSizeId >= 0 var settings = global.filamentSettings[iterations][1][var.nozzleSizeId] set global.lastMacroResult = var.settings M99 else echo "Can't find nozzle size id for nozzle size: " ^ var.size M99 echo "Can't find filament settings for filament: " ^ var.name
-
-
@chrishamm Anything else I can help with?
-
@Diamondback You certainly call a lot of different macros in there. Stack overflows typically occur if the nesting becomes too deep. Can you please attach a USB terminal to your Duet, run
M111 P3 S1
, and capture the output you get when you try to change the filament? That should make it easier for us to identify the underlying cause.