Page 1 of 1

Slight tweak to Delay component

Posted: Tue Nov 28, 2023 10:58 pm
by RGV250
Hi,
I wonder why there is a limit of 2000 milliseconds and only integers allowed for seconds in the delay command.
I would like to have a 3.5 second delay so I have to do 3 seconds and then 500ms which just seems a bit messy.
Is it possible to either allow a greater range for milliseconds or better still 3 decimal places for the seconds so 3.450 is allowed which will allow for fine tuning.

Regards,
Bob

Re: Slight tweak to Delay component

Posted: Tue Nov 28, 2023 11:13 pm
by kersing
Non integer values would require floating point math to be included in the code which is terrible inefficient if it is just included for delay. Allowing delay to use a larger ms value would be more efficient.

Re: Slight tweak to Delay component

Posted: Tue Nov 28, 2023 11:34 pm
by RGV250
Hi,
I see your point on using FP, maybe another idea is you could do enter something like 3s 500ms and it gets handled in the background. Just a thought.

Bob

Re: Slight tweak to Delay component

Posted: Wed Nov 29, 2023 7:56 am
by RGV250
Just another thought, how about adding a "Hybrid" selection button. You could enter 3.500 and in the background it is treated as a string and the 3 and 500 are then seperated and used for the timebase.

Bob

Re: Slight tweak to Delay component

Posted: Wed Nov 29, 2023 9:17 am
by Steve-Matrix
Thanks for the suggestion, Bob. I will look into it.

But you might want to avoid long delays in your code anyway. For example, if you are waiting for a long external process to occur, a better strategy would be to use a loop with a much shorter delay. Inside the loop you can poll for the result of that long process so you can minimise the delay, and also do any other 'maintenance' (e.g. check for user input) so your running app is not blocked.