Velocità e ritrazioni "da banco", al momento i motori non sono montati.
Si porta rapida al proximity, poi rallenta fino al sensore preciso e si sposta di tot distanza.
Se il proximity non viene attivato (per questioni di deviazione meccanica che aumenta la distanza del traferro, ad esempio), raggiunto il micro preciso la macchina si blocca in E-Stop, dato che prima dellinterv del proximity l'ingresso del micro preciso viene settato come tale.
Codice: Seleziona tutto
Config_ Config = new Config_{
//X Axis
X = new AxisConfig{ AxisName = "X",
//Inputs
ProximityPin = new Setting{ Value = 1, ScreenField = 5},
ProximityPort = new Setting{ Value = 2, ScreenField = 245},
MicroPin = new Setting{ Value = 2, ScreenField = 5},
MicroPort = new Setting{ Value = 2, ScreenField = 245},
EstopPin = new Setting{ Value = 2, ScreenField = 91},
EstopPort = new Setting{ Value = 2, ScreenField = 271},
HomePin = new Setting{ Value = 0, ScreenField = 91},
HomePort = new Setting{ Value = 0, ScreenField = 271},
//Feedrates
FastHomingUp = new Setting{ Value = 1000, ScreenField = 6},
FastHomingDown = new Setting{ Value = 250, ScreenField = 15},
FastHomingBack = new Setting{ Value = 0, ScreenField = 2621},
SlowHomingUp = new Setting{ Value = 50, ScreenField = 6},
SlowHomingDown = new Setting{ Value = 10, ScreenField = 15},
SlowHomingBack = new Setting{ Value = 5, ScreenField = 2621},
//Buttons
HomingButton = 107
},
//Y Axis
Y = new AxisConfig{ AxisName = "Y",
//Inputs
ProximityPin = new Setting{ Value = 1, ScreenField = 20},
ProximityPort = new Setting{ Value = 2, ScreenField = 250},
MicroPin = new Setting{ Value = 2, ScreenField = 20},
MicroPort = new Setting{ Value = 2, ScreenField = 250},
EstopPin = new Setting{ Value = 2, ScreenField = 91},
EstopPort = new Setting{ Value = 2, ScreenField = 271},
HomePin = new Setting{ Value = 0, ScreenField = 91},
HomePort = new Setting{ Value = 0, ScreenField = 271},
//Feedrates
FastHomingUp = new Setting{ Value = 1000, ScreenField = 21},
FastHomingDown = new Setting{ Value = 250, ScreenField = 30},
FastHomingBack = new Setting{ Value = 0, ScreenField = 2622},
SlowHomingUp = new Setting{ Value = 50, ScreenField = 21},
SlowHomingDown = new Setting{ Value = 10, ScreenField = 30},
SlowHomingBack = new Setting{ Value = 3, ScreenField = 2622},
//Buttons
HomingButton = 108
},
//Z Axis
Z = new AxisConfig{ AxisName = "Z",
//Inputs
ProximityPin = new Setting{ Value = 1, ScreenField = 35},
ProximityPort = new Setting{ Value = 2, ScreenField = 255},
MicroPin = new Setting{ Value = 2, ScreenField = 35},
MicroPort = new Setting{ Value = 2, ScreenField = 255},
EstopPin = new Setting{ Value = 2, ScreenField = 91},
EstopPort = new Setting{ Value = 2, ScreenField = 271},
HomePin = new Setting{ Value = 0, ScreenField = 91},
HomePort = new Setting{ Value = 0, ScreenField = 271},
//Feedrates
FastHomingUp = new Setting{ Value = 500, ScreenField = 36},
FastHomingDown = new Setting{ Value = 250, ScreenField = 45},
FastHomingBack = new Setting{ Value = 0, ScreenField = 2623},
SlowHomingUp = new Setting{ Value = 50, ScreenField = 36},
SlowHomingDown = new Setting{ Value = 10, ScreenField = 45},
SlowHomingBack = new Setting{ Value = -3, ScreenField = 2623},
//Buttons
HomingButton = 109
}
};
exec.AddStatusmessage( "!!!Double Homing Started!!!" );
DoubleHoming(Config.Z);
DoubleHoming(Config.X);
DoubleHoming(Config.Y);
exec.AddStatusmessage( "!!!Double Homing Finished!!!" );
#Events
int ApplysettingsButton = 168;
struct Setting {
public double Value;
public int ScreenField;
}
struct AxisConfig {
public string AxisName;
//Proximity Input
public Setting ProximityPin;
public Setting ProximityPort;
public Setting EstopPin;
public Setting EstopPort;
public Setting MicroPin;
public Setting MicroPort;
public Setting HomePin;
public Setting HomePort;
//Feedrates
public Setting FastHomingUp;
public Setting FastHomingDown;
public Setting FastHomingBack;
public Setting SlowHomingUp;
public Setting SlowHomingDown;
public Setting SlowHomingBack;
//Buttons
public int HomingButton;
}
struct Config_{
public AxisConfig X;
public AxisConfig Y;
public AxisConfig Z;
}
void DoubleHoming(AxisConfig AC)
{
//Fast homing
exec.AddStatusmessage( "- Fast Homing " + AC.AxisName + " Axis -");
//set proximity as home sensor
setFieldValue(AC.ProximityPin);
setFieldValue(AC.ProximityPort);
setFieldValue(AC.EstopPin);
setFieldValue(AC.EstopPort);
//set fast feedrates
setFieldValue(AC.FastHomingUp);
setFieldValue(AC.FastHomingDown);
setFieldValue(AC.FastHomingBack);
//Applysettings
exec.Callbutton(ApplysettingsButton);
//home axis
exec.Callbutton(AC.HomingButton);
while(exec.IsMoving()){}
//Slow homing
exec.AddStatusmessage( "- Slow Homing " + AC.AxisName + " Axis -");
//set precision switch as home sensor
setFieldValue(AC.MicroPin);
setFieldValue(AC.MicroPort);
setFieldValue(AC.HomePin);
setFieldValue(AC.HomePort);
//set slow feedrates
setFieldValue(AC.SlowHomingUp);
setFieldValue(AC.SlowHomingDown);
setFieldValue(AC.SlowHomingBack);
//Applysettings
exec.Callbutton(ApplysettingsButton);
//home axis
exec.Callbutton(AC.HomingButton);
while(exec.IsMoving()){}
}
void setFieldValue(Setting s){
AS3.Setfield(s.Value, s.ScreenField);
AS3.Validatefield(s.ScreenField);
}