can modify daemon.g
-
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?
-
This post is deleted! -
@Tinchus
Right click on daemon.g and rename it to something else
Then edit the renamed file.
Then rename it back to daemon.g -
thank you all, problem solved!
-
@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.gThanks, 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
-
@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.
-
@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 -
@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
-
@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.