Hey guys I recently overhauled an old MultiCAM router with a new controller and am using Mach3. Everything is set up and running great but Im trying to solve an issue with my auto gantry squaring script while homing.

The issue is that currently X is set up with two steppers at each end of the gantry like a typical setup. When I home X and A home together but only activate off the X switch. Now I went into settings and there is no change if "Home Slave with Master" is selected or not.

However, when I go to Config->Slave Axis and unslave the A axis, restart Mach3, and run the same homing script again it works as intended and A will correct itself to it's own switch squaring the gantry. I then have to re-slave and restart Mach3 again.

I'd like to not have to go through that process and it home without having to mess with the slave axis settings.
I feel like I'm missing something in my script (below). I tried using CoupleSlave commands with no luck (shown in comments in script where). Any help would be appreciated. I have the feeling I need to enable independent A movement somehow.

Also site won't let me upload XML?

Code:
        
' Ref all home Script

'Home Z
DoButton( 24 ) 'Z (4)
While IsMoving
Sleep(25)
Wend
DoOEMButton(135)
Sleep(500)

'Home Y
DoButton( 23 ) 'Y (2)
While IsMoving
Sleep(25)
Wend
Sleep(500)
DoOEMButton(134)
Sleep(500)

'Home X and A Together
RefCombination(9)
While IsMoving
Sleep(25)
Wend
Sleep(5000)

'Square Gantry Check
Message "Going into Square Check"
SquareCheck
Message "Done"

Sub SquareCheck()

If IsActive(XHome) Then
	Message "X Active If 1"
	If IsActive(AHome) Then
		DoOEMButton(133)
		Message "Gantry Already Square 1"
		Exit Sub
	End If
	
	Message "X Home, Homing A"
	DoOEMButton(357)
	' I TRIED CoupleSlave(0) COMMAND HERE WITH NO SUCCESS
	Sleep(500)
	DoButton(25)
	Message "Squared A"
	DoOEMButton(358)
	' ReCouple CoupleSlave(1)
	DoOEMButton(133)
	Sleep(500)
	Exit Sub
End If

If IsActive(AHome) Then
	If IsActive(XHome) Then
		DoOEMButton(133)
		Message "Gantry Already Square 2"
		Exit Sub
	End If
	Message "A Home, Homing X"
	DoOEMButton(357)
	'CoupleSlave(0)
	Sleep(500)
	DoButton(22)
	Message "Squared X"
	DoOEMButton(358)
	'CoupleSlave(1)
	DoOEMButton(133)
	Sleep(500)
	Exit Sub
End If
Exit Sub
End Sub
Using an XHC USB Mach3 Motion Control Card Mk4 (link)