Hello Guest it is March 28, 2024, 09:10:48 AM

Author Topic: Pokeys Mach4 plugin LUA reference for LCD  (Read 26581 times)

0 Members and 1 Guest are viewing this topic.

Re: Pokeys Mach4 plugin LUA reference for LCD
« Reply #60 on: March 28, 2019, 03:48:09 PM »
Dear Wolfgang

Tonight I can report, with joy in my heart, that your code is displaying the X and Z coordinates on my lathe. Understanding all the Lua code with still take some time but I am working on that. I'm using Build 3804.

Thank you so much for all your help,

Danie
Re: Pokeys Mach4 plugin LUA reference for LCD
« Reply #61 on: March 29, 2019, 11:43:57 AM »
Hello Danie,

I'm glad to read that your problem is solved.

Kind regards,
Wolfgang
Re: Pokeys Mach4 plugin LUA reference for LCD
« Reply #62 on: July 14, 2019, 10:38:40 PM »
A few on the board seem to have gotten something working here. Can anyone help write up the final resolution to getting the output to the LCD?
Re: Pokeys Mach4 plugin LUA reference for LCD
« Reply #63 on: July 15, 2019, 02:02:38 AM »
Hi
My LCD is working well, will post the code in a day or two,

Regards
Danie
Re: Pokeys Mach4 plugin LUA reference for LCD
« Reply #64 on: July 15, 2019, 09:56:59 AM »
Hi
My LCD is working well, will post the code in a day or two,

Regards
Danie

Thanks Danie, looking forward to seeing your solution.

Trent
Re: Pokeys Mach4 plugin LUA reference for LCD
« Reply #65 on: July 17, 2019, 02:30:58 AM »
Dear Trent

Please see my steps, generated with great help from the Forum members. I run a lathe with Mach4 and the name of my card is Pokeys_Lathe:

Go into the Screen Editor: Click on the X DRO on the screen, then look at the left and you will see droCurrentX highlighted slightly. Click on droCurrentX to highlight it.
Now look at the window (Properties)  below this window and click on the second little box which is the Events Tab. Now click on the first line below that called "On Update Script", then click on the box with the three dots to the right,  that will open a blank Lua Page.

Now copy the LUA code below for the X DRO below and paste it on that blank LUA page.  Please update the serial number of your Pokeys device.

local val = select(1,...)
Xcoords = val
val = tonumber(val)
local inst = mc.mcGetInstance()
mc.mcCntlSetLastError(inst, "On update ran")
local Xcoords = string.format("X:% 10.4f", Xcoords)
local hreg = mc.mcRegGetHandle(inst, string.format("PoKeys_Lathe/LCD Line 1"))
mc.mcRegSetValueString(hreg, Xcoords.."        ")
return val

Follow the same procedure for updating the Z axis DRO. Remember to update the serial number of your Pokeys device again.

local val = select(1,...)
Zcoords = val
val = tonumber(val)
local inst = mc.mcGetInstance()
mc.mcCntlSetLastError(inst, "On update ran")
local Zcoords = string.format("Z:% 10.4f", Zcoords)
local hreg = mc.mcRegGetHandle(inst, string.format("PoKeys_Lathe/LCD Line 2"))
mc.mcRegSetValueString(hreg, Zcoords.."        ")
return val

Now exit Mach4 and then start it up again.  Now the LCD should update each time you have the DROs updated in Mach4. I still struggle to understand what each line of code is doing.

Please let me know how its going.

Kind regards

Danie
Re: Pokeys Mach4 plugin LUA reference for LCD
« Reply #66 on: July 21, 2019, 02:19:06 PM »
 :)  8)

Danie, you ROCK!  I've followed the instructions exactly as you provided and the LCD is now displaying the DRO info as I had hoped.

Thanks, I hope that I can someday provide similar input to solve a similar problem.

Trent
Re: Pokeys Mach4 plugin LUA reference for LCD
« Reply #67 on: July 21, 2019, 02:28:23 PM »
Dear Trent,

I am so glad it is working!! I struggled for months with this problem.

Kind regards
Danie
Re: Pokeys Mach4 plugin LUA reference for LCD
« Reply #68 on: October 14, 2021, 10:44:48 AM »
Hello. I need help. Have a Pokeys57cnc and want to build a handwheel. there is also a 20x4 LCD. Unfortunately, I am not a LUA expert. I did the following. LCD shows the last values ​​when starting mach4. Problems. at startup it shows Pokeys plugin for mach4. Doesn't go away either. DRO does not change in the main menu of mach4 when moving or jogging. LCD also does not change anything. I added the scripts to update under Screen editor under individual DROs can someone help me? With best regards Tim