Hello Guest it is October 09, 2024, 09:56:15 AM

Author Topic: Mach4 and Coroutines  (Read 7444 times)

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
Mach4 and Coroutines
« on: December 17, 2017, 09:10:34 AM »
Simplified explanation of Mach4 and Coroutines

https://youtu.be/t2xQYvAXT8o


DazTheGas
New For 2022 - Instagram: dazthegas
Re: Mach4 and Coroutines
« Reply #1 on: December 17, 2017, 12:19:24 PM »
Hi Daz,
superb work, I've really struggled with coroutines, not so much the concept but the implementation, this will help BIGTIME. Thanks.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 and Coroutines
« Reply #2 on: December 18, 2017, 11:29:25 AM »
What Craig said, exactly!!!

Thanks!!!

Any difference running one from a module or macro script?

RT



RT
Re: Mach4 and Coroutines
« Reply #3 on: January 11, 2018, 06:18:17 PM »
Can't seem to get coroutine working with a macro.  Anything special that needs to be done, or is that not even a thing?

Offline DazTheGas

*
  •  778 778
  • DazTheGas
Re: Mach4 and Coroutines
« Reply #4 on: January 11, 2018, 06:34:27 PM »
There are 2 instances/states of wxLua, one is for the Gui and this is where the PLC/Timer Event is that makes coroutines possible. Macros run in a different wxLua state with no PLC/Timer Event available. neither of these 2 states can comunicate with eachother directly.

DazTheGas
New For 2022 - Instagram: dazthegas
Re: Mach4 and Coroutines
« Reply #5 on: January 21, 2018, 10:25:05 PM »
Hi Daz,
still struggling with coroutines.

Is it possible to switch back and forth between the Gcode interpreter and the GUI?

The reason I ask is because there is a thread on the forum where the OP wishes when an M6 is encountered in
a Gcode job, ie Gcode interpreter is in control, he wishes to manually jog and/or MDI ,ie GUI in control then
revert back to the interpreter to continue the job.

Naturally would require some coding so that on resumption of the job that the machine coordinates remain in sync.

Can a coroutine work across the two instances of Lua?

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

Offline DazTheGas

*
  •  778 778
  • DazTheGas
Re: Mach4 and Coroutines
« Reply #6 on: January 22, 2018, 03:30:59 AM »
Simple answer is no, the only way you can share data across 2 instances of lua is to use registers.

DazTheGas
New For 2022 - Instagram: dazthegas

Offline DazTheGas

*
  •  778 778
  • DazTheGas
Re: Mach4 and Coroutines
« Reply #7 on: January 22, 2018, 02:23:49 PM »
Hold that last "simple no" whilst I try something Chaoticone has suggested.

DazTheGas
New For 2022 - Instagram: dazthegas
Re: Mach4 and Coroutines
« Reply #8 on: January 22, 2018, 02:55:04 PM »
Hi Daz,
yes I could easily use registers to communicate data between the two.

More importantly can say the Gcode interpreter be suspended while control is assumed by the GUI?
The interpreter would need to be 'massaged' before it was resumed.

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