Hi,
you are not testing return codes and will therefore struggle to make sense of it.
Take for example:
LUA Syntax:
rc = mc.mcCntlGcodeExecute(
number mInst,
string commands)
Description:
Execute G code as a unit of work and wait until it is complete.
Parameters: Parameter Description
mInst The controller instance.
commands A string buffer containing G code.
Returns: Return Code Description
MERROR_NOERROR No Error.
MERROR_INVALID_INSTANCE The mInst parameter was out of range.
MERROR_NOT_NOW The operation could not be completed at this time.
MERROR_NOT_COMPILED The macro scripts could not be compiled.
Note in particular MERROR_NOT_NOW which is a common error when attempting to use this API. You need to test for
it otherwise the code could fail and you would have no idea when or how or why it failed.
Try this for example:
local rc=mc.mcCntlGcodeExecuteWait(inst, "G90 G53 Z0")
if rc==mc.MERROR_NOT_NOW then
wx.wxMessageBox( "Houston....we have a problem")
end
At least now if the API did not proceed you will know when and probably why.
Smurph recommends EVERY API return code be testedI'm lazy and don't do it as much as I should but after many
frustrating hours trying to debug code I'm getting better at it.
Craig