G28.1 Slaved & Unslaved Axis
Posted: Sat Sep 17, 2016 10:15 pm
My Y and B Axis are slaved, and all axis share common limit and home inputs (port 2/pin10)
I've had a problem my my proximity sensors for a while and was deciding to have a look at that (they trigger when the torch fires, so likley to be noise).
But, I was wondering if there was a way to home slaved axis and still share a common home & limit across the axis?
I came up with the macro code below, the thing is..... if my axis have been slaved, when I un-slave them I can move each axis via gcode (say G1 Y5 f120 and G1 B5 f120), but if I home the Y axis, the Y will home, and if I home the B axis (using G28.1 B)..... the Y axis still homes its self.....
I know I really should split the slaved axis home and limit prox sensors from each other, but I did think that if I unslaved the axis, then the motion controller would be able to deal with tem seperatly.
Even if you manually unslave them via the configuration > axis tab, apply and save settings, reset the machine, they still stay slaved.
My attempt at some code was here for the homing routine:
I've had a problem my my proximity sensors for a while and was deciding to have a look at that (they trigger when the torch fires, so likley to be noise).
But, I was wondering if there was a way to home slaved axis and still share a common home & limit across the axis?
I came up with the macro code below, the thing is..... if my axis have been slaved, when I un-slave them I can move each axis via gcode (say G1 Y5 f120 and G1 B5 f120), but if I home the Y axis, the Y will home, and if I home the B axis (using G28.1 B)..... the Y axis still homes its self.....
I know I really should split the slaved axis home and limit prox sensors from each other, but I did think that if I unslaved the axis, then the motion controller would be able to deal with tem seperatly.
Even if you manually unslave them via the configuration > axis tab, apply and save settings, reset the machine, they still stay slaved.
My attempt at some code was here for the homing routine:
- Code: Select all
// M1032
// Homing Routine, all axis using the same shared limits and home switches (port 2, pin 11)
// X-Axis, Y-Axis, Z-Axis and B-Axis (Y&B paired, to avoid conflict of A (rotary pipe cutter axis)
// Robertspark 17/09/2016
// Confirm via operator input that Z axis is clear to home machine
DialogResult result;
result = MessageBox.Show("Is the torch clear for homing?", "check!!!" , MessageBoxButtons.YesNo);
if (result == System.Windows.Forms.DialogResult.Yes)
{
// Home X Axis & Y Axis
exec.Code("G91"); // Switch to relative distance mode
exec.Code("G28.1 "); // Perform X and Y homing sequence (exclude Z as may have no material on table!)
while(exec.IsMoving()){}
exec.Wait(200);
exec.Code("G92 X0 Y0 B0");
exec.Code("G0 Y5"); // Move the Y axis 5mm (as unsure which home switch tripped, Y or B axis?),
//5mm less chance of prox sensor re-tripping when other axis squares
while(exec.IsMoving()){}
exec.Wait(200);
exec.Slaveaxis(1,0); // Unslave B-Axis from Y-Axis.
exec.Callbutton(168); // Apply Settings
//exec.Callbutton(167); // Save Settings
exec.Wait(200);
exec.Callbutton(108); // Home Y-Axis
//exec.Code("G28.1 Y");
while(exec.IsMoving()){}
exec.Wait(200);
exec.Code("G1 Y5 f120");
while(exec.IsMoving()){}
exec.Wait(200);
exec.Callbutton(111); // Home B-Axis
//exec.Code("G28.1 B");
while(exec.IsMoving()){}
exec.Wait(200);
exec.Code("G1 B5 f120");
while(exec.IsMoving()){}
exec.Wait(200);
// Re-Slave B-Axis to Y
exec.Slaveaxis(1,4); // Makes B-axis slaving the Y-axis.
exec.Callbutton(168); // Apply Settings
//exec.Callbutton(167); // Save Settings
exec.Wait(200);
exec.Code("G90"); // switch back to absolute distance mode
// Reset machine
exec.Callbutton(144); //turns reset button off (i.e. Reset state active!)
}
if (result == System.Windows.Forms.DialogResult.No)
{
MessageBox.Show("Jog torch to clearance height and restart");
}
// End of Macro