301
Mach4 General Discussion / Re: Home Signal
« on: February 19, 2018, 02:18:42 PM »
Daz, thanks for the suggestion , but no joy.
Adding the mcCntlConfigStart and stop lock the GUI. Wrapping it in the disable and enable umlocks the GUI but none of the subsequent code gets executed. As it stands now.
local function myHomeC()
local inst=mc.mcGetInstance()
local rc,sState
local pos=-1
mc.mcCntlEnable(inst,0)
mc.mcCntlConfigStart(inst)
local hSigH=mc.mcSignalGetHandle(inst,mc.ISIG_MOTOR3_HOME)
rc=mc.mcSignalEnable(hSigH,1)
mc.mcProfileWriteInt(inst,'Signal68','Enabled',1)
mc.mcProfileSave(inst)
mc.mcProfileFlush(inst)
mc.mcCntlConfigStop(inst)
mc.mcCntlEnable(inst,1)
-- now none of this code is executed, makes sense since a disable cancels all running code
local hSig,rc=mc.mcSignalGetHandle(inst,mc.ISIG_INDEX)
if rc==mc.MERROR_SIGNAL_NOT_FOUND then
wx.wxMessageBox('wrong Signal')
end
sState=mc.mcSignalGetState(hSig)
if sState==1 then -- sitting on the slot so move off it
mc.mcCntlGcodeExecuteWait(inst,'g0 f20000 h15\n')--g1 h366 f5000')
end
mc.mcAxisHome(inst,mc.C_AXIS)
-- None of the folowing code ever got executed
mc.mcCntlSetLastError('Homing')
repeat
wx.wxMilliSleep(1000)
rc= mc.mcAxisIsHoming(inst,mc.C_AXIS)
mc.mcCntlSetLastError('Homing: '..tostring(rc))
until rc==0
rc=mc.mcSignalEnable(hSigH,0)
mc.mcProfileFlush(inst)
end
myHomeC()
RT
Adding the mcCntlConfigStart and stop lock the GUI. Wrapping it in the disable and enable umlocks the GUI but none of the subsequent code gets executed. As it stands now.
local function myHomeC()
local inst=mc.mcGetInstance()
local rc,sState
local pos=-1
mc.mcCntlEnable(inst,0)
mc.mcCntlConfigStart(inst)
local hSigH=mc.mcSignalGetHandle(inst,mc.ISIG_MOTOR3_HOME)
rc=mc.mcSignalEnable(hSigH,1)
mc.mcProfileWriteInt(inst,'Signal68','Enabled',1)
mc.mcProfileSave(inst)
mc.mcProfileFlush(inst)
mc.mcCntlConfigStop(inst)
mc.mcCntlEnable(inst,1)
-- now none of this code is executed, makes sense since a disable cancels all running code
local hSig,rc=mc.mcSignalGetHandle(inst,mc.ISIG_INDEX)
if rc==mc.MERROR_SIGNAL_NOT_FOUND then
wx.wxMessageBox('wrong Signal')
end
sState=mc.mcSignalGetState(hSig)
if sState==1 then -- sitting on the slot so move off it
mc.mcCntlGcodeExecuteWait(inst,'g0 f20000 h15\n')--g1 h366 f5000')
end
mc.mcAxisHome(inst,mc.C_AXIS)
-- None of the folowing code ever got executed
mc.mcCntlSetLastError('Homing')
repeat
wx.wxMilliSleep(1000)
rc= mc.mcAxisIsHoming(inst,mc.C_AXIS)
mc.mcCntlSetLastError('Homing: '..tostring(rc))
until rc==0
rc=mc.mcSignalEnable(hSigH,0)
mc.mcProfileFlush(inst)
end
myHomeC()
RT