Consider the following M code. It should read the feedrate from a DRO, which is does (300), set the feedrate to 300, move to X5Y5 then back to zero.
function m200()
local inst = mc.mcGetInstance()
local Feedrate = mc.mcProfileGetDouble(inst, 'PersistentDROs', 'droPLFeedRate', 1)
mc.mcCntlSetLastError(inst, 'Set Feedrate')
code2 = 'F ' .. Feedrate .. '\n'
code2 = code2 .. 'G01 X5 Y5\n'
code2 = code2 .. 'G01 X0 Y0\n'
mc.mcCntlGcodeExecuteWait(inst, code2)
end
if (mc.mcInEditor() == 1) then
m200()
end
It does not set the feedrate to 300IPM. It sets it to 3IPM. The Feedrate variable is correct. Same thing happens if I replace Feedrate with a '300'. So thinking that I just need to multiply the Feerate variable by 100, I try this...
function m200()
local inst = mc.mcGetInstance()
local Feedrate = mc.mcProfileGetDouble(inst, 'PersistentDROs', 'droPLFeedRate', 1)
mc.mcCntlSetLastError(inst, 'Set Feedrate')
code2 = 'F ' .. Feedrate * 100 .. '\n'
code2 = code2 .. 'G01 X5 Y5\n'
code2 = code2 .. 'G01 X0 Y0\n'
mc.mcCntlGcodeExecuteWait(inst, code2)
end
if (mc.mcInEditor() == 1) then
m200()
end
This sets the system Feedrate to 9IPM. Do I have a setting wrong? Seems like the only code that will run inside mc.mcCntlGcodeExecuteWait is simple. This one is similar. The G31 executes but the feedrate is a fraction what it is told to be.
function m200()
local inst = mc.mcGetInstance()
local Feedrate = mc.mcProfileGetDouble(inst, 'PersistentDROs', 'droPLFeedRate', 1)
mc.mcCntlSetLastError(inst, 'Set Feedrate')
code2 = 'G31 Z-2 F100\n'
code2 = code2 .. 'G92 Z0\n'
mc.mcCntlGcodeExecuteWait(inst, code2)
end
if (mc.mcInEditor() == 1) then
m200()
end
The Feedrate is running at 1IPM. Also can't get any of this to actually run by calling the M code. It runs in the editor, but not when the M code is called.