Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Filament change logic is not making sense.

    Scheduled Pinned Locked Moved
    General Discussion
    2
    2
    122
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Surgikillundefined
      Surgikill
      last edited by Surgikill

      Hey all,

      I'm trying to figure out an issue I am having with filament changes. I'm not sure if this is a new issue, or if I just never noticed this before.

      The way I have my duet configured is to use filaments stored on the machine.

      I have a load.g, unload.g, and config.g for each filament.

      Now, the problems arise when trying to load/unload filament from DWC.

      First, if I select the filament from DWC and click 'unload', it heats the bed and waits for the bed to reach temperature first. Is this intended? This is even before it executes M702. This seems counterintuitive. Is this being influenced by tool change macros? When I run T0, it puts the bed into standby mode. However, my toolchange macros don't call for that to happen.

      Also, when loading filament, it does not load the selected filament parameters before loading.

      For example, if I have PLA loaded, with an active temp of 230, it will unload the PLA, keep the active temp of 230, then when it goes to load PETG it will keep the active temp of 230, even when running M703. I am assuming that this is because the PETG is not 'loaded' yet according to the system. Only AFTER all the macros are done, does running M703 update the temps.

      Can anybody explain the logic here and help me figure out a way to get this to work, without needing to manually set temps in a load macro?

      Here is load.g

      M98 P"0:/macros/Filament/universal_load.g"
      

      and here is the 'universal_load.g' macro

      M703
      M291 R{"Loading " ^ move.extruders[state.currentTool].filament} P"Please insert filament and press OK" S3
      M302 P1                                                                  ;allow cold extrusion
      G1 E10 F200                                                              ; Feed 30mm of filament at 200mm/min
      M302 P0                                                                  ;disallow cold extrusion
      M568 A2
      echo "set tool heater to active"
      M98 P"0:/sys/pause_position.g"
      var TargetTemp = tools[state.currentTool].active[0]                       ;set TargetTemp to current tool active temp
      var thisHeater = tools[state.currentTool].heaters[0]
      while (heat.heaters[tools[state.currentTool].heaters[0]].current < var.TargetTemp)
      	M291 R"Waiting for temperature to be reached." P{"Current: " ^  heat.heaters[var.thisHeater].current ^ " | Target: " ^ var.TargetTemp}  S0 T2
      	G4 S2
      M83              ; Extruder to relative mode
      G1 E60 F200      ; Feed 60mm of filament at 200mm/min
      G4 P10           ; Wait 10ms
      while iterations >= 0
      	M291 P"Is color correct?" R"Color Change" S4 K{"Yes","No"}
      	if (input == 0)
      		break
      	if (input == 1)
      		G1 E40 F200 ; Feed 40mm of filament at 200mm/min
      		G4 P10   ; Wait 10ms
      G1 E-1 F1800     ; Retract 1mm of filament at 1800mm/min
      M400             ; Wait for moves to complete
      M568 A0          ; Turn tool off
      

      unload.g

      M98 P"0:/macros/Filament/universal_unload.g"
      

      and 'universal_unload.g' macro

      ;; Universal unload.g  - direct all other filament unoad.g instances to this file
      ;;
      ;M929 P"0:/macros/filament/unloadeventlog.txt" S3
      echo "entering 0:/macros/filament/universal_unload.g"
      M703
      if state.currentTool==-1
      	M291 R"No Tool" P"No tool selected. Press OK to unload tool 0" S2
      	T0 P0
      if (move.extruders[state.currentTool].filament == "")
      	M291 R"Error" P"No filament loaded. Unload aborted" S2 T2
      	M99
      M98 P"0:/sys/pause_position.g"
      var TargetTemp = tools[state.currentTool].active[state.currentTool]
      M568 A2; Heat current tool to active temp
      G4 S3
      var thisHeater = tools[state.currentTool].heaters[0]
      ;show progress of heating from lower temp
      while (heat.heaters[tools[state.currentTool].heaters[0]].current < var.TargetTemp)
      	M291 R"Waiting for temperature to be reached." P{"Current: " ^  heat.heaters[var.thisHeater].current ^ " | Target: " ^ var.TargetTemp}  S0 T2
      	G4 S1
      M291 R{"Unloading " ^ move.extruders[state.currentTool].filament} P"Retracting..." S0 T5
      M98 P"0:/macros/Filament/unload_moves.g"
      M568 P{state.currentTool} A0 ; Turn current tool off
      

      tpost0.g

      ; tpost0.g
      ; called after tool 0 has been selected
      ;
      ; generated by RepRapFirmware Configuration Tool v3.3.15 on Mon Dec 26 2022 22:40:57 GMT-0500 (Eastern Standard Time)
      ; Wait for set temperatures to be reached
      M703
      M116 P0
      
      chrishammundefined 1 Reply Last reply Reply Quote 0
      • chrishammundefined
        chrishamm administrators @Surgikill
        last edited by

        @Surgikill said in Filament change logic is not making sense.:

        First, if I select the filament from DWC and click 'unload', it heats the bed and waits for the bed to reach temperature first. Is this intended? This is even before it executes M702. This seems counterintuitive. Is this being influenced by tool change macros? When I run T0, it puts the bed into standby mode. However, my toolchange macros don't call for that to happen.

        That does not happen on my machine. When you unload a filament, the corresponding tool (T0) is selected beforfe M702 is called. If the tool has an active temperature set and if M116 is in your tpost0.g, RRF will wait for the active temperature to be reached before the filament change happens.

        @Surgikill said in Filament change logic is not making sense.:

        Also, when loading filament, it does not load the selected filament parameters before loading.

        Are you missing M703 to execute the filament's config.g after M701? DWC calls that automatically after loading via M701. Note that M703 within the load.g macro of your filament has no effect. M703 should be called when the filament has been loaded, because the filament mapping is NOT updated before load.g finishes.

        Duet software engineer

        1 Reply Last reply Reply Quote 0
        • droftartsundefined droftarts referenced this topic
        • First post
          Last post
        Unless otherwise noted, all forum content is licensed under CC-BY-SA