Hello Guest it is April 27, 2024, 12:07:28 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DazTheGas

141
Mach4 Videos / Mach4 and Coroutines
« on: December 17, 2017, 09:10:34 AM »
Simplified explanation of Mach4 and Coroutines

https://youtu.be/t2xQYvAXT8o


DazTheGas

142
Mach4 General Discussion / Re: List of Mach4 error codes
« on: December 11, 2017, 06:08:41 AM »
Simple answer no, when running macros`s they are using their own lua stack with bindings to the core api, the gui also has its own lua stack with bindings to the core api. This goes the same with the debugger, when opened it appears to also have its own lua stack connected to the core api. when loading modules, functions or tables etc they are loaded within the stack that called them and not accessible from another stack.

Does this make any sense, i`m losing myself  ;D ;D

DazTheGas

143
Mach4 General Discussion / Re: List of Mach4 error codes
« on: December 11, 2017, 03:47:55 AM »
A little example, if you open up the screen editor and use the dummy button under the DRO`s and add the code

Code: [Select]
local rc = -3
wx.wxMessageBox(mcErrorCheck[rc])

This will give you the error of "attempt to index global 'mcErrorCheck' (a nil value)"
Now if you use

Code: [Select]
if (mc.mcInEditor() == 1) then
    dofile(mc.mcCntlGetMachDir(0).."\\Modules\\mcErrorCheck.lua") -- use F10 in the debugger for this line to step over it to save debugging the file.
end

local rc = -3
wx.wxMessageBox(mcErrorCheck[rc])

This will work fine, however it is advised you press F10 on the line indicated to save debugging the module too

DazTheGas

144
Mach4 General Discussion / Re: List of Mach4 error codes
« on: December 10, 2017, 05:23:40 PM »
The ErrorCheck Module is already loaded via the Screen Load Script so can be used globally during normal use, however from the debugger you dont have access to whats declared in the script so you will have to load the module perhaps by adding

if (mc.mcInEditor() == 1) then
-- load the package here
end

DazTheGas

145
Mach4 General Discussion / Re: mc.mcAxisSetMachinePos
« on: December 10, 2017, 05:12:44 PM »
Unfortunately mcAxisSetMachinePos has not been functional for a very long time on the mcLua side.

DazTheGas

146
Have you tried changeing the active high/low in the ESS pins config for direction.

DazTheGas

147
Mach4 General Discussion / Re: Version Update Issue
« on: November 30, 2017, 05:00:16 PM »
If you go into the menu bar to operator/lua script you can go to line 51 and see what line of code is causing the error.
DazTheGas

148
Mach4 General Discussion / Re: Reference all home help.
« on: November 30, 2017, 12:33:17 PM »
Make a temp dir in your profile directory, when you go to Operator/Edit Scripts it will open up a dialog allowing you to choose what script to load and debug.

DazTheGas

149
Mach4 General Discussion / Re: Reference all home help.
« on: November 30, 2017, 12:07:34 PM »
Quote
The function code should be put in Mach4Hobby\Profiles\NicksProfile\Macros

I would highly recommend against using the macros directory and use a temp dir, when you start mach4 it will compile the scripts into one file called mcLua.mcc. If for any reason the script you are trying to debug/test has an error then you have a good chance of stopping the legit M Codes being compiled.

DazTheGas

150

Quote
but loading M4 with some random motor positions on start-up is absolutely not what I was expecting. Unfortunately that's what ESS does.
I have been using an ESS for 4 years now and have never had a random position set by it.

Quote
Seen another Mach4 output device in action, which does not have the problem described above.
All Motion controllers for Mach4 come with a plugin that controls the controller and each manufacturer has the ability to set what coords they like at startup and can if they wanted too overwrite the G54.

And so can you............

Mach4 has both a Screen Load Script and a Screen Unload Script, so if you feel you would like to start the machine different you can use these scripts to save the coords you want to a profile and then reload these coords from the profile on starting. But like Steve said in an earlier post I would not consider this as good as homing.

DazTheGas