Hello Guest it is April 26, 2024, 08:31:23 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - culmy

Pages: 1
1
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: August 14, 2018, 06:05:04 PM »
Figured this one out also.  :)

what is the best way to do a Velocity move in X, Y, and Z axis
currently i am using

mc.mcVelocityStart(mInst, Axis, direction)

but speed is from the Slider on the Mach4 panel and the Jog DRO

So i have to keep changing those values as RTHY and RTHX values change from 0-90 (i have a dead spot -30 to +30
while this works it is messy
is there a better way to do a velocity move

2
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: August 14, 2018, 03:43:29 PM »
is there a  way to check the status of a button on the Mach 4 form  ie the Enable/Disable button
i am using the A button on the Xbox controller to toggle the Enable/Disable button but had to resort to a flag (local ToggleState) to see if it has been enabled  by my code
only problem with doing it this way is it assumes that it is in the disabled state to start off


using
mc.mcCntEnable(mIst, 1) to go from disable to enable
and
mc.mcCntEnable(mIst, 0) to go from enabled to disable
it would be nice to test the current state first before setting it to another state

3
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: August 10, 2018, 10:01:39 AM »
another dumb question
where does the code actually get stored, file location. i know i can do a save as and put a copy were i want for safe keeping
but when i create a pannel and add code were is that kept

4
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: August 09, 2018, 05:11:24 PM »
NEVER MIND
Stupid mistake

start and stop instead of Start ans Stop

5
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: August 09, 2018, 05:08:54 PM »
Below code only works if i disable (Comment out ) the EStop_Timer: Start(50) line
well at least it shows the running/stop stat of the controller
if i leave the timer stop line un commented then it works the first press of the trigger but soon as i release it then nothing anymore
got to be something stupid with the timer definition?????



-- Charley Ulmschneider August 9 2018

-- Declirations
local mInst = mc.mcGetInstance()
local Xenabled = false
local ESState = false

--X360 Init Panel
   X360_Panel = wx.wxPanel(wx.NULL, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize)
   X360_Timer = wx.wxTimer(X360_Panel)
   X360_Timer:Start(100)
   
--EStop Init Panel
   EStop_Panel = wx.wxPanel(wx.NULL, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize)
   EStop_Timer = wx.wxTimer(EStop_Panel)
   
   
   -- Functions
function GetXin(xinput)
      local hreg=mc.mcRegGetHandle(mInst, string.format("mcX360_LUA/%s", xinput))
      return mc.mcRegGetValueLong(hreg)
end
      
-- Event Timers

X360_Panel:Connect(wx.wxEVT_TIMER, function (event)
      if GetXin("LTR_Val")>150 and Xenabled == false then
         
         EStop_Timer:start(50)
         Xenabled=true
         mc.mcCntlSetLastError(mInst,"x_360 Running")
         
      elseif GetXin("LTR_Val")<50 and Xenabled==true then
         
         EStop_Timer:stop(0)
         Xenabled=false
         mc.mcCntlSetLastError(mInst, "x_360 Stopped")
      end
   end)


EStop_Panel:Connect(wx.wxEVT_TIMER, function (event)
      if GetXin("Btn_B") == 1  and ESState == false then
         local EStop = mc.mcSignalGetState (mc.mcSignalGetHandle (mInst, mc.ISIG_EMERGENCY))
         if (EStop ==1) then
            mc.mcSignalSetState (mc.mcSignalGetHandle (mInst, mc.ISIG_EMERGENCY), 0)
         else
            mc.mcSignalSetState (mc.mcSignalGetHandle (mInst, mc.ISIG_EMERGENCY), 1)
         end
         ESState = true
      end
      if GetXin("Btn_B") == 0 and ESState == true then
         ESState = false
      end
   end)

6
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: August 08, 2018, 05:55:24 PM »
Do you have the code you used in the part 1 video for the xbox controller and is there a part 2 i could not find it

7
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: August 08, 2018, 03:21:29 PM »
I have loaded the latest plugin and i can get everything to work except Button A Cycle Start
Rht Shoulder Button A works fine and I can see button A change state in the registry window but it does not perform a cycle start

Typed following into MDI
G1 F50 X1
G1 F50 X0

Press A and nothing
actually press Cycle Start and code exicutes with machine motion

Is there actually a way to edit/see the code in your plugin, i am new to MACH 4 and LUA but have written in C# before i retired

Pages: 1