Hello Guest it is December 02, 2024, 11:23:23 AM

Author Topic: Macro mystery  (Read 1728 times)

0 Members and 1 Guest are viewing this topic.

Macro mystery
« on: February 14, 2023, 01:57:36 PM »
Friend is setting up a new lathe and was trying to turn relays on and off and was getting nowhere.  He had defined macros m205.mcs and m206.mcs to turn output2 on and off.  When the macro m205 was run in the zeroBrains editor output2 would get voltage and the led on the diagnostics page would light but when m205 was run in either the mdi or in a gcode file nothing would happen.

Deleted the mcc files, shut down Mach4 and restarted.  No change.

Renamed m205.mcs and m206.mcs to m2005.mcs and m2006.mcs and changed the functions in the macros to m2005() and m2006() and they ran as expected.  What could have caused the m205 and m206 to not work?

Re: Macro mystery
« Reply #1 on: February 14, 2023, 03:01:00 PM »
Hi,
could there possibly be another either/or m205() or m206? Maybe a remanent of a previous macro similarly named. May have deleted the .mcs file but a .mcc
file still exists?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Macro mystery
« Reply #2 on: February 14, 2023, 03:12:44 PM »
I think you are onto something here Craig.  I would have to check all of his macros so see if another m205() is defined in one of them.  I know that if a function is defined in more than one macro file only one is executed.  I recall several years ago when I was just learning Lua I made a macro and then decided to change a few things but renamed the original file to some else in case I didn't like the new one but since it was still in the macros directory it got compiled and that version got called instead of the new one.

Thanks!

RT
Re: Macro mystery
« Reply #3 on: February 14, 2023, 03:20:34 PM »
Found a link to the above referenced event that Steve helped me resolve.
https://www.machsupport.com/forum/index.php?topic=36347.10