var xcalmovedistance = 100; var xcaltemplate = `
Step 1: Mark Initial Position
This wizard, will allow you to fine-tune your steps-per-mm for the X-Axis
To get started, jog your X-Axis until its near the X- position.

Then, place a physical mark on your machine to mark where the X-Carriage currently is
` function applycalibrationx() { var actualdist = $('#xcaltraveldist').val(); var currentstepspermm = parseFloat(grblParams['$100']); // var currentstepspermm = 199.9; // newstepsval = currentsteps * (intended distance / actual distance) var newsteps = (currentstepspermm * (xcalmovedistance / actualdist)).toFixed(2); // alert("New Steps Per MM Value: " + newsteps); // $('#val-100-input').val(newsteps) // checkifchanged(); sendGcode("$100=" + newsteps); setTimeout(function() { sendGcode(String.fromCharCode(0x18)); }, 500); } function xstepscalibrate() { Metro.dialog.create({ title: " Calibrate Steps per mm for X-Axis ($100)", content: xcaltemplate, width: 750, clsDialog: 'dark', actions: [{ caption: "Cancel", cls: "js-dialog-close", onclick: function() { // } }] }); $("#xcalmovedistance").keyup(function() { xcalmovedistance = $("#xcalmovedistance").val(); $(".xcalmovedistanceval").html(xcalmovedistance); $("#xcaltraveldist").val(xcalmovedistance) var actualdist = $('#xcaltraveldist').val(); var currentstepspermm = parseFloat(grblParams['$100']); // var currentstepspermm = 199.9; // newstepsval = currentsteps * (intended distance / actual distance) var newsteps = (currentstepspermm * (xcalmovedistance / actualdist)).toFixed(2); $("#newsteps").html(newsteps) $("#currentstepspermm").html(currentstepspermm) $("#reqdistance").html(xcalmovedistance) $("#actualdist").html(xcalmovedistance) }); $("#xcaltraveldist").keyup(function() { var actualdist = $('#xcaltraveldist').val(); var currentstepspermm = parseFloat(grblParams['$100']); // var currentstepspermm = 199.9; // newstepsval = currentsteps * (intended distance / actual distance) var newsteps = (currentstepspermm * (xcalmovedistance / actualdist)).toFixed(2); $("#showcalc").show() $("#newsteps").html(newsteps) $("#currentstepspermm").html(currentstepspermm) $("#reqdistance").html(xcalmovedistance) $("#actualdist").html(actualdist) }); } function slide1() { $('#xcalstep1').show(); $('#xcalstep2').hide(); $('#xcalstep3').hide(); } function slide2() { $('#xcal100mm').attr('disabled', false); $('#xcalcontinue2').attr('disabled', true); $('#xcalstep1').hide(); $('#xcalstep2').show(); $('#xcalstep3').hide(); } function slide3() { $('#xcalstep1').hide(); $('#xcalstep2').hide(); $('#xcalstep3').show(); }