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

    C++ API for Duet 3 Mainboard 6HC

    Scheduled Pinned Locked Moved
    DSF Development
    6
    24
    1.3k
    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.
    • ElevenJuneundefined
      ElevenJune @T3P3Tony
      last edited by

      @T3P3Tony I have a new question regarding a command
      How does the M291 command (to display a message) works ?
      If this command is in a G-Code being executed, how can I retrieve the message ? How will the REST API will notify me of this please ?

      1 Reply Last reply Reply Quote 0
      • ElevenJuneundefined
        ElevenJune
        last edited by

        Concerning the REST API, can I access a statut Response like the one proposed by RepRapFirmware please ? https://github.com/Duet3D/RepRapFirmware/wiki/JSON-responses
        I can't find any info on this.

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

          That's one for @chrishamm, however there is some documentation here https://github.com/Duet3D/DuetSoftwareFramework/blob/master/README.md.

          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

          ElevenJuneundefined 1 Reply Last reply Reply Quote 0
          • ElevenJuneundefined
            ElevenJune @dc42
            last edited by

            @dc42 Thank you for your answer ! My question is regarding this request : https://github.com/Duet3D/DuetSoftwareFramework/blob/master/README.md#get-machinestatus
            Do you know where I can find the status response that I will receive when using this request please ?

            1 Reply Last reply Reply Quote 0
            • MintyTreborundefined
              MintyTrebor
              last edited by MintyTrebor

              @ElevenJune: When getting status information I think you may benefit from understanding the JSON Machine Model, as most of the information returned via status requests will be either the full Machine Model, a subset, or a patch - depending on the api and commands you use. There is a Machine Model plugin for DWC which is a great way of navigating the model to find where keys/values are.

              For example you mentioned a M291 msg: When triggered, an M291 command will populate the Machine Model keys:

              state.messageBox.title
              
              state.messageBox.message
              

              So the command : M291 P"This Is A Test Msg" R"My Msg"
              Would result in:

              state.messageBox.title : "My Msg"
              
              state.messageBox.message : "This Is A Test Msg"
              

              The values will auto clear once the msg has been acknowledged or timed-out.
              (Note: There are other keys set by M291 but I have excluded them for brevity)

              (I actually use these keys specifically in my NodeDSF project to trigger events. I would normally point you at my code to give you an idea, but its node.js/javascript so I'm not sure it would be much help.)

              Hope this helps!

              NodeDSF - Native Node-Red integration with Duet boards.
              BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
              ReleaseMgr - Duet update info inside DWC.
              Repo

              ElevenJuneundefined 1 Reply Last reply Reply Quote 0
              • ElevenJuneundefined
                ElevenJune @MintyTrebor
                last edited by

                @MintyTrebor Thanks for your reply ! Unfortunately I will be programming in C++ so I cannot use this Machine Model. Do you know how I can access this type of information with the REST API to later use it in C++ please ?

                MintyTreborundefined 1 Reply Last reply Reply Quote 0
                • MintyTreborundefined
                  MintyTrebor @ElevenJune
                  last edited by

                  @ElevenJune If your using the rest api to query the status then you will have to use the machine model. The HTTP GET /machine/status request you can send returns a JSON object which is the Machine Model. If you go the websocket route, it will still be JSON and the machine model. I don't think there is any way around it with the rest api.

                  NodeDSF - Native Node-Red integration with Duet boards.
                  BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
                  ReleaseMgr - Duet update info inside DWC.
                  Repo

                  ElevenJuneundefined 1 Reply Last reply Reply Quote 0
                  • ElevenJuneundefined
                    ElevenJune @MintyTrebor
                    last edited by

                    @MintyTrebor Thanks for your reply.
                    Is MachineModel a Json structure that will be returned with the request ? Or is it a something like a JavaScript class ? I don't understand.

                    1 Reply Last reply Reply Quote 0
                    • MintyTreborundefined
                      MintyTrebor
                      last edited by

                      Is MachineModel a Json structure that will be returned with the request ?
                      Yes.
                      The easiest way of seeing it is by entering:

                      http://[your sbc/dsf ip address]/machine/status
                      

                      into your browser.

                      It should just return the full JSON Machine Model as text (if using firefox it will automatically parse for you).

                      For the avoidance of confusion - the returned data is just text with an enforced structural pattern (JSON)

                      NodeDSF - Native Node-Red integration with Duet boards.
                      BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
                      ReleaseMgr - Duet update info inside DWC.
                      Repo

                      ElevenJuneundefined 1 Reply Last reply Reply Quote 0
                      • ElevenJuneundefined
                        ElevenJune @MintyTrebor
                        last edited by

                        @MintyTrebor Thanks for your reply and your patience, I got a bit confused while reading the last messages !
                        This is what I am looking for. I don't have received my Duet card yet so I can't try the request, would you have a link showing the content of the Machine Model or an example of it please ?

                        1 Reply Last reply Reply Quote 0
                        • MintyTreborundefined
                          MintyTrebor
                          last edited by

                          https://duet3d.dozuki.com/Wiki/Object_Model_of_RepRapFirmware

                          will get you started.

                          NodeDSF - Native Node-Red integration with Duet boards.
                          BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
                          ReleaseMgr - Duet update info inside DWC.
                          Repo

                          ElevenJuneundefined 1 Reply Last reply Reply Quote 0
                          • ElevenJuneundefined
                            ElevenJune @MintyTrebor
                            last edited by

                            @MintyTrebor This is what I needed ! Thank you 🙂
                            If this the structure to use when I want to retrieve info during printing (like position, % of completion, speed, etc) or is there a other one ?

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