Hello Guest it is April 25, 2024, 07:56:29 PM

Author Topic: TOOL changer problems after update  (Read 3374 times)

0 Members and 1 Guest are viewing this topic.

TOOL changer problems after update
« on: July 26, 2019, 03:01:20 AM »
I have done a update to current mach4 from  version ending in 3804
Installed over the top but backed up the profile first and reinstalled the profile   
when I had problems I did a fresh install then installed the license files the ESS and the penant ec  then loaded my machine profile  it comes up then with a lua problem  message I then delete all the lua in macro's directory with the extension MCC   the  lua problem  message goes away
But when I run a m6 tool change it starts the process then the program Mach4 terminates part way through the tool change
If I run a M6 with the same tool number of the tool in the machine I get the message "nothing to do tool already that number" so I know it is getting some way into the tool change script.
I have the earlier mach4 program and it runs fine in that
any idea's  on where to start trouble shooting or what happening
Regards Ray
I have attached the m6 file I had to rename to do this
« Last Edit: July 26, 2019, 03:07:10 AM by Raymondo »
Re: TOOL changer problems after update
« Reply #1 on: July 26, 2019, 03:32:07 AM »
After some more testing it seems Mach4 terminates when it runs into a command like this

mc.mcSignalWait(inst,mc.ISIG_INPUT7 ,1,0)   

 
the previous mach4 version t read the inputs in the m6 script and worked fine
Re: TOOL changer problems after update
« Reply #2 on: July 26, 2019, 03:56:27 AM »
Hi,
have you tested the return codes?

There is one in particular that crops up 'MERROR_NOT_NOW'. You need to check for it.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: TOOL changer problems after update
« Reply #3 on: July 26, 2019, 05:07:54 AM »
I don't know how to test for return codes 
But as soon as the program hits the line in the M6 script  with  that input line it terminates Mach4 and I obviously have to  restart Mach4
How do I test for Return codes are they stored some where at program failure ?
Regards Ray
Re: TOOL changer problems after update
« Reply #4 on: July 26, 2019, 06:56:47 AM »
I have had time to have a think about the problem
I think it must be some sort of problem in the new version of Mach4  the version ending in 3804 handles the M6 tool program I have  but the new version ends when the  command in the M6 file reaches
    mc.mcSignalWait(inst,mc.ISIG_INPUT7 ,1,0)
        or also
  mc.mcSignalWait(inst,mc.ISIG_INPUT12 ,1,0)
if mark these out so they are not used the program runs past  if I leave them in it instantly ends with no chance to see error messages
Have the use of mc.mcSignalWait() or mc.ISIG_INPUT12  been changed in the new version of Mach4 ?
even it i has the program should not I believe just terminate and end  but come up with a error message of some sort or even hang   but it ends
Regards Ray

Offline thosj

*
  •  532 532
    • View Profile
Re: TOOL changer problems after update
« Reply #5 on: July 26, 2019, 08:13:52 AM »
Might this be the Lua 5.3 vs Lua 5.2 issue? Try going in your profile, delete your m6.mcc file, or move it/rename it, and start Mach4 and let it recompile. If that works, you may need to do the same with other macros, too.

I could be completely wrong, but doesn't hurt anything to try.

Tom
--
Tom
Re: TOOL changer problems after update
« Reply #6 on: July 26, 2019, 02:44:56 PM »
Hi,
every Mach API function has a return code. When programming you should get into the habit of testing the return
codes to trap errors. Aside from anything else it will help you identify the offending function call.

Code: [Select]
LUA Syntax:
rc = mc.mcSignalWait(
number mInst,
number sigId,
number waitMode,
number timeoutSecs);

Description:
Wait on a signal to change state.

Parameters: Parameter Description
mInst The controller instance.
sigId A valid signal ID. (NOT a signal handle)
waitMode An integer specifying whether to wait on the signal to go high (WAIT_MODE_HIGH) or low (WAIT_MODE_LOW).
timeoutSecs A double specifying a timeout period.


Returns: Return Code Description
MERROR_NOERROR No Error.
MERROR_INVALID_INSTANCE The mInst parameter was out of range.
MERROR_INVALID_ARG sigId or wiatMode is out of range or timeoutSecs is negative.
MERROR_NOT_ENABLED The control is not enabled.
MERROR_TIMED_OUT The timeout period was reached without a change of state.

Note the syntax:

rc=mc.mcSignalWait(.........)

rc is a numeric value, with each number meaning a different thing.

And note the possible return code enumerations:
MERROR_NOERROR
MERROR_INVALID_INSTANCE
MERROR_INVALID_ARG
MERROR_NOT_ENABLED
MERROR_TIMED_OUT

Of these MERROR_INVALID_ARG and MERROR_TIMED_OUT are likely to give you most grief.
The return codes are a number, MERROR_NOERROR is equivalent to 0 whereas MERROR_TIMED_OUT is
equivalent to -40. A full set of return codes and their numeric equivalents are here:

https://www.machsupport.com/forum/index.php?topic=40051.0

To test a return code do something like this:

local rc=mc.mcSignalWait(inst,mc.ISIG_INPUT7 ,1,0)
if rc==0 then                                  --No error
end
if rc== -2 then
        wx.wxMessageBox('Function failed-invalid arg')
        return
end
if rc== -40 then
         wx.wxMessageBoox('Function failed-timed out')
         return
end


Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: TOOL changer problems after update
« Reply #7 on: July 26, 2019, 08:04:10 PM »
is there  a way to put just the error number in the message box that would seem easier to me then listing all the messages in the code I could then look up that number
I will have a good play with the machine today and see what I can find  but if Lua has changes versions that would explain me having to delete all the .mcc files and let it recompile them  and  it may be some part of the current problem
regards Ray
« Last Edit: July 26, 2019, 08:06:52 PM by Raymondo »

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: TOOL changer problems after update
« Reply #8 on: July 26, 2019, 10:59:08 PM »
Either of these should work for checking your rc.

wx.wxMessageBox(mcErrorCheck[rc])
mc.mcCntlSetLastError(inst, (mcErrorCheck[rc]))
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: TOOL changer problems after update
« Reply #9 on: July 27, 2019, 12:29:45 AM »
HiHi
-28 MERROR_IPC_NOT_READY        The Interprocess Communication subsystem is not ready.


this is the error then the program terminates
 Where do I look it worked in the previous version with no problems
I have attached a cut down version off m6.msc that I use for testing it just opens the tool door and reads the input and now catches the error