Hello Guest it is April 24, 2024, 12:36:13 AM

Author Topic: xBox360 code for trigger acceleration ala Lee's Mach3 controller  (Read 1862 times)

0 Members and 1 Guest are viewing this topic.

Has anyone successfully implemented xBox360 code for trigger acceleration ala Lee's Mach3 controller?  Willing to share?

I've written code for Daz's plugin for my lathe but it doesn't increase speed with thumb stick and trigger like Lee's does.  I don't use the trigger as a lock like some.  I disable the controller when not in use in case I bump it while doing something else.

Just picked up a mill and would like to not reinvent the wheel if someone is willing to share.

Tia

RT

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: xBox360 code for trigger acceleration ala Lee's Mach3 controller
« Reply #1 on: January 13, 2020, 05:03:37 PM »
Try something in your script like

Code: [Select]
local Xval = math.abs(GetXin("LTH_X_Val")) -- to get value of the stick
mc.mcJogSetRate(mInst, mc.X_AXIS, Xval) -- set the jog rate

Here`s a small extract from a script I used a while back but have`nt used it in a while so just for reference

Code: [Select]
function SetJog()
local Xval = math.abs(GetXin("LTH_X_Val"))
local Yval = math.abs(GetXin("LTH_Y_Val"))
local Zval = math.abs(GetXin("LTH_Y_Val"))

if mc.mcJogGetRate(mInst, mc.X_AXIS) ~= Xval then
mc.mcJogSetRate(mInst, mc.X_AXIS, Xval)
end
if mc.mcJogGetRate(mInst, mc.Y_AXIS) ~= Yval then
mc.mcJogSetRate(mInst, mc.Y_AXIS, Yval)
end
if mc.mcJogGetRate(mInst, mc.Z_AXIS) ~= Zval then
mc.mcJogSetRate(mInst, mc.Z_AXIS, Zval)
end
end

LThumb_Panel:Connect(wx.wxEVT_TIMER, function (event)
SetJog()
-- Y++
if GetXin("LTH_Y_Val") > 20 and GetXin("Btn_LS") == 0 and YPJState == false then
mc.mcJogVelocityStart(mInst, mc.Y_AXIS, mc.MC_JOG_POS)
YPJState = true
end
if GetXin("LTH_Y_Val") == 0 and GetXin("Btn_LS") == 0 and YPJState == true then
mc.mcJogVelocityStop(mInst, mc.Y_AXIS)
YPJState = false
end
-- Y--
if GetXin("LTH_Y_Val") < -20 and GetXin("Btn_LS") == 0 and YNJState == false then
mc.mcJogVelocityStart(mInst, mc.Y_AXIS, mc.MC_JOG_NEG)
YNJState = true
end
if GetXin("LTH_Y_Val") == 0 and GetXin("Btn_LS") == 0 and YNJState == true then
mc.mcJogVelocityStop(mInst, mc.Y_AXIS)
YNJState = false
end
-- X++
if GetXin("LTH_X_Val") > 20 and GetXin("Btn_LS") == 0 and XPJState == false then
mc.mcJogVelocityStart(mInst, mc.X_AXIS, mc.MC_JOG_POS)
XPJState = true
end
if GetXin("LTH_X_Val") == 0 and GetXin("Btn_LS") == 0 and XPJState == true then
mc.mcJogVelocityStop(mInst, mc.X_AXIS)
XPJState = false
end
-- X--
if GetXin("LTH_X_Val") < -20 and GetXin("Btn_LS") == 0 and XNJState == false then
mc.mcJogVelocityStart(mInst, mc.X_AXIS, mc.MC_JOG_NEG)
XNJState = true
end
if GetXin("LTH_X_Val") == 0 and GetXin("Btn_LS") == 0 and XNJState == true then
mc.mcJogVelocityStop(mInst, mc.X_AXIS)
XNJState = false
end
-- Z++
if GetXin("LTH_Y_Val") > 20 and GetXin("Btn_LS") == 1 and ZPJState == false then
mc.mcJogVelocityStart(mInst, mc.Z_AXIS, mc.MC_JOG_POS)
ZPJState = true
end
if GetXin("LTH_Y_Val") == 0 and GetXin("Btn_LS") == 1 and ZPJState == true then
mc.mcJogVelocityStop(mInst, mc.Z_AXIS)
ZPJState = false
end
-- Z--
if GetXin("LTH_Y_Val") < -20 and GetXin("Btn_LS") == 1 and ZNJState == false then
mc.mcJogVelocityStart(mInst, mc.Z_AXIS, mc.MC_JOG_NEG)
ZNJState = true
end
if GetXin("LTH_Y_Val") == 0 and GetXin("Btn_LS") == 1 and ZNJState == true then
mc.mcJogVelocityStop(mInst, mc.Z_AXIS)
ZNJState = false
end
end)

DazTheGas
 
New For 2022 - Instagram: dazthegas