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

rr_gcode flow control

Scheduled Pinned Locked Moved
Duet Web Control
3
8
603
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.
  • undefined
    CliveB
    last edited by 23 Apr 2020, 10:01

    I am writing a javascript system to control bespoke probing and creation of print commands on the fly using the DWC interface.

    This is all part of https://forum.duet3d.com/topic/15113/rotational-printer

    I am running the Duet Maestro board and version 3.01 RC6 software
    I can control the printer using rr_gcode and rr_status but I get long delays between command operation.

    If I concatenate my commands together and send them as one, they perform perfectly.

    I have tried two methods of control but using a javascript stack.

    1. Send the command when the machine status is 'I'
      or
    2. Send the command when there is enough space shown in the 'buff' response from the previous rr_gcode command.

    I can concatenate commands but would need to know how much space I have for this, I have assumed that it is the 'buff' response.

    I could write a macro file or gcode file and upload it using rr_upload - I have not looked at how this works yet ie can it take a memory image, is there a files size limit.

    Any suggestions would be welcome

    Retirement: when you work just as hard but without financial reward!
    You only stop learning when the lid is screwed down.
    www.remap.org.uk www.kyaningacdc.org
    Prusa i3 Mk3 - my workhorse

    1 Reply Last reply Reply Quote 0
    • undefined
      dc42 administrators
      last edited by dc42 23 Apr 2020, 11:11

      Method #2 is correct. However, to ensure good throughput, you must also pick up the replies using the rr_reply call, otherwise the system will run out of output buffers until the responses time out. Each command will generate a response.

      The 'buff' response does indeed tell you how much buffer space is available.

      You can also send multiple commands on a single line of GCode, subject to the line length limit of 160 characters.

      HTH David

      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
      • undefined
        CliveB
        last edited by 23 Apr 2020, 14:06

        Thanks for the prompt reply.
        I will rework the code now.

        Retirement: when you work just as hard but without financial reward!
        You only stop learning when the lid is screwed down.
        www.remap.org.uk www.kyaningacdc.org
        Prusa i3 Mk3 - my workhorse

        1 Reply Last reply Reply Quote 0
        • undefined
          CliveB
          last edited by CliveB 26 Apr 2020, 12:34

          I am monitoring the returned 'buff' value and sending concatenated gcodes to the Duet board when there is space.
          I am also following this up with a rr_reply message immediately on getting a response back from the original rr_gcode message.
          I am sending the codes faster than they are consumed so that the 'buff' figure runs down until it hits my safety low level, all seems fine. However, how does the 'buff' figure then recover?
          Is there anything I can send which will not consume the buffer space but report back on it's value?
          There is nothing in rr_status, rr_gcode or rr_reply that I can see will do the trick.

          Software now v3.01 RC10 DWC 2.1.5

          Thanks.

          Retirement: when you work just as hard but without financial reward!
          You only stop learning when the lid is screwed down.
          www.remap.org.uk www.kyaningacdc.org
          Prusa i3 Mk3 - my workhorse

          1 Reply Last reply Reply Quote 0
          • undefined
            CliveB
            last edited by 27 Apr 2020, 09:56

            Following on the experiments, I did some timings (mS).
            I have two HTTP streams, one a heartbeat every 300mS (The main Loop) and the other reserved for the main commands.

            0: Sent to machine gcode=G0%20X150%20G0%20X300
            1: Sent to machine gcode=G0%20X150%20G0%20X5
            25: Answer OK = {"buff":241}
            25: Request machine response
            26: Answer OK = {"buff":239}
            27: Request machine response
            48: Answer response OK =
            58: Answer response OK =
            149: main Loop status=B (asynchronous to 0 point )
            17859: main Loop status=I

            As far as I can see, the machine does not go idle until the whole command line is processed and, in this case, all moves are completed.

            In reality, I will not be sending the second set of gcodes until the answer back from the first.

            So after sending the commands and the buffer being reduced, the only change I can detect is the status code 17 seconds after the first transmission.

            Am I missing something?

            Retirement: when you work just as hard but without financial reward!
            You only stop learning when the lid is screwed down.
            www.remap.org.uk www.kyaningacdc.org
            Prusa i3 Mk3 - my workhorse

            1 Reply Last reply Reply Quote 0
            • undefined
              Danal
              last edited by 27 Apr 2020, 13:30

              It is a pretty strong diversion from your current path... but... I believe the Maestro has a serial interface that accepts G-Code. Certainly the Duet2 and up have it, to support the PanelDue.

              Have you considered interfacing there? It is 3.3V TTL serial, and there are a lot of threads about the request/response pattern.

              And/or the USB port.

              If network control is essential, an ESP32 for the serial, or a Pi for the USB, could be an "interface".

              Again, pretty far off of your path, but these should all be very stable, flow controlled, ways of getting to the printer.

              Delta / Kossel printer fanatic

              undefined 1 Reply Last reply 27 Apr 2020, 16:45 Reply Quote 0
              • undefined
                CliveB @Danal
                last edited by 27 Apr 2020, 16:45

                @Danal Thanks for the ideas.
                For the previous prototype, I used Marlin and the 8bit 1.4 Board and I took the suggestion to move to the Maestro board and had to do quite a bit to reconfigure everything (I don't regret the decision). I considered then offloading the calculations to an Arduino communicating over the serial ports.
                When taking on the Maestro and finding it had a web interface over a network it seemed a good idea to me (I had used the ESP8266 to create other web based applications) and have invested a lot of time in this new interface.
                I seem so close to a good working solution that I am pretty loathe to take another rework step.
                It does work using a combination of the returned "buff" value and using the status flag, but is not as good as hoped.
                I am sure that there must be a gcode that I can fire at the Maestro to return the buffer figure without consuming even more of it or that the rr_reply or rr_status could provide the figure as it appears to be essential for the efficient working of an external pre-processor.
                Once again, thanks for your thoughts.

                Retirement: when you work just as hard but without financial reward!
                You only stop learning when the lid is screwed down.
                www.remap.org.uk www.kyaningacdc.org
                Prusa i3 Mk3 - my workhorse

                1 Reply Last reply Reply Quote 0
                • undefined
                  Danal
                  last edited by 27 Apr 2020, 17:55

                  @CliveB said in rr_gcode flow control:

                  I seem so close to a good working solution that I am pretty loathe to take another rework step.

                  Perfectly understood, and it does sound like you are very close.

                  Keep us posted!

                  Delta / Kossel printer fanatic

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