Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Zaae on June 14, 2010, 04:53:46 PM

Title: Developing new macropump, faster way to retest?
Post by: Zaae on June 14, 2010, 04:53:46 PM
Like the title says, I'm working on changes to the macropump, but all this restarting mach to test stuff is wearing on my nerves. Is there a faster way to restart the macropump code from inside mach3 without restarting?

Thanks :)
Title: Re: Developing new macropump, faster way to retest?
Post by: Hood on June 14, 2010, 05:08:36 PM
Afraid not, Mach loads the macropump at startup and it constantly runs, only a restart will load any changes you have made.
Depending on your macropump it may be possible for you to test by stepping through the code in the VB window or even just clicking the run arrow.

Hood
Title: Re: Developing new macropump, faster way to retest?
Post by: Zaae on June 14, 2010, 06:04:34 PM
Solved. Wrote an autohotkey script to restart :)

Thanks
Title: Re: Developing new macropump, faster way to retest?
Post by: Hood on June 14, 2010, 06:06:21 PM
Solved. Wrote an autohotkey script to restart :)

Thanks

To restart Mach or to somehow reload the macropump? If the latter care to share ;)
Hood
Title: Re: Developing new macropump, faster way to retest?
Post by: Zaae on June 14, 2010, 06:13:15 PM
Autohotkey is a freebie macro program I've come to love. All it does is restart mach, but it takes care of the "are you sure?" menu, the restart, and the profile choice screen at the beginning. Still have to wait for mach to restart though.

Even so, Autohotkey is worth looking into for people who like to automate things, and aren't afraid of code. Everything it does is scripted, but it's extremely flexible, and can interact with most windows forms without the messy automated mouse clicking strategy.
Title: Re: Developing new macropump, faster way to retest?
Post by: Hood on June 14, 2010, 06:20:58 PM
Ah ok, thanks for the info, worth looking into :)
Hood
Title: Re: Developing new macropump, faster way to retest?
Post by: Zaae on June 14, 2010, 06:31:45 PM
No problem. I do have another question though, is there a way to trigger a script when an input goes high?
Title: Re: Developing new macropump, faster way to retest?
Post by: Hood on June 14, 2010, 06:51:30 PM
Not really sure what you mean but maybe this?

If IsActive (Input1) Then
Code("M1234")
End If

Hood
Title: Re: Developing new macropump, faster way to retest?
Post by: Zaae on June 14, 2010, 07:02:51 PM
Sorry, I should have been more clear. I meant to actually run a separate macro file, but to somehow have it triggered by an input going high. Maybe I'm being too conservative when it comes to putting code into the macro pump. I don't have any loops or anything in there, but I'm aware that since that code is run all the time, it could eventually affect performance. I have some code that runs when the digitize signal goes high, but I was hoping to get it out of the macropump code.
Title: Re: Developing new macropump, faster way to retest?
Post by: Zaae on June 14, 2010, 07:05:50 PM
Also, since the machines are running in the shop, and I'm usually in the office, I run a series of video monitors. I was considering things like, writing to a file when it's time for a blade / program change, current program line, etc. Something that I could read at regular intervals from different pc's on the network to get info about the machines.
Title: Re: Developing new macropump, faster way to retest?
Post by: Hood on June 14, 2010, 07:20:11 PM
I use Scott Schaefers MachMad plugin to watch a user LED and when it sees the LED it will trigger a macro. I also need to have a Brain to look at the OEMTrigger and when its seen switch the User LED on.
Bit clunky but works well for the custom start button and Ref All button and a few others that I use on my machines.
Rev4 of Mach will hopefully support this type of thing natively.
Hood
Title: Re: Developing new macropump, faster way to retest?
Post by: Zaae on June 14, 2010, 07:32:24 PM
I'll have to look into that, do you think MachMad will still trigger if the LED being watched isn't on the current screen?

Also, why is it, when I read your posts, I read them in my head with a Scottish accent?  :D
Title: Re: Developing new macropump, faster way to retest?
Post by: Hood on June 14, 2010, 07:42:54 PM
Ye dinnae need LEDs at a on ony screen, ye  just hae the brain switch it an the plugin spies it.

Now you can say it with a real Scottish accent ;D

Just in case you didnt get what I said it is.
You dont need the LEDs on any screen, the brain switches it on when it sees an OEM trigger and the Plugin sees the LED and triggers the macro.

Hood
Title: Re: Developing new macropump, faster way to retest?
Post by: Zaae on June 14, 2010, 07:51:17 PM
Thanks for the help, Hood, I appreciate it.

I read through the post about MachMAD and decided to order it, what's to lose at $10 ?
Title: Re: Developing new macropump, faster way to retest?
Post by: Hood on June 14, 2010, 07:55:02 PM
The plugin does a lot more than I use it for but for me the trigger macro is worth the cost alone.

Hood
Title: Re: Developing new macropump, faster way to retest?
Post by: Tweakie.CNC on June 15, 2010, 02:31:07 AM
Hi Zaaephod,

Quote
No problem. I do have another question though, is there a way to trigger a script when an input goes high?

This thread, I think, answers your question here.

http://www.machsupport.com/forum/index.php/topic,918.0.html

Tweakie.
Title: Re: Developing new macropump, faster way to retest?
Post by: BR549 on June 15, 2010, 07:39:28 AM
You basically have 2 choices for monitoring mach functions. The macropump or the brains.

The macropump has more functionality but the brains are faster and take up less cpu time.
Title: Re: Developing new macropump, faster way to retest?
Post by: Zaae on June 15, 2010, 09:22:43 AM
Thanks guys :)
Title: Re: Developing new macropump, faster way to retest?
Post by: stirling on June 17, 2010, 04:49:37 AM
No problem. I do have another question though, is there a way to trigger a script when an input goes high?
Triggers do exactly this but unfortunately IMHO are not very well documented nor particularly intuitive in the way they're implemented. I think this is why we see a lot of macropumps monitoring inputs and it's just not the best way to do it - again just MHO. The link Tweakie's pointed at covers it but makes a bit of a meal of it I think. Here's a quick guide.

Let's assume you want three active input pins to fire 3 different actions.
1) In ports n pins set up your pin assignments for OEM trigger #1, #2, #3.
2) in Config/system hotkeys set Trigger # OEM code to 301 for all three triggers.
3) Create a macro e.g. M665.m1s with the one line of SetTriggerMacro(666) Note: any free numbers you like will do for 665 and 666.
4) Add M665 preceeded by a space to the initialization string on the Config/General Config page
5) Now the buisness end - Create macro M666.m1s - something like:

If isActive(OEMTRIG1) Then
  message "trig 1"
End If

If isActive(OEMTRIG2) Then
  message "trig 2"
End If

If isActive(OEMTRIG3) Then
  message "trig 3"
End If

Now when you activate the appropriate input pins you'll get the appropriate message. Change M666.m1s to suit.

Hope this helps

Cheers

Ian
Title: Re: Developing new macropump, faster way to retest?
Post by: Tweakie.CNC on June 17, 2010, 05:25:08 AM
Excellent Ian - nice, concise explanation.

Tweakie.
Title: Re: Developing new macropump, faster way to retest?
Post by: Zaae on June 17, 2010, 09:34:52 AM
Hmm, that's very interesting. Thanks for the info, Ian, I've done a lot of reading around here and I've never come across anything like that.