Refactored the probing code
This commit is contained in:
@@ -328,158 +328,105 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
probe_xyz() {
|
probe_xyz() {
|
||||||
var pcmd = "";
|
let xoffset = this.config.probe["probe-xdim"];
|
||||||
var xoffset = this.config.probe["probe-xdim"];
|
let yoffset = this.config.probe["probe-ydim"];
|
||||||
var yoffset = this.config.probe["probe-ydim"];
|
let zoffset = this.config.probe["probe-zdim"];
|
||||||
var zoffset = this.config.probe["probe-zdim"];
|
let fastSeek = this.config.probe["probe-fast-seek"];
|
||||||
var fastSeek = this.config.probe["probe-fast-seek"];
|
let slowSeek = this.config.probe["probe-slow-seek"];
|
||||||
var slowSeek = this.config.probe["probe-slow-seek"];
|
|
||||||
debugger;
|
|
||||||
|
|
||||||
if(this.mach_units == "METRIC") {
|
xoffset += this.tool_diameter / 2.0;
|
||||||
|
yoffset += this.tool_diameter / 2.0;
|
||||||
|
|
||||||
fastSeek = "F" + fastSeek;
|
if (this.mach_units !== "METRIC") {
|
||||||
slowSeek = "F" + slowSeek;
|
xoffset /= 25.4;
|
||||||
|
yoffset /= 25.4;
|
||||||
//Metric Probing
|
zoffset /= 25.4;
|
||||||
pcmd += "G92 X0\n";
|
slowSeek /= 25.4;
|
||||||
pcmd += "G92 Y0\n";
|
fastSeek /= 25.4;
|
||||||
pcmd += "G92 Z0\n";
|
|
||||||
pcmd += "G21\n";
|
|
||||||
pcmd += "G38.2 Z-25.4 " + fastSeek + "\n";
|
|
||||||
pcmd += "G91 G0 Z1.5\n";
|
|
||||||
pcmd += "G38.2 Z-2.5 " + slowSeek + "\n";
|
|
||||||
|
|
||||||
//var zoffset = 16.383;
|
|
||||||
pcmd += "G92 Z " + zoffset + "\n";
|
|
||||||
|
|
||||||
pcmd += "G91 G0 Z 3.175\n";
|
|
||||||
pcmd += "G91 G0 X 19.05\n";
|
|
||||||
pcmd += "G91 G0 Z -12.7\n";
|
|
||||||
pcmd += "G38.2 X -19.05 " + fastSeek + "\n";
|
|
||||||
pcmd += "G91 G1 X 1.27 " + fastSeek +"\n";
|
|
||||||
pcmd += "G38.2 X -4 " + slowSeek + "\n";
|
|
||||||
|
|
||||||
xoffset += this.tool_diameter/2.0;
|
|
||||||
xoffset = xoffset.toFixed(5);
|
|
||||||
pcmd += "G92 X " + xoffset + "\n";
|
|
||||||
|
|
||||||
pcmd += "G91 G0 X 2.5\n";
|
|
||||||
pcmd += "G91 G0 Y 17\n";
|
|
||||||
pcmd += "G91 G0 X -13\n";
|
|
||||||
pcmd += "G38.2 Y -17 " + fastSeek + "\n";
|
|
||||||
pcmd += "G91 G0 Y 1.27\n";
|
|
||||||
pcmd += "G38.2 Y -4 " + slowSeek +"\n";
|
|
||||||
|
|
||||||
yoffset += this.tool_diameter/2.0;
|
|
||||||
yoffset = yoffset.toFixed(5);
|
|
||||||
pcmd += "G92 Y " + yoffset + "\n";
|
|
||||||
|
|
||||||
pcmd += "G91 G0 Y2.54\n";
|
|
||||||
pcmd += "G91 G0 Z 25.4\n";
|
|
||||||
pcmd += "G90 G0 X0 Y0\n";
|
|
||||||
} else {
|
|
||||||
|
|
||||||
//Imperial Probing
|
|
||||||
|
|
||||||
xoffset = xoffset / 25.4;
|
|
||||||
yoffset = yoffset / 25.4;
|
|
||||||
zoffset = zoffset / 25.4;
|
|
||||||
slowSeek = slowSeek / 25.4;
|
|
||||||
slowSeek = slowSeek.toFixed(5);
|
|
||||||
slowSeek = "F" + slowSeek;
|
|
||||||
fastSeek = fastSeek / 25.4;
|
|
||||||
fastSeek = fastSeek.toFixed(5);
|
|
||||||
fastSeek = "F" + fastSeek;
|
|
||||||
|
|
||||||
pcmd += "G92 X0\n";
|
|
||||||
pcmd += "G92 Y0\n";
|
|
||||||
pcmd += "G92 Z0\n";
|
|
||||||
pcmd += "G20\n";
|
|
||||||
pcmd += "G38.2 Z-1.0 " + fastSeek + "\n";
|
|
||||||
pcmd += "G91 G0 Z0.06\n";
|
|
||||||
pcmd += "G38.2 Z-0.1 " + slowSeek + "\n";
|
|
||||||
|
|
||||||
//var zoffset = 0.645;
|
|
||||||
zoffset = zoffset.toFixed(5);
|
|
||||||
pcmd += "G92 Z " + zoffset + "\n";
|
|
||||||
|
|
||||||
|
|
||||||
pcmd += "G91 G0 Z 0.125\n";
|
|
||||||
pcmd += "G91 G0 X 0.75\n";
|
|
||||||
pcmd += "G91 G0 Z -0.5\n";
|
|
||||||
pcmd += "G38.2 X -0.75 " + fastSeek + "\n";
|
|
||||||
pcmd += "G91 G1 X 0.05 " + fastSeek + "\n";
|
|
||||||
pcmd += "G38.2 X -0.15 " + slowSeek + "\n";
|
|
||||||
|
|
||||||
xoffset += this.tool_diameter/2.0;
|
|
||||||
xoffset = xoffset.toFixed(5);
|
|
||||||
pcmd += "G92 X " + xoffset + "\n";
|
|
||||||
|
|
||||||
pcmd += "G91 G0 X 0.1\n";
|
|
||||||
pcmd += "G91 G0 Y 0.75\n";
|
|
||||||
pcmd += "G91 G0 X -0.5\n";
|
|
||||||
pcmd += "G38.2 Y -0.75 " + fastSeek + "\n";
|
|
||||||
pcmd += "G91 G0 Y 0.05\n";
|
|
||||||
pcmd += "G38.2 Y -0.15 " + slowSeek +"\n";
|
|
||||||
|
|
||||||
yoffset += this.tool_diameter/2.0;
|
|
||||||
yoffset = yoffset.toFixed(5);
|
|
||||||
pcmd += "G92 Y " + yoffset + "\n";
|
|
||||||
|
|
||||||
pcmd += "G91 G0 Y0.1\n";
|
|
||||||
pcmd += "G91 G0 Z1\n";
|
|
||||||
pcmd += "G90 G0 X0 Y0\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.send(pcmd);
|
const zlift = 1;
|
||||||
|
|
||||||
|
// After probing Z, we want to drop the bit down:
|
||||||
|
// Ideally, 12.7mm/0.5in
|
||||||
|
// And we don't want to be more than 75% down on the probe block
|
||||||
|
let plunge = Math.min(12.7, zoffset * 0.75);
|
||||||
|
plunge += zlift; // Compensate for the fact that we lift after probing Z
|
||||||
|
|
||||||
|
xoffset = xoffset.toFixed(5);
|
||||||
|
yoffset = yoffset.toFixed(5);
|
||||||
|
zoffset = zoffset.toFixed(5);
|
||||||
|
slowSeek = slowSeek.toFixed(5);
|
||||||
|
fastSeek = fastSeek.toFixed(5);
|
||||||
|
plunge = plunge.toFixed(5);
|
||||||
|
|
||||||
|
slowSeek = `F${slowSeek}`;
|
||||||
|
fastSeek = `F${fastSeek}`;
|
||||||
|
|
||||||
|
this.send(`
|
||||||
|
G21
|
||||||
|
G92 X0 Y0 Z0
|
||||||
|
|
||||||
|
G38.2 Z -25.4 ${fastSeek}
|
||||||
|
G91 G1 Z 1
|
||||||
|
G38.2 Z -2 ${slowSeek}
|
||||||
|
G92 Z ${zoffset}
|
||||||
|
|
||||||
|
G91 G0 Z ${zlift}
|
||||||
|
G91 G0 X 20
|
||||||
|
G91 G0 Z -${plunge}
|
||||||
|
G38.2 X -20 ${fastSeek}
|
||||||
|
G91 G1 X 1
|
||||||
|
G38.2 X -2 ${slowSeek}
|
||||||
|
G92 X ${xoffset}
|
||||||
|
|
||||||
|
G91 G0 X 1
|
||||||
|
G91 G0 Y 20
|
||||||
|
G91 G0 X -20
|
||||||
|
G38.2 Y -20 ${fastSeek}
|
||||||
|
G91 G1 Y 1
|
||||||
|
G38.2 Y -2 ${slowSeek}
|
||||||
|
G92 Y ${yoffset}
|
||||||
|
|
||||||
|
G91 G0 Y 3
|
||||||
|
G91 G0 Z 25.4
|
||||||
|
G90 G0 X0 Y0
|
||||||
|
|
||||||
|
M2
|
||||||
|
`);
|
||||||
},
|
},
|
||||||
|
|
||||||
probe_z() {
|
probe_z() {
|
||||||
var pcmd = "";
|
let fastSeek = this.config.probe["probe-fast-seek"];
|
||||||
var fastSeek = this.config.probe["probe-fast-seek"];
|
let slowSeek = this.config.probe["probe-slow-seek"];
|
||||||
var slowSeek = this.config.probe["probe-slow-seek"];
|
let zoffset = this.config.probe["probe-zdim"];
|
||||||
var zoffset = this.config.probe["probe-zdim"];
|
|
||||||
|
|
||||||
debugger;
|
|
||||||
|
|
||||||
if(this.mach_units == "METRIC") {
|
|
||||||
fastSeek = "F" + fastSeek;
|
|
||||||
slowSeek = "F" + slowSeek;
|
|
||||||
|
|
||||||
|
|
||||||
pcmd += "G92 Z0\n";
|
|
||||||
pcmd += "G21\n";
|
|
||||||
pcmd += "G38.2 Z-25 " + fastSeek + "\n";
|
|
||||||
pcmd += "G91 G0 Z1.5\n";
|
|
||||||
pcmd += "G38.2 Z-2.5 " + slowSeek + "\n";
|
|
||||||
pcmd += "G92 Z " + zoffset + "\n";
|
|
||||||
pcmd += "G91 G0 Z3\n";
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
zoffset = zoffset / 25.4;
|
|
||||||
slowSeek = slowSeek / 25.4;
|
|
||||||
slowSeek = slowSeek.toFixed(5);
|
|
||||||
slowSeek = "F" + slowSeek;
|
|
||||||
fastSeek = fastSeek / 25.4;
|
|
||||||
fastSeek = fastSeek.toFixed(5);
|
|
||||||
fastSeek = "F" + fastSeek;
|
|
||||||
|
|
||||||
pcmd += "G92 Z0\n";
|
|
||||||
pcmd += "G20\n";
|
|
||||||
pcmd += "G38.2 Z-1.0 " + fastSeek +"\n";
|
|
||||||
pcmd += "G91 G0 Z0.06\n";
|
|
||||||
pcmd += "G38.2 Z-0.1 " + slowSeek + "\n";
|
|
||||||
zoffset = zoffset.toFixed(5);
|
|
||||||
pcmd += "G92 Z " + zoffset + "\n";
|
|
||||||
pcmd += "G91 G0 Z0.125\n";
|
|
||||||
|
|
||||||
|
if (this.mach_units !== "METRIC") {
|
||||||
|
zoffset /= 25.4;
|
||||||
|
slowSeek /= 25.4;
|
||||||
|
fastSeek /= 25.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.send(pcmd);
|
zoffset = zoffset.toFixed(5);
|
||||||
|
slowSeek = slowSeek.toFixed(5);
|
||||||
|
fastSeek = fastSeek.toFixed(5);
|
||||||
|
|
||||||
|
slowSeek = `F${slowSeek}`;
|
||||||
|
fastSeek = `F${fastSeek}`;
|
||||||
|
|
||||||
|
this.send(`
|
||||||
|
G21
|
||||||
|
G92 Z0
|
||||||
|
|
||||||
|
G38.2 Z -25.4 ${fastSeek}
|
||||||
|
G91 G1 Z 1
|
||||||
|
G38.2 Z -2 ${slowSeek}
|
||||||
|
G92 Z ${zoffset}
|
||||||
|
|
||||||
|
G91 G0 Z3
|
||||||
|
|
||||||
|
M2
|
||||||
|
`);
|
||||||
},
|
},
|
||||||
|
|
||||||
jog_fn: function (x_jog,y_jog,z_jog,a_jog) {
|
jog_fn: function (x_jog,y_jog,z_jog,a_jog) {
|
||||||
|
|||||||
Reference in New Issue
Block a user