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

    Unexpectedly Long Daemon.g Execution Time

    Scheduled Pinned Locked Moved
    Gcode meta commands
    daemong.g sbc mode
    3
    3
    212
    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.
    • curieosundefined
      curieos
      last edited by curieos

      I have a daemon.g file meant to turn off the heaters after various idle intervals. I noticed the timer wasn't incrementing at the rate I expected, so I added a calculation to determine the elapsed time after the loop. I'm consistently getting elapsed time values in the 9-10 second range. I don't think this is expected?

      Running RRF 3.4.6 on a 6XD in SBC Mode with a Pi 4.

      The daemon file requires two global variables to be declared, bed_heater_timeout and tool_heater_timeout.

      var daemon_sleep = 2
      
      if !exists(global.heater_timer)
      	global heater_timer = 0
      
      while true
      	if (state.status == "idle" || state.status == "simulating")
      		var initial_time = state.upTime
      		var heaters_active = false
      		while iterations < #heat.bedHeaters
      			if heat.bedHeaters[iterations] !=-1
      				if heat.heaters[iterations].state == "active" || heat.heaters[iterations].state == "standby"
      					set var.heaters_active = true
      					if global.heater_timer >= global.bed_heater_timeout
      						M140 S-273.1
      		
      		while iterations < #tools
      			var current_tool = iterations
      			while true
      				if iterations >= #tools[var.current_tool].heaters
      					break
      				
      				if heat.heaters[tools[var.current_tool].heaters[iterations]].state == "active" || heat.heaters[tools[var.current_tool].heaters[iterations]].state == "standby"
      					set var.heaters_active = true
      					if global.heater_timer >= global.tool_heater_timeout
      						M568 P{var.current_tool} A0
      				
      		if var.heaters_active
      			var elapsed_time = state.upTime - var.initial_time
      			echo "Elapsed time: " ^ var.elapsed_time
      			if var.elapsed_time < 0
      				set var.elapsed_time = 0
      			
      			set global.heater_timer = global.heater_timer + var.daemon_sleep + var.elapsed_time
      		else
      			set global.heater_timer = 0
      	else
      		set global.heater_timer = 0
      	
      	G4 S{var.daemon_sleep}
      

      edit: The machine has 1 bed heater and 4 tools. It's an IDEX printer, so T0 and T1 use heaters 1 and 2, respectively. T2 and T3 are duplicator and mirror mode, and they both use heaters 1 and 2.

      I tested the same daemon.g file on a single tool, single bed heater machine running in standalone mode on a Duet 2, and the elapsed time is consistently less than 1 second.

      She/Her
      I work at a local 3D printing shop.
      Printers: Micron+ w/Duet 3 Mini, in-progress adaptation of the Jubilee REL onto an E3D MS, Prusa i3 MK3S.

      droftartsundefined chrishammundefined 2 Replies Last reply Reply Quote 0
      • droftartsundefined
        droftarts administrators @curieos
        last edited by

        @curieos Sorry for the delay in replying. One for @chrishamm to have a look at, I think.

        Ian

        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

        1 Reply Last reply Reply Quote 0
        • chrishammundefined
          chrishamm administrators @curieos
          last edited by

          @curieos Conditional G-code is known to be relatively slow in software v3.4. I suggest you upgrade to v3.5 ASAP, because that should be significantly faster.

          Duet software engineer

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