timer without network
-
I'm using Duet 3 and RRF 3.5.0rc1
One of my printers is intended to normally function without connection to the internet, and so the local time is never set. The object model item state.time is null.I have some functions where I want to use a timer (logging the total print time). Normal process with the internet running is to grab state.time at the beginning and end of the timed task and subtract them. I typically convert state.time to seconds (+state.time) for this operation. With no internet, and state.time = null, I get an error with the +state.time function.
Is there a different way to make a timer?
Does it make sense that if there is no network conenction, the clock get started anyway, based on a epoch time?
Anyone know a good way to connect an RTC module to the board and have macros to set the time, then have the Duet timer use this if the internet is not available?
-
@mikeabuilder RRF sets the time when an HTTP client sends a connect message. So you could use an Arduino or ESP32 with a real time clock to connect to the RRF HTTP server, disconnect again, and repeat after half an hour or so.
There is also a M-command to set the time, so you could send that command over USB or serial.
Edit: it's M905.
-
@dc42 - thanks for the pointer. I'll look into the ESP-32 (I actually prefer the RPi pico). I have the hw to build out the micro. If I can;t find any, I may come back and ask for some pointers to references for the USB connection and protocols for sending commands to the Duet.
Meanwhile, I'll use M905 to set the RTC in my config.g to a default starting point and know that it'll be overwritten with a real datetime if I've got the Duet connected. That will give me a timer (and bogus timestamp in the even log).