Hello Guest it is April 19, 2024, 09:48:57 PM

Author Topic: mcX360 Plugin for Lua  (Read 45340 times)

0 Members and 2 Guests are viewing this topic.

Re: mcX360 Plugin for Lua
« Reply #90 on: May 30, 2020, 11:29:21 PM »
Thanks.  I will review this tomorrow and see if I can get it to work.
Re: mcX360 Plugin for Lua
« Reply #91 on: August 03, 2020, 11:09:14 AM »
As a new Mach4 user I manged to get the x360 up and running. But there one little odd thing. My x360 controller is rumbeling (the force feedback motor) every second for a blink of an eye. Over and over again. This starts when the Mach4 is starting and the plugins are loading. I happens even without any LUA script installed. What can be wrong here?

Mike
Re: mcX360 Plugin for Lua
« Reply #92 on: October 08, 2020, 12:58:59 PM »
scr.SetProperty("sliderJogRate", "Value","00.1")

Hi On the mach4 jogging tab there is a slider to adjust the jog rate and a value box that you can enter the jog rate.
I can enter .1 in the Value box and it works however if i set this value with
scr.SetProperty("droJogRate", .1) its set the value box to 0.0 and jogging stops working as expected
I have change the properties on both the slider and value box but it still will not accept 0.1
any ideas how I can implement very slow jog rates.
Cheers!
 
 
Re: mcX360 Plugin for Lua
« Reply #93 on: February 22, 2021, 10:37:47 PM »
What changed in the plugin? Release notes? :P

Im just finishing up my script, now everything is done except probing (waiting for andy @ warp9)

Re: mcX360 Plugin for Lua
« Reply #94 on: February 22, 2021, 10:39:36 PM »
I have got my xbox running and only thing i would like to add is probing, at least z probing. do you know if there is a way to access
the functionality that is already there in the 'Touch' panel? It looks like you're the only one who was interested in implementing it?
Re: mcX360 Plugin for Lua
« Reply #95 on: February 24, 2021, 08:39:54 AM »
Theres a new "official" plugin now with the latest mach4 version, maybe you can select probing there ?

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: mcX360 Plugin for Lua
« Reply #96 on: February 24, 2021, 09:55:32 AM »
There is a couple of ways to do this, if using the lua version you can assign a standard gcode probe ie G91 G31 Z-5 F30 to a button. if using the same way as i used to then you can use something like

Code: [Select]

if GetXin("Btn_X") == 1 and X_Btn == false then
    mc.mcCntlGcodeExecuteWait(inst,'G91 G31 Z-5 F30')
    X_Btn = true
end

If you are using the new plugin that is bundled with mach 4 then you can assign a button to 1 of 6 GCodes.

Example: if you want to assign  button x to gcode1 and want this to probe z then from the xbox config screen assign x to gcode1, then open your profile/machine.ini and edit the section XBOX_0 and add Gcode1=G91 G31 Z-5 F30

Hope this helps

DazTheGas
New For 2022 - Instagram: dazthegas
Re: mcX360 Plugin for Lua
« Reply #97 on: February 24, 2021, 11:41:51 AM »
Thanks for the quick reply, i will try it tonight. If i want to run a larger script (thinking of implementing something like your example on ess probing with safeguards, but i will write it for z,y,x corner for setting work origin would it work the same way or maybe put it in a module?  I'm still trying to get the big picture of how mach4 works internally.
Re: mcX360 Plugin for Lua
« Reply #98 on: May 20, 2021, 11:48:47 AM »
Is there any documentation for the x360 plug-in for mach4? Specifically can I switch between incremental and continuous jog mode somehow ?

Offline Rimmel

*
  •  208 208
    • View Profile
Re: mcX360 Plugin for Lua
« Reply #99 on: June 04, 2022, 10:02:35 AM »
Heres a different kind of plugin for you using an X360 controller that populates registry values so you can write your own scripts for it, if you have the registry plugin loaded you can see the values.

I will try and get some video`s on usage as soon as possible but is straight forward, create a lua panel from the screen editor and make sure you select that its hidden and in the code add as an example

Code: [Select]
local inst = mc.mcGetInstance()

local X360_PNL = mcLuaPanelParent;


    function GetXin(xinput)
    local hreg = mc.mcRegGetHandle(inst, string.format("mcX360_LUA/%s", xinput))
    return mc.mcRegGetValueString(hreg)
    end


X360_timer = wx.wxTimer(X360_PNL)

    X360_PNL:Connect(wx.wxEVT_TIMER,   function (event)

    if GetXin("Btn_A") == "1" then
     -- do something after button A is pressed
    end
   
    if GetXin("Btn_B") == "1" then
     -- do something after button B is pressed
    end
 
    end)

    X360_timer:Start(100)

You should get the gist ;-)

DazTheGas

When you say registry values, do you mean the actual OS registry or an internal registry for Mach4?

thanks