Unexpectedly Long Daemon.g Execution Time
-
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.
-
@curieos Sorry for the delay in replying. One for @chrishamm to have a look at, I think.
Ian
-
@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.