• Tags
  • Documentation
  • Order
  • Register
  • Login
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.
  • undefined
    Tinchus
    last edited by 18 Jan 2023, 00:36

    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?

    undefined undefined 2 Replies Last reply 18 Jan 2023, 01:35 Reply Quote 0
    • undefined
      HebigT @Tinchus
      last edited by 18 Jan 2023, 01:35

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • undefined
        OwenD @Tinchus
        last edited by 18 Jan 2023, 02:14

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

        undefined 1 Reply Last reply 18 Jan 2023, 15:58 Reply Quote 3
        • undefined
          Tinchus
          last edited by 18 Jan 2023, 13:18

          thank you all, problem solved!

          undefined 1 Reply Last reply 18 Jan 2023, 18:40 Reply Quote 0
          • undefined
            droftarts administrators @OwenD
            last edited by 18 Jan 2023, 15:58

            @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
            • undefined
              dc42 administrators @Tinchus
              last edited by dc42 18 Jan 2023, 18:40

              @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

              undefined 1 Reply Last reply 19 Jan 2023, 20:23 Reply Quote 0
              • undefined
                Tinchus @dc42
                last edited by 19 Jan 2023, 20:23

                @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

                undefined 1 Reply Last reply 19 Jan 2023, 21:17 Reply Quote 0
                • undefined
                  Sindarius @Tinchus
                  last edited by 19 Jan 2023, 21:17

                  @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
                  • undefined
                    Tinchus
                    last edited by 20 Jan 2023, 12:12

                    @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
                    9 out of 9
                    • First post
                      9/9
                      Last post
                    Unless otherwise noted, all forum content is licensed under CC-BY-SA