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

    [DSF Extension] Exec On MCode (was: Shutdown SBC)

    Scheduled Pinned Locked Moved
    DSF Development
    22
    117
    9.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.
    • wilrikerundefined
      wilriker
      last edited by

      Just as a short teaser: the upcoming version will allow an arbitrary amount of M-code+command pairs.

      Manuel
      Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
      with probably always latest firmware/DWC (incl. betas or self-compiled)
      My Tool Collection

      1 Reply Last reply Reply Quote 0
      • tobias_munichundefined
        tobias_munich
        last edited by

        great Job !! many thanks.
        exactly what I looked for

        Tobias

        Hypercube-Evolution, Dual-Z, Nimble v2, Orion Piezo
        Duet3, DuetWifi, Raspberry Pi 4, 7 inch HDMI Display, Panel-Due
        Firmware: RepRapFirmware for Duet 3 MB6HC 'always the latest release'

        1 Reply Last reply Reply Quote 0
        • wilrikerundefined
          wilriker
          last edited by wilriker

          Release v3.0

          This release adds the possibility to provide an arbitrary amount of -mCode + -command tuples. This way it is possible to have a single instance of execonmcode handle all the custom commands.

          Note that as part of this change there is no longer a default value for -mCode.

          Get it at GitHub Releases page.

          EDIT: This version is built agains goduetapiclient 1.2.0 and as such will only work with DSF 1.2.2.1 and later. In case you need a version that is working with DSF <= 1.2.2.0 please tell me here. It's not a problem to provide that as well.

          Manuel
          Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
          with probably always latest firmware/DWC (incl. betas or self-compiled)
          My Tool Collection

          gtj0undefined 1 Reply Last reply Reply Quote 1
          • gtj0undefined
            gtj0 @wilriker
            last edited by

            @wilriker I can't believe I missed this whole thread! Gonna give it a try tomorrow.

            I'm also working on something to allow the SBC to do a hardware reset and flash erase via GPIO pins for cases where the firmware is stuck and you can't get to the board. Could be a good companion to your utility.

            wilrikerundefined 1 Reply Last reply Reply Quote 0
            • wilrikerundefined
              wilriker @gtj0
              last edited by

              @gtj0 Glad to hear about any use-cases. 🙂

              I myself use it to run poweroff as well as activating and deactivating my webcam (starting/stopping a systemd unit).

              Manuel
              Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
              with probably always latest firmware/DWC (incl. betas or self-compiled)
              My Tool Collection

              1 Reply Last reply Reply Quote 0
              • A Former User?
                A Former User
                last edited by

                Tempting to try with a small I2C OLED on the Pi, but not top of the list just yet

                1 Reply Last reply Reply Quote 0
                • chas2706undefined
                  chas2706
                  last edited by

                  @wilriker

                  This sounds really good. I would like to use it to activate a bash script on my system but I have attempted to install it and I cant get it to work.
                  I followed your instructions in your first post but using execonmode V3:

                  I downloaded execonmode and placed it into /usr/local/bin.
                  I tried to run it using sudo ./execonmode -help (just to see if it works) but I get the error message "cant open binary".

                  Could you instruct me where i'm going wrong.

                  BTW I am on the latest version of RRF3 and up to date with DSF etc.

                  Thanks in advance.

                  wilrikerundefined 1 Reply Last reply Reply Quote 0
                  • wilrikerundefined
                    wilriker @chas2706
                    last edited by

                    @chas2706 If you run

                    sudo ./execonmcode -help
                    

                    It will try to find the executable in the current directory you issue this command. To have your shell locate it in your $PATH remove the ./ in front of execonmcode. For -help you don't need sudo BTW.

                    To make sure that it can find it also check if

                    echo $PATH
                    

                    actually does contain /use/local/bin.

                    Last thing: you spelled it execonmode instead of execonmcode (extra "c" after "m") above. Make sure that's only a typo here. I might rename the executable in the future to something less error-prone.

                    Manuel
                    Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                    with probably always latest firmware/DWC (incl. betas or self-compiled)
                    My Tool Collection

                    1 Reply Last reply Reply Quote 0
                    • chas2706undefined
                      chas2706
                      last edited by

                      @wilriker
                      Thanks for the info. I will give it another go.

                      execonmode was just a typo error in my post lol.

                      Thanks

                      1 Reply Last reply Reply Quote 0
                      • chas2706undefined
                        chas2706
                        last edited by

                        @wilriker said in [DSF Extension] Exec On MCode (was: Shutdown SBC):

                        ./execonmcode -help

                        I have placed execonmcode in /usr/local/bin and typed the following in the terminal without success:

                        pi@Duet3:~ $ cd /usr/local/bin
                        pi@Duet3:/usr/local/bin $ ls
                        execonmcode listen-for-shutdown.py
                        pi@Duet3:/usr/local/bin $ ./execonmcode -help
                        bash: ./execonmcode: Permission denied
                        pi@Duet3:/usr/local/bin $ sudo ./execonmcode -help
                        sudo: ./execonmcode: command not found
                        pi@Duet3:/usr/local/bin $ execonmcode -help
                        bash: /usr/local/bin/execonmcode: Permission denied
                        pi@Duet3:/usr/local/bin $ sudo execonmcode -help
                        sudo: execonmcode: command not found
                        pi@Duet3:/usr/local/bin $

                        wilrikerundefined 1 Reply Last reply Reply Quote 0
                        • wilrikerundefined
                          wilriker @chas2706
                          last edited by

                          @chas2706 Have you made execonmcode executable via sudo chmod +x /usr/local/bin/execonmcode? I think that's missing from the installation instructions.

                          Manuel
                          Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                          with probably always latest firmware/DWC (incl. betas or self-compiled)
                          My Tool Collection

                          1 Reply Last reply Reply Quote 0
                          • chas2706undefined
                            chas2706
                            last edited by

                            @wilriker

                            No I forgot!!

                            My silly mistake! It works a treat now.

                            Thank you for your help.

                            wilrikerundefined 1 Reply Last reply Reply Quote 0
                            • wilrikerundefined
                              wilriker @chas2706
                              last edited by

                              @chas2706 Thank you for implicitly pointing out a hole in the installation instructions. I amended that to GitHub already and will fix it above in an instant.

                              Manuel
                              Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                              with probably always latest firmware/DWC (incl. betas or self-compiled)
                              My Tool Collection

                              1 Reply Last reply Reply Quote 0
                              • chas2706undefined
                                chas2706
                                last edited by

                                @wilriker

                                No problem, again thanks for your help and for producing a fantastic plugin.

                                1 Reply Last reply Reply Quote 0
                                • wilrikerundefined
                                  wilriker
                                  last edited by

                                  Important Note

                                  The current version of Exec On MCode is NOT compatible with DSF 1.3.0+. It will connect but fail at a random point in time which might lead to breaking side-effects. I will release a new version tomorrow or Monday. Until then, don't use this tool with DSF 1.3.0+.

                                  Manuel
                                  Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                  with probably always latest firmware/DWC (incl. betas or self-compiled)
                                  My Tool Collection

                                  1 Reply Last reply Reply Quote 0
                                  • chas2706undefined
                                    chas2706
                                    last edited by

                                    @wilriker said in [DSF Extension] Exec On MCode (was: Shutdown SBC):

                                    Important Note

                                    I plan to temporarily remove this feature can you confirm that all I need to do this is to delete the extension?
                                    I did not enable it to run at start up.
                                    Many thanks for pointing this out.

                                    wilrikerundefined 1 Reply Last reply Reply Quote 0
                                    • wilrikerundefined
                                      wilriker @chas2706
                                      last edited by wilriker

                                      @chas2706 If you don't start it (automatically or manually) there is no need to do anything. It can sit in the filesystem that won't have any effect until you execute it.

                                      Manuel
                                      Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                      with probably always latest firmware/DWC (incl. betas or self-compiled)
                                      My Tool Collection

                                      1 Reply Last reply Reply Quote 0
                                      • wilrikerundefined
                                        wilriker
                                        last edited by

                                        Release 4.0

                                        This version works with DuetSoftwareFramework 1.3.0 and later.

                                        Unfortunately due to breaking changes in the API of DSF this is NOT backwards-compatible with older versions of DuetSoftwareFramework.

                                        This release also has a new parameter -trace that will enable output of the underlying requests/responses to/from DuetControlServer.

                                        It can be downloaded as usual from GitHub Releases page.

                                        Manuel
                                        Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                        with probably always latest firmware/DWC (incl. betas or self-compiled)
                                        My Tool Collection

                                        1 Reply Last reply Reply Quote 2
                                        • wilrikerundefined
                                          wilriker
                                          last edited by

                                          Release v5.0

                                          This release updates godsfapi to v2 and thus is only compatible with Duet Software Framework 2.1.0 and later.

                                          New Features

                                          • A new command-line paramter -version to output the version and exit

                                          Bug fixes

                                          • After a handled code is intercepted and before the assigned command is executed Flush will be called to make sure we are in sync with the machine

                                          It can be downloaded as usual from GitHub Releases page

                                          Manuel
                                          Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                          with probably always latest firmware/DWC (incl. betas or self-compiled)
                                          My Tool Collection

                                          1 Reply Last reply Reply Quote 1
                                          • gtj0undefined
                                            gtj0
                                            last edited by

                                            So many possibilities, so little time. I'd like to take a week off from my day job to do all the things that things like this can enable. 🙂

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