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

    can modify daemon.g

    Scheduled Pinned Locked Moved
    General Discussion
    6
    9
    308
    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.
    • Tinchusundefined
      Tinchus
      last edited by

      Hello. I have created daemon.g file. But I did a misspell error and when trying to edit, the duet3 board tells me it cant delete the file because it is open. How can I edit it no?

      HebigTundefined OwenDundefined 2 Replies Last reply Reply Quote 0
      • HebigTundefined
        HebigT @Tinchus
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • OwenDundefined
          OwenD @Tinchus
          last edited by

          @Tinchus
          Right click on daemon.g and rename it to something else
          Then edit the renamed file.
          Then rename it back to daemon.g

          droftartsundefined 1 Reply Last reply Reply Quote 3
          • Tinchusundefined
            Tinchus
            last edited by

            thank you all, problem solved!

            dc42undefined 1 Reply Last reply Reply Quote 0
            • droftartsundefined
              droftarts administrators @OwenD
              last edited by

              @OwenD said in can modify daemon.g:

              Right click on daemon.g and rename it to something else
              Then edit the renamed file.
              Then rename it back to daemon.g

              Thanks, I've updated https://docs.duet3d.com/en/User_manual/Tuning/Macros#daemong with

              You can't directly edit a daemon.g file that is running on a Duet. To edit, right click on daemon.g in the SD card /sys folder and rename it to something else. This will stop the daemon.g file from running, and allow editing. Once the file has been edited, rename it back to daemon.g.

              Ian

              Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

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

                @Tinchus @droftarts a few notes on modifying daemon.g this way:

                • The purpose of renaming the file is that when daemon.g terminates, it will not be able to open it again (after the usual 10 second delay since it reached the end of daemon.g)
                • You will not be able to save the renamed file until the daemon process has finished executing it
                • Therefore, if daemon.g contains an infinite loop (which is what we recommend if the code it contains needs to be executed frequently because it avoids the overhead of re-opening the file on each iteration), you won't be able to save the modified file

                If you do have a daemon.g file that contains an infinite loop, then currently we recommend that you use a global variable to signal that daemon.g should terminate.

                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

                Tinchusundefined 1 Reply Last reply Reply Quote 0
                • Tinchusundefined
                  Tinchus @dc42
                  last edited by

                  @dc42 very usefull information. Can you post examples on how to do this? On my daemon.g I check the status of a thermistor, so Im not sure if this falls in your cathegory of "code that needs to e run frecuently" because in this check, I check the thermistor value and the using a IF statement I exwcute some macros
                  Also, how you terminate daemon.g using a variable? I thout daemon .g was ran once every second, and then it was terminated but the system itself

                  Sindariusundefined 1 Reply Last reply Reply Quote 0
                  • Sindariusundefined
                    Sindarius @Tinchus
                    last edited by

                    @Tinchus daemon.g is executed every 10 seconds unless it is setup in an infinite loop . In your config.g you can add

                    global daemonLoop = true
                    

                    then within your daemon.g you can do

                    while global.daemonLoop
                       ;Do Things
                      G4 S1 ; wait one second before rerunning the loop
                    

                    Whenever you need to stop daemon.g from running you would simply set the daemonLoop global to false in a console or via a macro.

                    set global.daemonLoop = false
                    
                    1 Reply Last reply Reply Quote 3
                    • Tinchusundefined
                      Tinchus
                      last edited by

                      @dc42 May be this should be looked (or not because it is actually not really much) but I have noticed this:

                      in the past the way I used daemon.g was putting inside the code I wanted and a G4 S1 to make it work every second.
                      While doing this my MCU temperature was between 37 and 42 degrees C
                      Tonight I have done the advised change and now my MCU is steady at 50C
                      and this temperature is while the board is just sitting, no printing and no other activity is being done.

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