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

    DuetLapse3

    Scheduled Pinned Locked Moved
    Third-party software
    20
    296
    31.8k
    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 stuartofmt

      Could someone please try this? It's a test script for the SBC calls. It's read only with the exception of a M117 'Test of SBC' which should show up in DWC.

      Once its placed in a directory permissions will need to be changed.

      chmod +x ./SBCTEST.py
      

      it can then be run with the following command

      python3 ./SBCTEST.py -duet <ipaddress of your SBC printer>
      

      with a bit of luck it will report success, in any case - if the resultant SBCTEST.log file can be posted back, that would be a great help.

      I've tested it on my non SBC duet - there may be some syntax errors in the unexercised code - but I hope not 🙂
      If there are then a screen shot would be helpful.

      [SBCTEST.py]

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

        Can do it tomorrow! Thank you

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

          @stuartofmt said in DuetLapse3:

          python3 ./SBCTEST.py -duet <ipaddress of your SBC printer>

          localhost Determine API Version
          localhost Testing: rr_model at address localhost
          localhost http://localhost/rr_model?key=boards
          localhost
          localhost Testing: /machine/system at address localhost
          localhost http://localhost/machine/status
          localhost
          localhost API model is: machine   Version is: 3
          localhost Status is :idle
          localhost Layer is :0
          Traceback (most recent call last):
            File "./SBCTEST.py", line 147, in <module>
              logger.info('Send Gcode result: '+sendDuetGcode(apiModel, 'M117 Test of SBC'))
            File "./SBCTEST.py", line 122, in sendDuetGcode
              r = requests.get.post(URL, data=command)
          AttributeError: 'function' object has no attribute 'post'
          
          

          Nothing is displayed on DWC

          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 stuartofmt

            @jay_s_uk

            Aghhhh - A definite typo ... Try this please.
            The rest looks good.

            [SBCTEST.py]

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

              @stuartofmt

              192.168.140.126 Determine API Version
              192.168.140.126 Testing: rr_model at address 192.168.140.126
              192.168.140.126 http://192.168.140.126/rr_model?key=boards
              192.168.140.126
              192.168.140.126 Testing: /machine/system at address 192.168.140.126
              192.168.140.126 http://192.168.140.126/machine/status
              192.168.140.126
              192.168.140.126 API model is: machine   Version is: 3
              192.168.140.126 Status is :processing
              192.168.140.126 Layer is :0
              --- Logging error ---
              Traceback (most recent call last):
                File "/usr/lib/python3.7/logging/__init__.py", line 1034, in emit
                  msg = self.format(record)
                File "/usr/lib/python3.7/logging/__init__.py", line 880, in format
                  return fmt.format(record)
                File "/usr/lib/python3.7/logging/__init__.py", line 619, in format
                  record.message = record.getMessage()
                File "/usr/lib/python3.7/logging/__init__.py", line 380, in getMessage
                  msg = msg % self.args
              TypeError: not all arguments converted during string formatting
              Call stack:
                File "./sbctest.py", line 147, in <module>
                  logger.info('Send Gcode result: '+sendDuetGcode(apiModel, 'M117 Test of SBC'))
                File "./sbctest.py", line 127, in sendDuetGcode
                  logger.info("gCode command return code = ",r.status_code)
              Message: 'gCode command return code = '
              Arguments: (405,)
              --- Logging error ---
              Traceback (most recent call last):
                File "/usr/lib/python3.7/logging/__init__.py", line 1034, in emit
                  msg = self.format(record)
                File "/usr/lib/python3.7/logging/__init__.py", line 880, in format
                  return fmt.format(record)
                File "/usr/lib/python3.7/logging/__init__.py", line 619, in format
                  record.message = record.getMessage()
                File "/usr/lib/python3.7/logging/__init__.py", line 380, in getMessage
                  msg = msg % self.args
              TypeError: not all arguments converted during string formatting
              Call stack:
                File "./sbctest.py", line 147, in <module>
                  logger.info('Send Gcode result: '+sendDuetGcode(apiModel, 'M117 Test of SBC'))
                File "./sbctest.py", line 127, in sendDuetGcode
                  logger.info("gCode command return code = ",r.status_code)
              Message: 'gCode command return code = '
              Arguments: (405,)
              192.168.140.126 Method Not Allowed
              Traceback (most recent call last):
                File "./sbctest.py", line 147, in <module>
                  logger.info('Send Gcode result: '+sendDuetGcode(apiModel, 'M117 Test of SBC'))
              TypeError: can only concatenate str (not "int") to str
              
              
              1 Reply Last reply Reply Quote 0
              • stuartofmtundefined
                stuartofmt
                last edited by stuartofmt

                @PCR @jay_s_uk

                Thanks - there was a silly formatting error (now fixed) but underlying that it looks like there was an http 405 error returned.

                I've added a two more version of the send gcode function to try - hopefully one of them works. Unfortunately the documentation and other examples (which purport to work) are somewhat vague on this aspect ....

                ALSO - if you are running RRF3.2 the default behavior for CORS seems to have changed. With another program I am using (DueUI) - I had to add the following to config.sys (up front in the network section) - after the upgrade. BUT DuetLapse was unaffected. It MAY be different on SBC.

                I'd suggest first trying "as is" but if this script still does not work with one of the methods (depending on what the errors are) - the CORS thing may need to be looked into.

                M586 C"*"                                     ;enable CORS
                

                New Test Script is here

                [SBCTEST.py]

                1 Reply Last reply Reply Quote 0
                • fractalengineerundefined
                  fractalengineer
                  last edited by

                  Awesome Stuart, thanks for carrying on Danal's work

                  Looks well documented too, I'll give it a shot over the weekend.

                  Very neat of you to handle issues outside of your own setup too

                  Do you think in it's current state this could realistically be implemented as a plugin in DWC for a possible GUI?

                  Railcore II ZL

                  stuartofmtundefined 1 Reply Last reply Reply Quote 2
                  • stuartofmtundefined
                    stuartofmt @fractalengineer
                    last edited by

                    @fractalengineer

                    Thanks. As a plugin ? hmmm . I'll have to see what that means / entails. Let me put that as a priority 2 for right now.

                    Priority 1 is getting SSB working and tidying up some of the logic / behavior surrounding pauses. I did not test that aspect much and its somewhat ambiguous - so stay tuned ...

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

                      @stuartofmt

                      192.168.1.31 Determine API Version
                      192.168.1.31 Testing: rr_model at address 192.168.1.31
                      192.168.1.31 http://192.168.1.31/rr_model?key=boards
                      192.168.1.31
                      192.168.1.31 Testing: /machine/system at address 192.168.1.31
                      192.168.1.31 http://192.168.1.31/machine/status
                      192.168.1.31
                      192.168.1.31 API model is: SBC   Version is: 3
                      192.168.1.31 Status is :idle
                      192.168.1.31 Layer is :0
                      192.168.1.31 ***Testing V0***
                      405
                      Method Not Allowed
                      192.168.1.31 gCode command return code = 405
                      192.168.1.31 Method Not Allowed
                      192.168.1.31 Send Gcode result: 405
                      192.168.1.31 ***Testing V1***
                      200
                      OK
                      192.168.1.31 Send Gcode result: 0
                      192.168.1.31 ***Testing V2***
                      404
                      Not Found
                      192.168.1.31 gCode command return code = 404
                      192.168.1.31 Not Found
                      192.168.1.31 Send Gcode result: 404
                      
                      

                      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

                        OK! Looks like V1 worked!! So you should have got a message on DWC saying "Test of SBC"

                        Did you see that ?

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

                          @stuartofmt
                          No, nothing displayed on DWC

                          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 stuartofmt

                            @jay_s_uk

                            Ok - I'm going to have to get some help. The code I have seen elsewhere (including Danal's) does not work (or I've done something stupid). The one that reports success - does not seem to send the gcode .... go figure .....

                            So - this should work for SBC -- but not for using the pause capability (that's the only thing that sends gcodes). Appreciate it if you could test before I update github

                            Hmm - wont let me upload the file to here. I'll update on github - if you would not mind downloading from there.

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

                              Ok it looks like we are getting close ( thanks to an "anonymous" tip in another thread 🙂 )

                              Can you try this please. V3 is the latest (and hopefully correct) form.

                              [SBCTEST.py]

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

                                In order to better handle pause situations - I need to access Duet to get a previously unused set of parameters. I'll post a new test script tomorrow. If successful - then SBC should be fully supported. Stay tuned and thanks for the help.

                                1 Reply Last reply Reply Quote 2
                                • PCRundefined
                                  PCR
                                  last edited by

                                  @stuartofmt i will have acces to my SBC printer tomorrow

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

                                    If all y'all could try this on SBC please

                                    [SBCTEST.py]

                                    In particular verify that a message appears in DWC "Test of SBC"

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

                                      @stuartofmt
                                      Good news

                                      Determine API Version
                                      localhost Testing: rr_model at address localhost
                                      localhost http://localhost/rr_model?key=boards
                                      localhost
                                      localhost Testing: /machine/system at address localhost
                                      localhost http://localhost/machine/status
                                      localhost
                                      localhost API model is: SBC   Version is: 3
                                      localhost Status is :idle
                                      localhost Send Gcode result: None
                                      localhost Layer: None
                                      localhost Get Position X and Y: 160 130
                                      

                                      bad news, no popup

                                      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

                                        Yikes on the lack of gcode being sent ... Unfortunately the API endpoint reports success - when clearly that is not the case ...

                                        This one last bit is turning out to be frustrating .... 😞

                                        The code for sending the gcode (thanks for the reference) is very simple. It works perfectly for rr_model (just uses a http get) but does not seem to want to play for /machine/gcode (which according to the doc requires a post).

                                        I've added a second slightly different syntax. I found two slightly different versions (one in DuetUI and the second in Danals DuetAPI). They are nearly identical, one has the url as .../machine/code and the other as /machine/code/ ...

                                        If you would not mind running it .....

                                        SBCTEST.py

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

                                          @stuartofmt
                                          no popup there either

                                          localhost Determine API Version
                                          localhost Testing: rr_model at address localhost
                                          localhost http://localhost/rr_model?key=boards
                                          localhost
                                          localhost Testing: /machine/system at address localhost
                                          localhost http://localhost/machine/status
                                          localhost
                                          localhost API model is: SBC   Version is: 3
                                          localhost Status is :idle
                                          localhost URL was: http://localhost/machine/code
                                          localhost Send Gcode result: None
                                          localhost Layer: None
                                          localhost Get Position X and Y: 160 130
                                          localhost URL was: http://localhost/machine/code/
                                          localhost Send Gcode result: None
                                          
                                          

                                          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

                                            I'll go back to the DWC threads and see if there are some ideas I can try.

                                            The good news is I've made the baseline code considerable more robust and have improved the handling of pauses (if used). But none of the pause improvements matter without the ability to send gcodes 🙂

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