Hello Guest it is April 19, 2024, 04:09:29 PM

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 - Davek0974

1161
General Mach Discussion / Re: Spindle button and M3 and M4
« on: September 15, 2016, 10:29:11 AM »
Ha, simple stuff i can handle, I do Visual Basic programming at work sometimes so this is pretty much the same.

Good to know about the 500-600, now if only there was a list of variables or a way of finding free ones ???

:)

1162
General Mach Discussion / Re: Spindle button and M3 and M4
« on: September 15, 2016, 09:39:43 AM »
OK, sorted the typo...

Spindle start by toggle from first go, hmmm?

Are the #vars saved when Mach is closed?

If yes then it would start in the same rotation as left the day before - good or bad, I don't know.

If no then it would start forwards the first time as the #var would be zero, I guess we can add a reset macro to the INIT line that sets the #var however we want for the first time?

Depends if it's an issue or not i guess :)

Code: [Select]
If GetOEMLed(164) Then          'was running forwards
  SetVar(1601,0)
  DoSpinStop()
ElseIf GetOEMLed(165) Then      'was running reverse
  SetVar(1601,1)
  DoSpinStop()
Else                                         'was not running
  If GetVar(1601)=0 Then
    DoSpinCW()
  Else
    DoSpinCCW()
  End If
End If

1163
General Mach Discussion / Re: Spindle button and M3 and M4
« on: September 15, 2016, 09:05:33 AM »
Will this work?
Brings all the code into the spindle-toggle button so no messing with M4/M5 etc

If GetOEMLed(164) Then          'was running forwards
  SetVar(1601,0)
  DoSpinStop()
ElseIf GetOEMLed(165) Then      'was running reverse
  SetVar(1601,0)
  DoSpinStop()
Else                                         'was not running
  If GetVar(1601)=0 Then
    DoSpinCW()
  Else
    DoSpinCCW()
  End If
End If

1164
General Mach Discussion / Re: Spindle button and M3 and M4
« on: September 15, 2016, 08:58:42 AM »
Fair enough then :)

If GetOEMLed(164) or GetOEMLed(165) then
  DoSpinStop()
else
  If GetVar(1601)=0 then
    DoSpinCW()
  Else
    DoSpinCCW()
  End If
End if

Seems better.

1165
General Mach Discussion / Re: Spindle button and M3 and M4
« on: September 15, 2016, 08:46:08 AM »
How about OEMLed(11) ?
My list shows "Spindle CCW/CW if either is requested"

1166
General Mach Discussion / Re: Spindle button and M3 and M4
« on: September 15, 2016, 08:03:09 AM »
I  can't see a better way so I would offer up

If IsOutputActive(OUTPUTcw) or IsOutputActive(OUTPUTccw) then
  DoSpinStop()
else
  If GetVar(1601)=0 then
    DoSpinCW()
  Else
    DoSpinCCW()
  End If
End if

Where cw and ccw are the port numbers assigned to M4 & M5 in ports & pins.

1167
General Mach Discussion / Re: Spindle button and M3 and M4
« on: September 15, 2016, 07:43:14 AM »
Ah, bugger, nobody mentioned turning it off :)

Ok, more thought......

1168
General Mach Discussion / Re: Offsets :)
« on: September 15, 2016, 07:06:00 AM »
LOL, yes we still bonk ;)

1169
General Mach Discussion / Re: Spindle button and M3 and M4
« on: September 15, 2016, 06:40:31 AM »
I would start here....

First, get a safe backup copy of your entire Mach3 folder.

Next edit your M3 macro - its in the macro folder of the same name as the profile you are running.

Add, after the DoSpinCW() line...
SetVar(1601, 0)

Save the file

Edit the M4 file, same location,

Add after the DoSpinCCW() line
SetVar(1601,1)

Save the file

Edit your spindle button text.

Comment out the DoSpinCw() line by placing a ' at the start.

Then add...
 
If GetVar(1601)=0 then
DoSpinCW()
Else
DoSpinCCW()
End If

Save the button text.

Try that, I think it will work, with the usual disclaimers of course :)

This is all presuming that #var 1601 is a free variable and not used elsewhere, hard to tell with Mach ;)

1170
General Mach Discussion / Re: Spindle button and M3 and M4
« on: September 15, 2016, 06:27:44 AM »
This is quite an interesting issue, never thought about until now. ;)