state.time if there is no network.
-
HW: Duet2 wifi
RRF: 3.5 beta2Rewriting this whole thing...
I will run my system in most cases with the network not connected, meaning the date/time will not be set to network time.
I also have a macro that uses +state.time for a timer. When I run this macro I get an error.
To repro this, I use this macro:
var now = +state.time M291 s1 t10 P{var.now}
If I power up my duet board without the network connected, I get this error:
power up + 00:00:20 [warn] Error: in file macro line 1 column 22: meta command: expected numeric or enumeration value after '+'
Any suggestions for a workaround?
-
@mikeabuilder does exists(state.time) return true only if the time is known?
Can you use state.upTime for your timer instead?
-
@mikeabuilder Shouldn't it be
var now = state.time
? Ifstate.time
isnull
, I suppose you could set a dummy time using M905 at the start of your config.g. -
@dc42 - I'll check on whether state.time exists, but I like your suggestion to use state.uptime. It seems a much safer long term solution.
@chrishamm - I used the +state.time to get the time in seconds, vs the human readable version. I also like the suggestion for setting the time - something I didn't know existed.
Now I'll go try to connect an RTC device to the duet board. I see an I2C bus on the expansion board. More fun with hardware.