function z0probe() { if (localStorage.getItem('lastProbe')) { var data = JSON.parse(localStorage.getItem('lastProbe')); } else { var data = { // sane default dist: 25, plate: 20, feedrate: 100, direction: 'Z-' } } var z0probetemplate = `
` if (!window.matchMedia("only screen and (max-width: 760px)").matches) { z0probetemplate += ` ` } z0probetemplate += `
probe-info This is how far (maximum) the Z-Probe will move downward
The offset above Z0 to the top of the plate
NB: First jog to above where you want the Z-Probe to be done, and test your Probe connectivity on the Troubleshooting tab.
` Metro.dialog.create({ title: " Z0 Probe", content: z0probetemplate, width: 750, actions: [{ caption: "Cancel", cls: "js-dialog-close", onclick: function() { // } }, { caption: "Probe", cls: "js-dialog-close success", onclick: function() { var traveldist = $('#z0traveldist').val(); var platethickness = $('#z0platethickness').val(); var feedrate = $('#z0feedrate').val(); // alert('Probing down to ' + traveldist + "mm at " + feedrate + "mm/min and then subtracting a plate of " + platethickness + "mm"); // sendGcode('G38.2 Z-' + traveldist + ' F' + feedrate) data = { dist: traveldist, plate: platethickness, feedrate: feedrate, direction: 'Z-' } socket.emit("zProbe", data) localStorage.setItem('lastProbe', JSON.stringify(data)); } } ] }); } function z0proberesult(data) { if (data.machine.probe.state > 0) { Metro.dialog.create({ title: " Probe completed Succesfully", content: "
Probe completed succesfully. Z0 has been set. Would you like to retract the probe?
", actions: [{ caption: "Retract", cls: "js-dialog-close success", onclick: function() { sendGcode('$J=G91Z5F' + parseInt(data.machine.probe.request.feedrate)); } }, { caption: "Close", cls: "js-dialog-close", onclick: function() { // nothing } } ] }); } else { Metro.dialog.create({ title: " Probe Failed", content: "
Probe Failed. Z0 has not been set.
The probe did not make contact with the base plate in the requested move.
", actions: [{ caption: "Retry", cls: "js-dialog-close", onclick: function() { sendGcode('$X') z0probe() } }, { caption: "Close", cls: "js-dialog-close", onclick: function() { // nothing } } ] }); } }