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

    value's duration before an event

    Scheduled Pinned Locked Moved
    Gcode meta commands
    2
    4
    204
    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.
    • tekstyleundefined
      tekstyle
      last edited by tekstyle

      IS there a way to set it so that a somethings happens after a value = X for N seconds?

      example:

      I am trying to trigger M25 if the value stays NOT zero for longer than 5 seconds. Reason being, I don't want to trigger a pause event at all even if it will resume on it's own. I just want the pause command to be ignored competely if value!=0 is never longer than 5 seconds duration.

      if sensors.gpIn[1].value != 0
      echo "Pause initiated gpIn[1] =", {sensors.gpIn[1].value}
      echo "machine status =", {state.status}
      m25 ; pause

      Thanks in advance!

      tekstyleundefined 1 Reply Last reply Reply Quote 0
      • tekstyleundefined
        tekstyle @tekstyle
        last edited by

        @tekstyle wondering if any experts have some insights to this. thank you

        Nuramoriundefined 1 Reply Last reply Reply Quote 0
        • Nuramoriundefined
          Nuramori @tekstyle
          last edited by

          @tekstyle can you do a while loop that runs for five seconds once !=0 is met; within the while loop check for the status. If it returns to zero within the while loop then it exits. If the while loop completes, then it was !=0 for longer than five seconds and then can pause.

          tekstyleundefined 1 Reply Last reply Reply Quote 0
          • tekstyleundefined
            tekstyle @Nuramori
            last edited by

            @nuramori

            thanks. this works perfect. the only issue I ran into is when I manually pause, it wouldn't always stay paused but automatically resume. on the facebook thread, someone mentioned using daemon.g instead of m581. I'll have to dig a little more to see if this will work better.

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