A problem with outputs

If you have a question about the software please ask it here.

Re: A problem with outputs

Postby Robertspark » Sun Oct 14, 2018 9:32 am

Thanks for the explanation.
exec.wait() is good enough for me
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: A problem with outputs

Postby Dan911 » Sun Oct 14, 2018 12:35 pm

Thanks for the explanation Balazs, I always assumed wait() was a UCCNC function for Thread.Sleep although I did experience different results of the 2 like Terry. I found the opposite though, wait() skipped and Thread.Sleep more reliable. In testing to see accuracy of Thread.Sleep I would consistently get a Out of Memory window after 10 minuets.

In my inexperienced, lack of knowledge opinion, Thread.Sleep is needed and great for it's purpose but what Terry is trying to use it for there are other more reliable options.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: A problem with outputs

Postby Battwell » Sun Oct 14, 2018 12:53 pm

i found this writing my button timer code.
setting a variable to the tick timer- anything else could access it if required.
seems to be working sweet.
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 819
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: A problem with outputs

Postby cncdrive » Sun Oct 14, 2018 6:01 pm

Lines run in a linear order so I'm not sure what are you talking about.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: A problem with outputs

Postby cncdrive » Sun Oct 14, 2018 6:06 pm

Maybe you thought about passing motion g-code line with exec.Code?!
That will pass the command to the motion buffer and then the exec.Code will finish.
That still does not mean that the lines don't run in linear order, they do, but the exec.Code finishes as soon as the command is passed to the controller.
The programmer then can decide if he wants to wait for the motion to stop using e.g. a while ismoving loop or if he wants to do other things while the motion is ongoing.
If the exec.Code would wait for the motion to end that would limit what the programmer can do.
But I think we have talked about this several times, that it is impossible to decide what to allow the programmers to do, I mean if we allow too many things then that is a problem for some people and if we allow too few things then that is a problem for other people.
For Terry it seems that both is a problem. :)
I mean in some cases Terry told me to allow more and now this "linear order of lines issue" suggests to allow less.
So, what should we do?! :)
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: A problem with outputs

Postby beefy » Sun Oct 14, 2018 8:40 pm

Vmax549 wrote:My Question and concern is WHY Macros cannot be made to just run in linear order. Complete each line of code before starting teh next. That would eliminate any need for Wait()/Sleep() by the users. I am constantly having to GUESS how long to wait to make SURE it completes but not wanting to add more than is needed as that time can add up over Long routines. IF i fine tune it for this PC then the next PC it may have to be tweaked to another value.

(;-) TP


Terry,

like Balazs, I'm a little confused by what you mean. In most programs, each line of code completes before moving onto the next.

As for macros running in linear order, do you mean macro 1 runs and completes, THEN macro 2 runs and completes, and so forth. If that's what you mean, one idea off the top of my head is flags. You could even create LEDs (one for each macro) which are set at the end of each macro. So all macros are actually running at the same time but they're all "scanning" for the LED of interest to come on.

So macro 2 is waiting for the "macro 1 finished LED" to come on. When it comes on, macro 2 immediately turns it off then runs its code. This way you could have heaps of macros running yet they ALL can run sequentially.

Or was that not what you meant at all :lol:

Keith
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: A problem with outputs

Postby ger21 » Sun Oct 14, 2018 9:57 pm

Is the wait in this case required to wait for the screen to be updated?

If you wrote 1.111 to a var, then read it, would it still require the wait? I don't think so.

I've always used wait when writing to fields, just out of habit, as Mach3 required them to allow for the screen to update.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am

Re: A problem with outputs

Postby Dan911 » Sun Oct 14, 2018 11:15 pm

Each line will complete, the wait's aren't needed.
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: A problem with outputs

Postby cncdrive » Mon Oct 15, 2018 3:25 am

Balazs can you give an example of HOW this would limit macro programs if everything ran in perfect order ??


Terry, I can't give a concretised example, but I can describe it to you.
A motion command can take long time to finish and the programmer/user might want to do things, check things, execute some other non motion things while the motion is still ongoing.
If the exec.Code would give the control back to the macro only when the command, the motion would fully finish then the programmer/user could not do anything else in the meatime.
In my opinion this would limit the programmer if they will have no other choice than to wait and could not run any other codes and tasks.
And again, ofcourse the lines execute always in the correct order, it is handled by the .NET C# compiler (CodeDOM) which ofcourse does not execute code in a random manner...
A time wait in those cases are not needed, but a wait with ismoving check can be done to wait the exact time until the motion is finished.

I'm not offended at all, I'm just trying to point out that there is a contradiction, because on one hand you often ask for more freedom in what can be done and one the other hand you want something which would give less freedom...
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Previous

Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 4 guests