terjeio / ioSender

A GCode Sender for Grbl and grblHAL written in C# (Windows only).
BSD 3-Clause "New" or "Revised" License
222 stars 66 forks source link

REQ: Option to enable timestamp prepending in console feedback view #268

Open 5ocworkshop opened 1 year ago

5ocworkshop commented 1 year ago

Thanks again for all the great work on grblHAL and IOSender.

I was working with some folks on the PrintNC Discord today investigating some odd behaviour around spindle on delay and we were comparing the actual ramp times to various target RPMs with the trigger settings for the alarm. It occured to me while doing this that in some instances it could be really helpful to have date/time stamps prepended to the log entries in a fixed width format so that we could see the exact seconds/milliseconds the controller is reporting certain things. It would help during debug/QA work.

Is this something that can easily be added at the UI level with a tick box to enable or disable? I'm afraid I can't offer to assist in coding it but I am happy to test it and report back.

terjeio commented 1 year ago

Can this grblHAL plugin template be used? It adds a timestamp to the real time report resettable by M101.

<Idle|MPos:0.000,0.000,0.000,0.000|Bf:35,1023|FS:0,0|Pn:PXYZA|TS:9:04,0869>

5ocworkshop commented 1 year ago

That looks very helpful for debug. Thank you!

5ocworkshop commented 1 year ago

Another thought - could we have this function request the system time from the host (optionally) and then use this timer inside grblHAL to track the offsets but print wall time back in the reports? Some debug pure timestamps are helpful and other times relating it to wall time for a task is helpful.

terjeio commented 1 year ago

Some drivers has real time clock (RTC) available already - mostly networked drivers. This is set from ioSender on connect. $RTC reports the current value when the clock it is set, e.g [RTC:2023-01-25T20:11:09]

Do you need millisecond resolution for the timestamp and can/should the date part be skipped?

5ocworkshop commented 1 year ago

I don't think millisecond is necessary for most testing and the date can probably be skipped without any significant loss. I'm not sure if the Hal2000 or the FlexiHAL have RTC, will check.

terjeio commented 1 year ago

At least the Teensy has a RTC, running off a 32KHz crystal. IIRC it is possible to run a RTC off the main oscillator with some loss of accuracy - and FYI the STM32F4xx driver has RTC support, but may need a code change to select the oscillator source if a 32KHz source is not available.

I'll add a M-code parameter to the plugin for switching timestamp between elapsed time and RTC.

terjeio commented 1 year ago

RTC support added. ioSender sets the RTC when connecting to the controller, for others set it with the $RTC command.

andrewmarles commented 1 year ago

FlexiHAL will need a different clock config to enable RTC as the external 32.768 kHz XO is not present (pins are used for other things). I will work on adding support and a PR.