Hello Guest it is March 29, 2024, 06:10:20 AM

Author Topic: wxLua Debugging Module for Screen designers and Macro/Wizard makers  (Read 5491 times)

0 Members and 1 Guest are viewing this topic.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Here is a RC (Return Code) module for your use. I have upgraded it a lot.
You can choose to have “rc” (return codes), to display in LastMachError, standard wxMessage box,
or a custom wxFrame message display window “That stays on Top!”

   There is a “Test File” called: “Using_RC_ErrorCode.mcs”, and the Module file called: “RC_DisplayModule.mcs”.

The “RC_DisplayModule.mcs” will need to live in:
c:/Mach4Hobby/Modules/RC_DisplayModule.mcs

(you will need to make a "Modules" folder, or change the header in
the users example to where you want to put the module).

   If you put it somewhere different, you will have to change the path in the calling file,
(see “Using_RC_ErrorCode.mcs”, for an example to call/use a module).

   To test it out (with M4 running), open “Using_RC_ErrorCode.mcs”, in edit/debug scripts from the menu (mcLua editor). Move the mcLua window off to the right side so you can see what happens, to the XDRO, (and the “LastMachError” line if you choose to display there. The wx window will appear roughly in the middle of your LCD screen.)

   Under Debug, hit “run”, the calling file runs a loop, the first time through, the calls to a “mc.mcAxisIsEnabled(inst, AxisNumber)” Call are correct, and you will see the X axis move from 0 to 1, pause 2 seconds, then move back to 0.

   The second time through the loop, the call will have an error causing parameter passed to it. The custom wxFrame message box will appear with the Error in a static text box, and in the “Status line”, hit the “Close” button, or the “x” to close the window.

   Both Code files have a lot of documentation, the Module, will allow “Human Readable” error messages to be displayed, for your “mc.mc*********XX” calls.

There is a “Using_RC_ErrorCode.mcs” that shows how it works for both
Types of error calls: mc.*********, and scr.*********

RC.DisplayErrorCase( int inst,  int rc,  int DisplayChoice, int ErrorList );
1.   First Param is the MachInstance [ inst = mc.mcGetInstance(); ]
2.   Second Param is the returned rc code from the mc or scr call
3.   Thrid Param is where to display the error:
   •   0 sends to MachLastError
   •   1 to Custom wxFrame display
   •   2 to wxMessageBox
4.   Forth Param what Error List to pull from:
   •   0 use the mc. error list.
   •   1 use the scr. error list.

The “RC_DisplayModule.mcs” file is the module itself, its install path is :
c:/Mach4Hobby/Modules/RC_DisplayModule.mcs
  
NOTE: The Parameters used in scr.*********x(‘string’, ‘string’, ‘string’) calls, HAVE to be strings!! If other than strings are used like ints, then it crashes the Lua interpreter, and the RC error display for scr calls does not even get called.

****///////// EDIT 11/5/2014 /////////**** added the new module as
an attachment here!!!
Scott
« Last Edit: November 05, 2014, 09:49:20 AM by poppabear »
fun times
Thanks Scott
but you must be running a different version then us  ::)

Quote
The “RC_DisplayModule.mcs” file is the module itself, its install path is the OEM stock:
C:/Mach4/Profiles/Mach4Mill/Macros RC_DisplayModule.mcs

Stock install is Mach4Hobby
just messing with ya
I'll change the path to suit and try it out

Thanks again

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
The new revised RC module is at the top post. 11/5/2014
read the readmefirst.txt in the zip.

Scott
« Last Edit: November 05, 2014, 09:51:11 AM by poppabear »
fun times
Re: wxLua Debugging Module for Screen designers and Macro/Wizard makers
« Reply #3 on: June 01, 2015, 10:01:54 AM »
Oh man, this sounds cool. I gotta try this out later! Thanx!