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

    Understanding M20 Json Response

    Scheduled Pinned Locked Moved
    PanelDue
    2
    9
    798
    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.
    • edwinvargheseundefined
      edwinvarghese
      last edited by

      Hi All,

      A typical JSON response for M20 is as follows:

      {"dir":"0:/gcodes","first":0,"files":["ANGLE BRACKET (46.30).gcode","treefrog_45_SST1.gcode","treefrog_45_SST2.gcode","treefrog_45_SST3.gcode","treefrog_45_SST4.gcode","30mmCube_POT1.gcode"],"next":0,"err":0}

      I Can't find any information regarding the following pairs "first":0,"next":0,"err":0 . The error I guess will the error in the sd, but what all possible values do that have or just 0 and 1. It would be nice if someone can explain it. Thank you all in advance.

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

        A folder may contain more files than will fit in a single M20 json response. So when you send M20 S2 there is also an R parameter (default 0) which is the number of files to skip at the start. This value is returned in the 'first' field of the result. The 'next' field is the number you should ask to skip in your next M20 request to get the next block of files. If it is zero then there are no more files.

        'err' is currently always 0 for success and 1 for error. We may introduce other error codes in future, but 0 will always mean success.

        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
        • edwinvargheseundefined
          edwinvarghese
          last edited by

          Hi David,

          Thank you for your fast response. This information is missing on the duet Gcode and RepRap Gcode wiki. How much file name can be included in a JSON response can have at the present moment. Is there any limit on the size of JSON responses duet passes? Even on M408 S0 R and M408 S1 in case of the maximum messages that it can include?

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

            I added that info to the Duet3d wiki yesterday.

            The number of filenames that may be passed back in a single json response depends on the amount of buffer space available. That in turn depends on the number of web clients and other factors.

            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
            • edwinvargheseundefined
              edwinvarghese
              last edited by

              Yea I saw that on the wiki, I was about to edit it 🙂

              What is the maximum size of the buffer? I'm trying to build a new GUI interface. On the deserialization part, I can't finalize on the size of the buffer.

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

                There isn't a maximum specified size. PanelDue reads the file names as they arrive so it doesn't need to buffer the entire message; however it has a limit on how much file data it can store in its file list.

                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
                • edwinvargheseundefined
                  edwinvarghese
                  last edited by

                  what about the duet, is there any limit for maximum data it can send through a JSON response? like for M20 and M408 commands

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

                    In the current firmware build, the maximum total reply length would be 4K for Duet 2 and 7K for Duet 3.

                    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
                    • edwinvargheseundefined
                      edwinvarghese
                      last edited by

                      Thank you, David. That's what I was looking for 👍

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