Can't edit/save daemon.g that contains a 1 sec loop.
-
@zapta sorry, I paste but indentation was deleted, the daemong looks like this:
if global.runDaemon = true while true mycode G4 S2
And of course inside the "mycode" section, Have some G4 S0.5 to be sure the while is not running forever.
This is workign ok for me now, but I have just noticed that if I delete the if global.runDaemon = true I still can edit and save the daeom.g file... may be with latest versions of firmware now the file is not locked for edition anymore while still being active?
PD: indentation was erased again... ok, beleiveme , my daemon is running ok every 2 seconds jajajaja
-
@Tinchus, to post code here you can use the </> button. It will preserve the indentation.
example:
code1 code2 code3
-
Once you check the flag once and enter the infinite loop, the flag is not examined anymore so the loop will not stop when runDaemon becomes false.
How do you sent the flag to false to stop the daemon and do you restart the machine to do so?
-
@zapta yes, I restarted the machine several times, for some reason I can edit and save the daemon.g without renaming it at all. I just edit it on the iterface, save it and it is being accepted...
-
@Tinchus said in Can't edit/save daemon.g that contains a 1 sec loop.:
@zapta yes, I restarted the machine several times, for some reason I can edit and save the daemon.g without renaming it at all. I just edit it on the iterface, save it and it is being accepted...
That has been my experience as well.
Frederick
-
@chrishamm What happens if, for example, you have the loop set for a much higher value, say, 100 iterations? I'm asking to understand how the daemon.g file works, so I can make good decisions on how to use it.
For example, let's say you set it to 100. The file gets run every 10 seconds, so what happens if it's still running 10 seconds after it was run, due to the loop? Will a second instance run, or does the 10 seconds not even start until the original run ends? The former would get messy memory wise; the latter would mean it wouldn't run every 10 seconds, but instead every 10 seconds plus how long it takes to run. Or, does it "know" it's already running and skip the trigger? That would make the period between runs unpredictable.
Also, what's the best way for it to check whether there's a print job running at the moment, so I can write code to only execute during a job?
-
@DonStauffer said in Can't edit/save daemon.g that contains a 1 sec loop.:
Also, what's the best way for it to check whether there's a print job running at the moment, so I can write code to only execute during a job?
Take a look at the object model documentaton: https://github.com/Duet3D/RepRapFirmware/wiki/Object-Model-Documentation in particular the state.status it probably has what you need.
-
@Tinchus said in Can't edit/save daemon.g that contains a 1 sec loop.:
if global.runDaemon = true while true mycode G4 S2
Use this instead:
while global.runDaemon mycode G4 S2
-
@gloomyandy That may work, but it does raise questions:
-
If state.status is "busy", does that imply a job is running, or is it impossible to tell whether maybe it's just executing a G1 from the console, for instance? Would you have to wait for it not to be busy to determine whether there's a job running?
-
Does running a macro count as "processing" or is that status only when an actual print job is running?
Put another way, what would the test be for simply whether a job is running/unfinished or not, regardless of what else exactly is happening at the time?
-
-
@DonStauffer state.status is "processing" only while a job is running from SD card. It's still "processing" even if the job calls a macro.