var xyzprobeplate = {
xoffset: 10,
yoffset: 10,
zoffset: 9,
name: "OpenBuilds XYZ Touchplate",
xyzmode: true
}
var zprobeplate = {
xoffset: 0,
yoffset: 0,
zoffset: 20,
name: "OpenBuilds Z Touchplate",
xyzmode: false
}
var probemode = {
mode: "auto", // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
endmilldia: 0,
stock: {
x: 0,
y: 0,
position: "fl" // fl, fr, rl, rr, c
},
plate: {
traveldistance: 25,
thickness: 20,
feedrate: 500
},
probe: xyzprobeplate,
}
// still beta, lets hide it from users
// if (!enableBetaFeatures) {
// $(".needsXYZProbe").hide();
// }
function openProbeDialog() {
Metro.dialog.open("#xyzProbeWindow");
if (localStorage.getItem('probeType')) {
probetype(localStorage.getItem('probeType'))
if (localStorage.getItem('probeType') == "z") {
setTimeout(function() {
probezplatetab()
$(".probetabxyz").removeClass("active")
$("#probezplatetab").addClass("active")
}, 100)
} else {
setTimeout(function() {
probexyztab()
$(".probetabxyz").removeClass("active")
$("#probexyztab").addClass("active")
}, 100)
}
}
}
function openProbeXDialog() {
Metro.dialog.open("#xyzProbeWindow");
if (localStorage.getItem('probeType')) {
probetype(localStorage.getItem('probeType'))
if (localStorage.getItem('probeType') == "z") {
// setTimeout(function() {
// probezplatetab()
// $(".probetabxyz").removeClass("active")
// $("#probezplatetab").addClass("active")
// }, 100)
} else {
setTimeout(function() {
probextab()
$(".probetabxyz").removeClass("active")
$("#probextab").addClass("active")
}, 100)
}
}
}
function openProbeYDialog() {
Metro.dialog.open("#xyzProbeWindow");
if (localStorage.getItem('probeType')) {
probetype(localStorage.getItem('probeType'))
if (localStorage.getItem('probeType') == "z") {
// setTimeout(function() {
// probezplatetab()
// $(".probetabxyz").removeClass("active")
// $("#probezplatetab").addClass("active")
// }, 100)
} else {
setTimeout(function() {
probeytab()
$(".probetabxyz").removeClass("active")
$("#probeytab").addClass("active")
}, 100)
}
}
}
function openProbeZDialog() {
Metro.dialog.open("#xyzProbeWindow");
if (localStorage.getItem('probeType')) {
probetype(localStorage.getItem('probeType'))
if (localStorage.getItem('probeType') == "z") {
setTimeout(function() {
probezplatetab()
$(".probetabxyz").removeClass("active")
$("#probezplatetab").addClass("active")
}, 100)
} else {
setTimeout(function() {
probeztab()
$(".probetabxyz").removeClass("active")
$("#probeztab").addClass("active")
}, 100)
}
}
}
function probeautotab() {
probemode.mode = "auto"; // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
$(".probe-tab-content").hide();
$("#probe-auto").show();
$("#xyzdatum").show();
$(".img-probe").hide();
$("#img-probe-auto").show();
$("#toggle-probe-advanced").show();
$("#endmilldiameterform").hide();
if (probemode.stock.position == "fl") {
$("#toggle-probe-advanced-content").data('collapse').collapse()
} else {
$("#toggle-probe-advanced-content").data('collapse').expand()
}
}
function probexyztab() {
probemode.mode = "xyz"; // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
$(".probe-tab-content").hide();
$("#probe-xyz").show();
$("#xyzdatum").show();
$(".img-probe").hide();
$("#img-probe-xyz").show();
$("#toggle-probe-advanced").show();
$("#endmilldiameterform").show();
if (probemode.stock.position == "fl") {
$("#toggle-probe-advanced-content").data('collapse').collapse()
} else {
$("#toggle-probe-advanced-content").data('collapse').expand()
}
}
function probextab() {
probemode.mode = "xzero"; // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
resetOffsetFL();
$(".probe-tab-content").hide();
$("#probe-x").show();
$("#xyzdatum").hide();
$(".img-probe").hide();
$("#img-probe-x").show();
$("#toggle-probe-advanced").hide();
$("#endmilldiameterform").show();
$("#toggle-probe-advanced-content").data('collapse').collapse()
}
function probeytab() {
probemode.mode = "yzero"; // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
resetOffsetFL();
$(".probe-tab-content").hide();
$("#probe-y").show();
$("#xyzdatum").hide();
$(".img-probe").hide();
$("#img-probe-y").show();
$("#toggle-probe-advanced").hide();
$("#endmilldiameterform").show();
$("#toggle-probe-advanced-content").data('collapse').collapse()
}
function probeztab() {
probemode.mode = "zzero"; // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
resetOffsetFL();
$(".probe-tab-content").hide();
$("#probe-z").show();
$("#xyzdatum").hide();
$(".img-probe").hide();
$("#img-probe-z").show();
$("#toggle-probe-advanced").hide();
$("#endmilldiameterform").hide();
$("#toggle-probe-advanced-content").data('collapse').collapse()
}
function probezplatetab() {
probemode.mode = "zplate"; // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
resetOffsetFL();
$(".probe-tab-content").hide();
$("#probe-z").show();
$("#xyzdatum").hide();
$(".img-probe").hide();
$("#img-probe-zplate").show();
$("#toggle-probe-advanced").hide();
$("#endmilldiameterform").hide();
$("#toggle-probe-advanced-content").data('collapse').expand()
}
function probeendmilltab() {
probemode.mode = "endmilldia"; // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
resetOffsetFL();
$(".probe-tab-content").hide();
$("#probe-endmill").show();
$("#xyzdatum").hide();
$(".img-probe").hide();
$("#img-probe-endmill").show();
$("#toggle-probe-advanced").hide();
$("#endmilldiameterform").hide();
$("#toggle-probe-advanced-content").data('collapse').collapse()
}
function resetOffsetFL() {
$(".probe-label").removeClass("areaactive")
$("#probe-fl").addClass("areaactive")
probemode.stock.position = "fl" // fl, fr, rl, rr, c
}
$("#probe-fl, #probe-fl-text").on("click", function() {
resetOffsetFL();
});
$("#probe-fr, #probe-fr-text").on("click", function() {
$(".probe-label").removeClass("areaactive")
$("#probe-fr").addClass("areaactive")
probemode.stock.position = "fr" // fl, fr, rl, rr, c
});
$("#probe-rl, #probe-rl-text").on("click", function() {
$(".probe-label").removeClass("areaactive")
$("#probe-rl").addClass("areaactive")
probemode.stock.position = "rl" // fl, fr, rl, rr, c
});
$("#probe-rr, #probe-rr-text").on("click", function() {
$(".probe-label").removeClass("areaactive")
$("#probe-rr").addClass("areaactive")
probemode.stock.position = "rr" // fl, fr, rl, rr, c
});
$("#probe-c, #probe-c-text").on("click", function() {
$(".probe-label").removeClass("areaactive")
$("#probe-c").addClass("areaactive")
probemode.stock.position = "c" // fl, fr, rl, rr, c
});
function probetype(type) {
localStorage.setItem('probeType', type);
if (type == "xyz") {
probemode.probe = xyzprobeplate // protoxyzprobeplate, xyzprobeplate, zprobeplate
var template = ` OpenBuilds XYZ Probe`;
$("#probetypebtn").html(template)
$(".probetabz").hide();
$(".probetabxyz").show();
probexyztab()
} else if (type == "protoxyz") {
probemode.probe = protoxyzprobeplate // protoxyzprobeplate, xyzprobeplate, zprobeplate
var template = `
Prototype OpenBuilds XYZ Probe`;
$("#probetypebtn").html(template)
$(".probetabz").hide();
$(".probetabxyz").show();
probexyztab()
} else if (type == "z") {
probemode.probe = zprobeplate // protoxyzprobeplate, xyzprobeplate, zprobeplate
var template = `
OpenBuilds Z Touch Plate`;
$("#probetypebtn").html(template)
$(".probetabxyz").hide();
$(".probetabz").show();
probezplatetab();
}
}
function confirmProbeInPlace(operation) {
var imgurl = "./img/xyzprobe/xyz.png"
if (probemode.mode == "xyz") { // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
imgurl = "./img/xyzprobe/xyz.png"
} else if (probemode.mode == "xzero") { // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
imgurl = "./img/xyzprobe/x.png"
} else if (probemode.mode == "yzero") { // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
imgurl = "./img/xyzprobe/y.png"
} else if (probemode.mode == "zzero") { // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
imgurl = "./img/xyzprobe/z.png"
} else if (probemode.mode == "zplate") { // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
imgurl = "./img/xyzprobe/zplate.png"
} else if (probemode.mode == "endmilldia") { // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
imgurl = "./img/xyzprobe/endmill.png"
} else if (probemode.mode == "auto") { // auto, xyz, xzero, yzero, zzero, zplate, endmilldia
imgurl = "./img/xyzprobe/auto.png"
}
var confirmTemplate = `
|