Hello Guest it is April 17, 2021, 07:13:18 AM

Author Topic: Custom m7  (Read 202 times)

0 Members and 1 Guest are viewing this topic.

Offline Bill_O

*
  •  362 362
    • View Profile
Custom m7
« on: July 30, 2020, 10:57:24 AM »
I have a custom m7 that i wrote.
When the gcode gets to M07 it does not even go into the macro.
Is there a setting I need to change to use the custom macro instead of the standard?

Code: [Select]
function M07()
--wx.wxMessageBox('In M07')
mc.mcCntlSetLastError(inst, "In M07")
local inst = mc.mcGetInstance()
--Get Mist On and Mister Auto handles
local hMist = mc.mcSignalGetHandle(inst, mc.OSIG_MISTON)
local hreg = mc.mcRegGetHandle(inst, 'iRegs0/MisterAuto')
--Get Mister Auto value
local MistVal = mc.mcRegGetValue(hreg)
if (MistVal == 0) then
mc.mcSignalSetState(hMist, 0)
--wx.wxMessageBox('Mist OFF')
else
mc.mcSignalSetState(hMist, 1)
--wx.wxMessageBox('Mist ON')
end
end
if (mc.mcInEditor() == 1) then
M07()
end

Offline Bill_O

*
  •  362 362
    • View Profile
Re: Custom m7
« Reply #2 on: July 30, 2020, 01:39:34 PM »
MN300
I have tried both but will look at that thread and try again.
Thanks,
Bill
Re: Custom m7
« Reply #3 on: August 03, 2020, 01:55:33 AM »
mc.mcCntlSetLastError(inst, "In M07")
but you not define the inst,only line after
i suggest you if you use machhoby ,not use inst use"0" it will solve many of yours problem

Offline Bill_O

*
  •  362 362
    • View Profile
Re: Custom m7
« Reply #4 on: August 03, 2020, 04:42:47 PM »
Sorry all that i did not post this before.
It is functioning well.

Code: [Select]
function m7()
local inst = mc.mcGetInstance()
--Get Mist On and Mister Auto handles
local hMist = mc.mcSignalGetHandle(inst, mc.OSIG_MISTON)
local hreg = mc.mcRegGetHandle(inst, 'iRegs0/MisterAuto')
--Get Mister Auto value
local MistVal = mc.mcRegGetValue(hreg)
if (MistVal == 0) then
mc.mcSignalSetState(hMist, 0)
--wx.wxMessageBox('Mist OFF')
else
mc.mcSignalSetState(hMist, 1)
--wx.wxMessageBox('Mist ON')
end
end
if (mc.mcInEditor() == 1) then
m7()
end