Navigation

    Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Conditional g-code extra functions

    Gcode meta commands
    2
    3
    92
    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.
    • tekkydave
      tekkydave last edited by tekkydave

      I would like to see some simple date/time functions added to the meta commands. At the moment I can't manually kill a long-running macro without doing an emergency stop. If the macro itself could calculate how long it has been running it could execute an M99 itself.

      One possible solution is a getDateTime function that populates an array:

      var dt = getDateTime()

      dt[0] is 4-digit year
      dt[1] is month 1-12
      dt[2] is day of month 1-31
      dt[3] is hour 0-23
      dt[4] is minute 0-59
      dt[5] is second 0-59
      dt[6] is milliseconds 0-999 (if possible)

      could also have day of week (mon,tue etc) or week number (0-52) etc etc

      Alternatively the format could be similar to the object model:
      e.g. dt.year. dt.month etc

      ~ tekkydave ~
      D-Bot: 300x300mm | Duet WiFi + Duex2 | 3 independent z motors | X,Y & Z linear rails | E3D Titan Aero + V6 | Precision Piezo z-probe
      FreeCAD, PrusaSlicer

      1 Reply Last reply Reply Quote 0
      • dc42
        dc42 administrators last edited by

        There is already an up time variable in the OM. However, to implement timeouts I think you will need to use variables, so that you can capture the up time at the start of the macro.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        1 Reply Last reply Reply Quote 0
        • tekkydave
          tekkydave last edited by

          Ok, that's interesting about the uptime. I realise my solution would have to wait for variables.

          I also just discovered that I can use the M291 command to periodically check with the user if they want to continue. It's a useful workround for now.

          ~ tekkydave ~
          D-Bot: 300x300mm | Duet WiFi + Duex2 | 3 independent z motors | X,Y & Z linear rails | E3D Titan Aero + V6 | Precision Piezo z-probe
          FreeCAD, PrusaSlicer

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