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

    What's the correct way to send gcode to SBC

    Scheduled Pinned Locked Moved
    Duet Web Control
    4
    8
    515
    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.
    • stuartofmtundefined
      stuartofmt
      last edited by

      Hi -

      I'm working on a project (DuetLapse3.py) and trying to get it working with SBC (which I do not have but others are testing).

      Specifically - I am having problems sending gcodes and it may simply be that the wrong method / syntax is being used.

      with a NON SBC (Duet2Wifi) the following python code (where command is a string with the gcode command) works fine (as expected):

      URL=('http://'+duet+'/rr_gcode?gcode='+command)
              r = requests.get(URL, timeout=5)
      

      on SBC I've tried three approaches: this one returns http code 200 - but apparently does nothing at the Duet end

      URL=('http://'+duet+'/machine/status?gcode='+command)
              r = requests.get(URL, timeout=5)
      

      this (using post) gives a 405 Method not allowed error:

      URL=('http://'+duet+'/machine/status')
             r = requests.post(URL, data=command)
      

      and this gives a 404 (not found) error:

      URL=('http://'+duet+'/rr_gcode?gcode='+command)
            r = requests.get(URL, timeout=5)
      

      Any and all help appreciated.

      jay_s_ukundefined 1 Reply Last reply Reply Quote 0
      • jay_s_ukundefined
        jay_s_uk @stuartofmt
        last edited by

        @stuartofmt have you seen this?
        Might help
        https://github.com/Duet3D/DuetSoftwareFramework#rest-api

        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

        stuartofmtundefined 1 Reply Last reply Reply Quote 0
        • stuartofmtundefined
          stuartofmt @jay_s_uk
          last edited by

          @jay_s_uk

          No - and thanks! Seems that the correct form is

                  URL=('http://'+duet+'/machine/code')
                  r = requests.post(URL, data=command)
          

          i.e. /machine/code (as opposed to machine/status) in the post command. Definitely looks like my brain seeing something different than my eyes ....

          I'll submit a revised test to the "testers" 🙂

          1 Reply Last reply Reply Quote 1
          • stuartofmtundefined
            stuartofmt
            last edited by

            Folks - we are still experiencing problems with this and need some help.

            The issue is that we cannot seem to send Gcode commands to SBC Duet. Other commands (like getting status) work fine. So the ip address is correct (variable duet in the code below).

            Here is the relevant python3 code. For testing command = 'M117 Test of SBC':

                    URL=('http://'+duet+'/machine/code/')
                    r = requests.post(URL, data=command)
                    logger.info('URL was: '+r.url)
            
                if (r.ok):
                   return
                    
                logger.info('sendDuetGCode failed with code: '+str(r.status_code)+'and reason: '+str(r.reason))
                return
            

            This returns no http error i.e. from an http perspective the post works. This has also been tried with /machine/code (i.e. no trailing /). Same results.

            DWC is being used to monitor for the correct resonse. No message is ever displayed in DWC to the M117 command.

            on a non SBC the following works correctly.

                    URL=('http://'+duet+'/rr_gcode?gcode='+command)
                    r = requests.get(URL, timeout=5)
            

            Help ! 🙂

            1 Reply Last reply Reply Quote 1
            • stuartofmtundefined
              stuartofmt
              last edited by

              This is now resolved. It seems that DWS endpoints are not completely consistent.

              Sending a gcode of 'M117 Test of SBC' works in one situation bit not the other.
              Sending 'M117 "Test of SBC"' works in both situations.

              PCRundefined 1 Reply Last reply Reply Quote 0
              • PCRundefined
                PCR @stuartofmt
                last edited by

                Something for @chrishamm ?

                1 Reply Last reply Reply Quote 0
                • stuartofmtundefined
                  stuartofmt
                  last edited by

                  @chrishamm

                  FWIW (and I should have known better) - I prefer the stricter approach with the string being quoted. Exactly why I did not do that in the test ..... having said that we would not have discovered this discrepancy.

                  I note that the gcode documentation for M117 here:
                  https://duet3d.dozuki.com/Wiki/Gcode
                  shows both forms as examples.

                  1 Reply Last reply Reply Quote 0
                  • chrishammundefined
                    chrishamm administrators
                    last edited by

                    @PCR @stuartofmt I can confirm this bug and I've got a fix ready. Nevertheless I agree it's cleaner to quote strings everywhere.

                    Duet software engineer

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