@timedCall paused when connection to printer is lost

I'm currently trying to implement a reset Button for my printer. It is supposed to shutdown the printer and restart it after x seconds.
When the printer gets shut down and looses connection, the timed call to restart my printer is halted until the connection is reestablished. 
The restart sequence is working but the timed call is not calling the restart function.
Are timed and monitored calls automatically stopped and is there a way to change this behaviour? 


  • hello. could you provide me your script in your events?
  • Of course. 
    M80 and M81 are being replaced by a custom power on and off sequence, so the server is able to turn on power.
    The regex is matching M80\b so i tried replacing the M80 command with @echo "M80" but the command still won't be send after the printer is powerd off. 

    Before Power off:
    Send:18:34:10.188: @quickCommand "Reset Printer"
    Send:18:34:10.188: @set global.reset_delay_ms 12000
    Send:18:34:12.208: @call reset
    Mesg:18:34:12.209: Turning off printer, restart after 12s
    Mesg:18:34:21.058: Connection closed by os.
    After manually restarting the printer via M80:
    Note the time difference.
    Send:18:36:22.793: @gpio power_supply_reset on
    Send:18:36:22.793: @gpio power_supply_on on
    Send:18:36:22.793: @gpio power_supply_reset off
    Mesg:18:36:27.816: Dtr: true Rts: true
    Mesg:18:36:27.819: Printer reset requested false
    Mesg:18:36:27.819: Dtr: false Rts: false
    Mesg:18:36:27.842: Dtr: true Rts: true
    Send:18:36:27.844: @call turnOn
    Mesg:18:36:27.844: Restarting printer
    When I decrease the delay it works as expected, but the printer wont reset because the BTT relay I'm using comes with it's own 10s delay to turn off:
    Send:18:47:18.346: @quickCommand "Reset Printer"
    Send:18:47:18.346: @set global.reset_delay_ms 5000
    Send:18:47:20.135: @call reset
    Mesg:18:47:20.135: Turning off printer, restart after 5s
    Send:18:47:25.145: @call turnOn
    Mesg:18:47:25.146: Restarting printer

    Quickcommand Reset:

    @set global.reset_delay_ms 12000

    @func turnOn  M80   @echo "Restarting printer"@endfunc
    @func reset   M81 ; Turn off printer  @echo "Turning off printer, restart after {{global.reset_delay_ms/1000}}s"  @timedCall resetCall {{global.reset_delay_ms}} turnOn@endfunc
    @dialogStart "Power off printer and restart after {{global.reset_delay_ms/1000}}s" "Reset Printer?"  @dialogButton "OK" "@call reset"  @dialogButton "Cancel"@dialogShow
  • @set global.reset_delay_ms 5000

    @func turnOn

      @echo "M80" 

      @echo "Restarting printer"


    @func reset 

      M81 ; Turn off printer

      @echo "Turning off printer, restart after {{global.reset_delay_ms/1000}}s"

      @timedCall resetCall {{global.reset_delay_ms}} turnOn


    @dialogStart "Power off printer and restart after {{global.reset_delay_ms/1000}}s" "Reset Printer?"

      @dialogButton "OK" "@call reset"

      @dialogButton "Cancel"


     Formatting was weird.

  • Seems like the timed call is never calling @func turnOn when the printer is turned off/ not connected.
    When I start the script while the printer is turned off, M80 will never be printed.

  • I looked up and if the printer is not connected, timedCalls wont be executed. I will discuss this in the team and will look forward to find a fix for this issue. 
    Until then you can use sleep and a normal call to get the same result. 

  • Thanks a lot.
    Is there an integrated sleep function for the server commands? 
    I could use a lua script but I wanted to stick to g-code for printer specific tasks.
  • Yes, there is kind of. you can set a timer with @setTimer [value] and then wait for it to finish with @waitForTimer [value]

    So if you want to wait 3 seconds, this is what you want:

    @setTimer 3000
    @echo "done waiting"
  • Oh that's good to know. I didn't think they would work without an active print job timer.
Sign In or Register to comment.