Hello Guest it is April 27, 2024, 05:36:30 PM

Author Topic: force screen label to refresh  (Read 428 times)

0 Members and 1 Guest are viewing this topic.

force screen label to refresh
« on: December 05, 2022, 08:40:14 PM »
I'm using an on screen label for operator information,  But it does not always refresh.  Is there a way to force the individual object to refresh?  I've tried the scr screen refresh command and that does not seem to help.  the maddening thing is it's erratic.  Sometimes when I call a function it will behave fine and sometimes it doesn't. 
Re: force screen label to refresh
« Reply #1 on: December 05, 2022, 10:27:24 PM »
Hi,
sometimes the screen does not update or updates infrequently or sporadically. This is because the  Lua GUI chunk, ie the screen runs
as a co-routine with Machs core. Only one can run at a time, and there are occasions where Machs core hogs all the processing time
and the screen misses out.

Co-routines are Lua's only way to have mulithreaded applications but co-routines are co-operative, one thread cannot force the other
thread to yield.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: force screen label to refresh
« Reply #2 on: December 06, 2022, 12:01:15 AM »
Is there a way to limit look ahead to prevent new code from running till the task is completed?
Re: force screen label to refresh
« Reply #3 on: December 06, 2022, 01:27:55 AM »
Hi,

LUA Syntax:
rc = mc.mcCntlGcodeExecuteWait(
      number mInst,
      string commands)

Description:
Execute G code as a unit of work and wait until it is complete.


Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: force screen label to refresh
« Reply #4 on: December 06, 2022, 11:13:10 AM »
Doesn't work.  Every command I'm using in between the Screen changes are gcodeexecutewait.  I've even tried adding additional gcodeexecutewait(g04 p1.0) commands to force a machine pause condition.  If I do those it will sometimes skip the command where I actually want it to move. I even tried setting the look ahead in the control to 1.  It freaks out if you set it to zero.
Re: force screen label to refresh
« Reply #5 on: December 06, 2022, 02:12:23 PM »
Hi,
GcodeExecuteWait works to ensure that one block of Gcode is executed BEFORE a second block is queued up.......but this is within one chunk, namely Machs core.
It does not work to separate the GUI chunk from the Main chunk.

As I posted earlier Lua co-routines are cooperative not preemptive. There is no way, to my knowledge, to force one chunk to yield to the other.

Quote
gcodeexecutewait(g04 p1.0) commands to force a machine pause condition.

I can see why you might think this is a good idea, but it won't work. 'g04p1.0' is still a Gcode instruction. Machs Main chunk will interpret this instruction and execute it, it does not mean
that the Main chunk becomes idle....after all it is doing something, namely waiting for the current instruction to complete.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: force screen label to refresh
« Reply #6 on: December 09, 2022, 04:12:29 PM »
Are you wanting to finish a line of g-code?

If its G-code insert a G61 before the line you wish to complete then put a G64 after it :-

G01 X-100. F50.
G61
Y25.
M1005
G64
G01 X0 Y0 F100.

Without engineers the world stops