kopia lustrzana https://github.com/OpenBuilds/OpenBuilds-CONTROL
pull/153/head
rodzic
54edbcb6fd
commit
1d94031510
|
@ -1,3 +1,4 @@
|
|||
v1.0.238: Fix cosmetic bug in editing JS Macros. Fixed issue #128, #129, #130, #131, #132, #134, #135
|
||||
v1.0.237: Fixed Pause Bug
|
||||
v1.0.236: Fixed Pause bug
|
||||
v1.0.235: Improved Serial Buffer check
|
||||
|
|
|
@ -437,7 +437,7 @@
|
|||
</button>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dro">
|
||||
<div class="dro" id="xPosDro">
|
||||
<div class="float-left fg-red" data-fa-transform="right-15">
|
||||
<span class="fa-layers fa-fw">
|
||||
<span class="fa-layers-text fg-red" data-fa-transform="right-3">X</span>
|
||||
|
@ -473,7 +473,7 @@
|
|||
</button>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dro">
|
||||
<div class="dro" id="yPosDro">
|
||||
<div class="float-left fg-green">
|
||||
<span class="fa-layers fa-fw">
|
||||
<span class="fa-layers-text fg-green" data-fa-transform="right-3">Y</span>
|
||||
|
@ -508,7 +508,7 @@
|
|||
</button>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dro">
|
||||
<div class="dro" id="zPosDro">
|
||||
<div class="float-left fg-blue">
|
||||
<span class="fa-layers fa-fw">
|
||||
<span class="fa-layers-text fg-blue" data-fa-transform="right-3">Z</span>
|
||||
|
@ -1165,7 +1165,7 @@
|
|||
<div class="dialog-content" style="max-height: calc(100vh - 100px);overflow-y: auto; overflow-x: hidden;">
|
||||
<form>
|
||||
<div class="row mb-2">
|
||||
<div class="cell-sm-6">
|
||||
<div class="cell-sm-7">
|
||||
<div class="row mb-2">
|
||||
<label class="cell-sm-6">Router Bit Diameter</label>
|
||||
<div class="cell-sm-6">
|
||||
|
@ -1185,7 +1185,8 @@
|
|||
<div class="row mb-2 border-bottom bd-lightGray">
|
||||
<label class="cell-sm-6">Feedrate</label>
|
||||
<div class="cell-sm-6">
|
||||
<input id="surfaceFeedrate" type="number" data-role="input" data-append="mm/min" data-clear-button="false" placeholder="800" value="800" data-editable="true">
|
||||
<input id="surfaceFeedrate" type="number" maxlength="5" data-role="input" data-append="mm/min" data-clear-button="false" placeholder="800" value="800" data-editable="true"
|
||||
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);">
|
||||
<small class="text-muted">Cutting speed</small>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1213,8 +1214,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2 border-bottom bd-lightGray">
|
||||
<label class="cell-sm-6">Spindle RPM</label>
|
||||
<div class="cell-sm-6">
|
||||
<input id="surfaceRPM" type="number" data-role="input" data-append="mm" data-clear-button="false" placeholder="1000" value="1000" data-editable="true">
|
||||
<small class="text-muted">Spindle RPM for variable spindles</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="cell-sm-6">
|
||||
<div class="cell-sm-5">
|
||||
<small class="text-muted">NB: make sure your spindle is 100% perpendicular (trammed) to your bed, before running a Surfacing operation. Incorrectly trammed spindles will cause uneven machining of the surface, leading to pitting and
|
||||
uneven surface finish
|
||||
</small>
|
||||
|
@ -1295,13 +1304,13 @@
|
|||
<div class="dialog-content" style="max-height: calc(100vh - 100px);overflow-y: auto; overflow-x: hidden;">
|
||||
<nav data-role="ribbonmenu">
|
||||
<ul class="tabs-holder">
|
||||
<li onclick="probeautotab();" class="probetabxyz" id="probeautotab"><a href="#">Automatic</a></li>
|
||||
<li onclick="probexyztab();" class="probetabxyz" id="probexyztab"><a href="#">XYZ Zero</a></li>
|
||||
<li onclick="probextab();" class="probetabxyz" id="probextab"><a href="#">X Zero</a></li>
|
||||
<li onclick="probeytab();" class="probetabxyz" id="probeytab"><a href="#">Y Zero</a></li>
|
||||
<li onclick="probeztab();" class="probetabxyz" id="probeztab"><a href="#">Z Zero</a></li>
|
||||
<li onclick="probezplatetab();" class="probetabz" id="probezplatetab" style="display: none;"><a href="#">Z Touch Plate</a></li>
|
||||
<!-- <li onclick="probeautotab();" class="probetabxyz disabled" id="probeautotab"><a href="#">Automatic</a></li>
|
||||
<li onclick="probeendmilltab();" class="probetabxyz disabled" id="probeendmilltab"><a href="#">Endmill Diameter</a></li> -->
|
||||
<!-- <li onclick="probeendmilltab();" class="probetabxyz disabled" id="probeendmilltab"><a href="#">Endmill Diameter</a></li> -->
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
@ -1550,7 +1559,7 @@
|
|||
</div>
|
||||
<div class="dialog-actions">
|
||||
<div class="float-right">
|
||||
<button class="button primary js-dialog-close">OK</button>
|
||||
<button class="button primary js-dialog-close" id="jobCompleteBtnOk">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1625,8 +1634,10 @@
|
|||
<script type="text/javascript" src="js/calibrate-z.js"></script>
|
||||
<script type="text/javascript" src="js/calibrate-servo.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/probe.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/probev2.js"></script>
|
||||
<script type="text/javascript" src="js/holefinder.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="wizards/surfacing.js"></script>
|
||||
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
function findCenter() {
|
||||
var xoffset = (probemode.probe.xoffset) * -1 // *-1 to make negative as we are off to the left too far from x0
|
||||
var yoffset = (probemode.probe.yoffset) * -1 // *-1 to make negative as we are off to the front too far from y0
|
||||
var zoffset = parseFloat(probemode.probe.zoffset) // not *-1 as its offset in z pos
|
||||
var step = 0;
|
||||
var rightside = 0,
|
||||
leftside = 0,
|
||||
farside = 0,
|
||||
nearside = 0,
|
||||
centerXdistance = 0,
|
||||
centerYdistance = 0;
|
||||
|
||||
socket.off('prbResult'); // Disable old listeners
|
||||
|
||||
var holefindermacroStep1 = `
|
||||
; Header
|
||||
|
||||
G21 ; mm mode
|
||||
G10 P1 L20 X0 Y0 Z0 ; zero out current location
|
||||
|
||||
; First we establish Zero
|
||||
; Probe Z
|
||||
G0 X22.5 Y22.5 ; position to center of logo
|
||||
G38.2 Z-25 F100 ; Probe Z
|
||||
G4 P0.4
|
||||
G10 P1 L20 Z` + zoffset + ` ; Set Z6 where 6 is thickness of plate
|
||||
G0 Z` + (zoffset + 5) + ` ; retract
|
||||
|
||||
; Probe X
|
||||
G0 X-20 Y10 ; position to left side and move forward a little to be closer to center of edge
|
||||
G0 Z` + (zoffset - 6) + ` ; drop down to be next to plate
|
||||
G38.2 X25 F100 ; Probe X
|
||||
G4 P0.4
|
||||
G10 P1 L20 X` + xoffset + ` ; set X as offset and half endmill diameter
|
||||
G0 X` + (xoffset - 2).toFixed(3) + `
|
||||
G0 Z` + (zoffset + 5) + ` ; retract
|
||||
|
||||
; Probe Y
|
||||
G0 X15 Y-20 ; position to front side and move right a little to be closer to center of edge
|
||||
G0 Z` + (zoffset - 6) + ` ; drop down to be next to plate
|
||||
G38.2 Y25 F100 ; probe Y
|
||||
G4 P0.4
|
||||
G10 P1 L20 Y` + yoffset + ` ; set Y as offset and half endmill diameter
|
||||
G0 Y` + (yoffset - 2).toFixed(3) + `
|
||||
G0 Z` + (zoffset + 5) + ` ; retract
|
||||
G0 X0 Y0 ; return
|
||||
|
||||
G0 X4 Y4
|
||||
G0 Z1
|
||||
G38.2 X10 F50 ; Probe X`
|
||||
|
||||
socket.emit('runJob', {
|
||||
data: holefindermacroStep1,
|
||||
isJob: false,
|
||||
completedMsg: false,
|
||||
fileName: ""
|
||||
});
|
||||
|
||||
socket.on('prbResult', function(prbdata) {
|
||||
step++;
|
||||
console.log("Step " + step, prbdata);
|
||||
|
||||
// Steps 1-3 just positions endmill for probes that count
|
||||
|
||||
if (step == 4) {
|
||||
rightside = prbdata.x
|
||||
console.log(rightside);
|
||||
|
||||
var holefindermacroStep5 = `
|
||||
G91
|
||||
G0 X-1
|
||||
G90
|
||||
G38.2 X-10 F50 ; Probe X`
|
||||
|
||||
socket.emit('runJob', {
|
||||
data: holefindermacroStep5,
|
||||
isJob: false,
|
||||
completedMsg: false,
|
||||
fileName: ""
|
||||
});
|
||||
}
|
||||
|
||||
if (step == 5) {
|
||||
leftside = prbdata.x
|
||||
var centerdistance = (rightside - leftside);
|
||||
var holefindermacroStep6 = `
|
||||
G91
|
||||
G0 X` + centerdistance / 2 + `
|
||||
G90
|
||||
G38.2 Y10 F50 ; Probe Y`
|
||||
|
||||
socket.emit('runJob', {
|
||||
data: holefindermacroStep6,
|
||||
isJob: false,
|
||||
completedMsg: false,
|
||||
fileName: ""
|
||||
});
|
||||
}
|
||||
|
||||
if (step == 6) {
|
||||
farside = prbdata.y
|
||||
|
||||
var holefindermacroStep7 = `
|
||||
G91
|
||||
G0 Y-1
|
||||
G90
|
||||
G38.2 Y-10 F50 ; Probe Y`
|
||||
|
||||
socket.emit('runJob', {
|
||||
data: holefindermacroStep7,
|
||||
isJob: false,
|
||||
completedMsg: false,
|
||||
fileName: ""
|
||||
});
|
||||
}
|
||||
|
||||
if (step == 7) {
|
||||
nearside = prbdata.y
|
||||
centerYdistance = (farside - nearside);
|
||||
console.log(centerYdistance)
|
||||
var holefindermacroStep7 = `
|
||||
G91
|
||||
G0 Y` + centerYdistance / 2 + `
|
||||
G90
|
||||
G38.2 X-10 F50 ; Probe Y`
|
||||
|
||||
socket.emit('runJob', {
|
||||
data: holefindermacroStep7,
|
||||
isJob: false,
|
||||
completedMsg: false,
|
||||
fileName: ""
|
||||
});
|
||||
}
|
||||
|
||||
if (step == 8) {
|
||||
leftside = prbdata.x
|
||||
|
||||
var holefindermacroStep7 = `
|
||||
G91
|
||||
G0 X1
|
||||
G90
|
||||
G38.2 X10 F50 ; Probe Y`
|
||||
|
||||
socket.emit('runJob', {
|
||||
data: holefindermacroStep7,
|
||||
isJob: false,
|
||||
completedMsg: false,
|
||||
fileName: ""
|
||||
});
|
||||
}
|
||||
|
||||
if (step == 9) {
|
||||
rightside = prbdata.x
|
||||
centerXdistance = (rightside - leftside);
|
||||
console.log(centerXdistance)
|
||||
var holefindermacroStep7 = `
|
||||
G91
|
||||
G0 X-` + centerXdistance / 2 + `
|
||||
G90
|
||||
G10 P1 L20 X0 Y0
|
||||
G0 Z` + (zoffset + 5) + ` ; retract`
|
||||
|
||||
socket.emit('runJob', {
|
||||
data: holefindermacroStep7,
|
||||
isJob: false,
|
||||
completedMsg: "Probe Complete: Remove the Probe Clip and Probe Plate before continuing... <hr> Approx Endmill Diameter: " + (12 - ((centerXdistance + centerYdistance) / 2)).toFixed(2) + "mm",
|
||||
fileName: ""
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
|
@ -123,6 +123,18 @@ $(document).ready(function() {
|
|||
inchtommrate()
|
||||
});
|
||||
|
||||
$("#jograte").on("keypress", function(e) {
|
||||
if (e.which == 13) {
|
||||
$("#jograte").blur();
|
||||
}
|
||||
})
|
||||
|
||||
$("#jograteinch").on("keypress", function(e) {
|
||||
if (e.which == 13) {
|
||||
$("#jograte").blur();
|
||||
}
|
||||
})
|
||||
|
||||
$(document).mousedown(function(e) {
|
||||
safeToUpdateSliders = false;
|
||||
}).mouseup(function(e) {
|
||||
|
@ -131,7 +143,7 @@ $(document).ready(function() {
|
|||
safeToUpdateSliders = true;
|
||||
});
|
||||
|
||||
$("#xPos").click(function() {
|
||||
$("#xPosDro").click(function() {
|
||||
$("#xPos").hide()
|
||||
if (unit == "mm") {
|
||||
$("#xPosInput").show().focus().val(laststatus.machine.position.work.x)
|
||||
|
@ -154,15 +166,14 @@ $(document).ready(function() {
|
|||
//Enable the textbox again if needed.
|
||||
$(this).removeAttr("disabled");
|
||||
if (unit == "mm") {
|
||||
sendGcode("G21")
|
||||
sendGcode("$J=G90 G21 X" + $("#xPosInput").val() + " F" + $('#jograte').val());
|
||||
} else if (unit == "in") {
|
||||
sendGcode("G20")
|
||||
sendGcode("$J=G90 G20 X" + $("#xPosInput").val() + " F" + $('#jograteinch').val());
|
||||
}
|
||||
sendGcode("G0 X" + $("#xPosInput").val())
|
||||
}
|
||||
});
|
||||
|
||||
$("#yPos").click(function() {
|
||||
$("#yPosDro").click(function() {
|
||||
$("#yPos").hide()
|
||||
if (unit == "mm") {
|
||||
$("#yPosInput").show().focus().val(laststatus.machine.position.work.y)
|
||||
|
@ -185,15 +196,14 @@ $(document).ready(function() {
|
|||
//Enable the textbox again if needed.
|
||||
$(this).removeAttr("disabled");
|
||||
if (unit == "mm") {
|
||||
sendGcode("G21")
|
||||
sendGcode("$J=G90 G21 Y" + $("#yPosInput").val() + " F" + $('#jograte').val());
|
||||
} else if (unit == "in") {
|
||||
sendGcode("G20")
|
||||
sendGcode("$J=G90 G20 Y" + $("#yPosInput").val() + " F" + $('#jograteinch').val());
|
||||
}
|
||||
sendGcode("G0 Y" + $("#yPosInput").val())
|
||||
}
|
||||
});
|
||||
|
||||
$("#zPos").click(function() {
|
||||
$("#zPosDro").click(function() {
|
||||
$("#zPos").hide()
|
||||
if (unit == "mm") {
|
||||
$("#zPosInput").show().focus().val(laststatus.machine.position.work.z)
|
||||
|
@ -216,11 +226,10 @@ $(document).ready(function() {
|
|||
//Enable the textbox again if needed.
|
||||
$(this).removeAttr("disabled");
|
||||
if (unit == "mm") {
|
||||
sendGcode("G21")
|
||||
sendGcode("$J=G90 G21 Z" + $("#zPosInput").val() + " F" + $('#jograte').val());
|
||||
} else if (unit == "in") {
|
||||
sendGcode("G20")
|
||||
sendGcode("$J=G90 G20 Z" + $("#zPosInput").val() + " F" + $('#jograteinch').val());
|
||||
}
|
||||
sendGcode("G0 Z" + $("#zPosInput").val())
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -603,7 +612,7 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
function changeStepSize(dir) {
|
||||
if (jogdist == 0.1) {
|
||||
if (jogdist == 0.1 || jogdist == 0.254) {
|
||||
if (dir == 1) {
|
||||
jogdist = 1;
|
||||
$('.distbtn').removeClass('bd-openbuilds')
|
||||
|
@ -616,7 +625,7 @@ function changeStepSize(dir) {
|
|||
if (dir == -1) {
|
||||
// do nothing
|
||||
}
|
||||
} else if (jogdist == 1) {
|
||||
} else if (jogdist == 1 || jogdist == 2.54) {
|
||||
if (dir == 1) {
|
||||
jogdist = 10;
|
||||
$('.distbtn').removeClass('bd-openbuilds')
|
||||
|
@ -635,7 +644,7 @@ function changeStepSize(dir) {
|
|||
$('#dist01label').removeClass('fg-gray')
|
||||
$('#dist01label').addClass('fg-openbuilds')
|
||||
}
|
||||
} else if (jogdist == 10) {
|
||||
} else if (jogdist == 10 || jogdist == 25.4) {
|
||||
if (dir == 1) {
|
||||
jogdist = 100;
|
||||
$('.distbtn').removeClass('bd-openbuilds')
|
||||
|
@ -654,7 +663,7 @@ function changeStepSize(dir) {
|
|||
$('#dist1label').removeClass('fg-gray')
|
||||
$('#dist1label').addClass('fg-openbuilds')
|
||||
}
|
||||
} else if (jogdist == 100) {
|
||||
} else if (jogdist == 100 || jogdist == 254) {
|
||||
if (dir == 1) {
|
||||
// do nothing
|
||||
}
|
||||
|
|
|
@ -133,11 +133,11 @@ function edit(i, evt) {
|
|||
</div>
|
||||
<div class="cell-sm-9">
|
||||
<div id="macroGcodeEditField">
|
||||
<textarea wrap="off" id="macrogcode" type="text" value="` + gcode + `" style="overflow-y: auto; max-height: 100px; resize: none;" rows="4" data-editable="true"></textarea>
|
||||
<textarea wrap="off" id="macrogcode" type="text" value="` + gcode + `" style="overflow-y: auto; height: 200px; max-height: 200px; resize: none;" rows="4" data-editable="true"></textarea>
|
||||
<span class="text-small">Enter GCODE to execute</span>
|
||||
</div>
|
||||
<div id="macroJavascriptEditField" style="display:none;" >
|
||||
<textarea wrap="off" id="macrojs" type="text" value="` + javascript + `" style="overflow-y: auto; max-height: 100px; resize: none;" rows="4" data-editable="true"></textarea>
|
||||
<textarea wrap="off" id="macrojs" type="text" value="" style="overflow-y: auto; height: 200px; max-height: 200px; resize: none;" rows="4" data-editable="true"></textarea>
|
||||
<span class="text-small">Enter Javascript to execute</span><br>
|
||||
<span class="text-small">tip: Prototype your code using</span>
|
||||
<span class="text-small"> the Devtools Console (Ctrl+Shift+i > Console)</span>
|
||||
|
@ -165,7 +165,8 @@ function edit(i, evt) {
|
|||
|
||||
<label class="cell-sm-3">Keyboard Shortcut</label>
|
||||
<div class="cell-sm-9" >
|
||||
<input id="macrokeyboardshortcut" class="macrokeyboardshortcutinput" type="text" value="` + macrokeyboardshortcut + `" data-editable="true" onclick="$('.macrokeyboardshortcutinput').removeClass('newMacroKeyAssignment'); $('#macrokeyboardshortcut').addClass('newMacroKeyAssignment')">
|
||||
<input id="macrokeyboardshortcut" class="macrokeyboardshortcutinput" type="text" value="` + macrokeyboardshortcut + `" data-role="input" data-clear-button="true" data-editable="true" onclick="$('.macrokeyboardshortcutinput').removeClass('newMacroKeyAssignment'); $('#macrokeyboardshortcut').addClass('newMacroKeyAssignment')">
|
||||
<span class="text-small fg-red" id="alreadyAssignedWarn" style="display: none;"></span>
|
||||
<span class="text-small">Click above to assign a new Keyboard Shortcut / combination to a function. Ctrl, Alt and Shift can be added to create combinations.</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -174,6 +175,7 @@ function edit(i, evt) {
|
|||
|
||||
Metro.dialog.create({
|
||||
title: "Edit Macro",
|
||||
width: 600,
|
||||
content: macroTemplate,
|
||||
actions: [{
|
||||
caption: "Cancel",
|
||||
|
@ -257,9 +259,30 @@ function edit(i, evt) {
|
|||
} else {
|
||||
newVal += e.key.toLowerCase();
|
||||
}
|
||||
$('.newMacroKeyAssignment').val(newVal)
|
||||
// $('.newMacroKeyAssignment').val(newVal)
|
||||
|
||||
var alreadyAssigned = false;
|
||||
var assignedMacro = '';
|
||||
for (i = 0; i < buttonsarray.length; i++) {
|
||||
if (newVal == buttonsarray[i].macrokeyboardshortcut) {
|
||||
alreadyAssigned = true;
|
||||
assignedMacro = buttonsarray[i].title
|
||||
}
|
||||
}
|
||||
if (alreadyAssigned) {
|
||||
$('#alreadyAssignedWarn').show();
|
||||
$('#alreadyAssignedWarn').html(newVal + " is already assigned to \"" + assignedMacro + "\"<br>");
|
||||
$('#macrokeyboardshortcut').addClass("alert")
|
||||
} else {
|
||||
$('#alreadyAssignedWarn').hide();
|
||||
$('#macrokeyboardshortcut').removeClass("alert")
|
||||
}
|
||||
}
|
||||
|
||||
$('.newMacroKeyAssignment').val(newVal)
|
||||
|
||||
$('#jsedit').val(javascript);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
129
app/js/probe.js
129
app/js/probe.js
|
@ -1,129 +0,0 @@
|
|||
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 = `
|
||||
<div class="p-0 m-0" style="overflow-y: auto; height: calc(100vh - 280px);">
|
||||
<table class="table">
|
||||
<tr>`
|
||||
|
||||
if (!window.matchMedia("only screen and (max-width: 760px)").matches) {
|
||||
z0probetemplate += `<td>
|
||||
<img src="https://image.ibb.co/mPunnf/probe-info.png" alt="probe-info" height="300" style="border: 1px solid #f1f2f3;">
|
||||
</td>
|
||||
`
|
||||
}
|
||||
|
||||
z0probetemplate += `<td style="max-width: 300px;">
|
||||
<label>Travel Distance</label>
|
||||
<input id="z0traveldist" type="number" value="` + data.dist + `" data-role="input" data-append="mm" data-prepend="<i class='fas fa-arrows-alt-v'></i>" data-clear-button="false">
|
||||
<small class="text-muted">This is how far (maximum) the Z-Probe will move downward</small>
|
||||
<hr>
|
||||
<label>Plate Thickness</label>
|
||||
<input id="z0platethickness" type="number" value="` + data.plate + `" data-role="input" data-append="mm" data-prepend="<i class='fas fa-ruler-vertical'></i>" data-clear-button="false">
|
||||
<small class="text-muted">The offset above Z0 to the top of the plate</small>
|
||||
<hr/>
|
||||
<label>Probe Feedrate</label>
|
||||
<input id="z0feedrate" type="number" value="` + data.feedrate + `" data-role="input" data-append="mm/min" data-prepend="<i class='fas fa-sort-numeric-down'></i>" data-clear-button="false">
|
||||
<!-- <small class="text-muted">The offset above Z0 to the top of the plate</small> -->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<small class="text-muted">
|
||||
NB: First jog to above where you want the Z-Probe to be done, and test your Probe connectivity on the Troubleshooting tab.
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
`
|
||||
|
||||
|
||||
Metro.dialog.create({
|
||||
title: "<i class='fas fa-podcast' data-fa-transform='rotate-180'></i> 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: "<i class='fas fa-check fa-fw fg-green'> </i> Probe completed Succesfully",
|
||||
content: "<div>Probe completed succesfully. Z0 has been set. Would you like to retract the probe?</div>",
|
||||
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: "<i class='fas fa-times fa-fw fg-red'> </i> Probe Failed",
|
||||
content: "<div>Probe Failed. Z0 has not been set.<br>The probe did not make contact with the base plate in the requested move.</div>",
|
||||
actions: [{
|
||||
caption: "Retry",
|
||||
cls: "js-dialog-close",
|
||||
onclick: function() {
|
||||
sendGcode('$X')
|
||||
z0probe()
|
||||
}
|
||||
},
|
||||
{
|
||||
caption: "Close",
|
||||
cls: "js-dialog-close",
|
||||
onclick: function() {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
|
@ -42,11 +42,19 @@ $(document).ready(function() {
|
|||
$(".needsXYZProbe").show()
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage.getItem('z0platethickness')) {
|
||||
zprobeplate.zoffset = localStorage.getItem('z0platethickness')
|
||||
}
|
||||
});
|
||||
|
||||
if (localStorage.getItem('customProbe')) {
|
||||
customprobeplate = (JSON.parse(localStorage.getItem('customProbe')))
|
||||
}
|
||||
|
||||
$("#z0platethickness").keyup(function() {
|
||||
localStorage.setItem('z0platethickness', $("#z0platethickness").val())
|
||||
});
|
||||
// still beta, lets hide it from users
|
||||
// if (!enableBetaFeatures) {
|
||||
// $(".needsXYZProbe").hide();
|
||||
|
@ -164,17 +172,15 @@ function probeautotab() {
|
|||
$("#zplatesettings").hide();
|
||||
$(".img-probe").hide();
|
||||
$("#img-probe-auto").show();
|
||||
$("#toggle-probe-advanced").show();
|
||||
$("#toggle-probe-advanced").hide();
|
||||
$("#endmilldiameterform").hide();
|
||||
if (probemode.stock.position == "fl") {
|
||||
$("#toggle-probe-advanced-content").data('collapse').collapse()
|
||||
} else {
|
||||
$("#toggle-probe-advanced-content").data('collapse').expand()
|
||||
}
|
||||
probemode.stock.position == "fl"
|
||||
$('#runNewProbeBtn').addClass("disabled")
|
||||
$('#confirmNewProbeBtn').removeClass("disabled")
|
||||
$('#jogTypeContinuous').prop('checked', true)
|
||||
allowContinuousJog = true;
|
||||
$('.probetabxyz').removeClass('active');
|
||||
$('#probeautotab').addClass('active');
|
||||
}
|
||||
|
||||
function probexyztab() {
|
||||
|
@ -196,6 +202,8 @@ function probexyztab() {
|
|||
$('#confirmNewProbeBtn').removeClass("disabled")
|
||||
$('#jogTypeContinuous').prop('checked', true)
|
||||
allowContinuousJog = true;
|
||||
$('.probetabxyz').removeClass('active');
|
||||
$('#probexyztab').addClass('active');
|
||||
}
|
||||
|
||||
function probextab() {
|
||||
|
@ -269,6 +277,9 @@ function probezplatetab() {
|
|||
$('#confirmNewProbeBtn').removeClass("disabled")
|
||||
$('#jogTypeContinuous').prop('checked', true)
|
||||
allowContinuousJog = true;
|
||||
$('#z0platethickness').val(zprobeplate.zoffset)
|
||||
$('.probetabxyz').removeClass('active');
|
||||
$('#probezplatetab').addClass('active');
|
||||
}
|
||||
|
||||
function probeendmilltab() {
|
||||
|
@ -334,7 +345,8 @@ function probetype(type) {
|
|||
$(".probetabxyz").show();
|
||||
$("#editCustomProbeBtn").hide()
|
||||
$("#ProbeButtonBarSpacer").show()
|
||||
probexyztab()
|
||||
$("#probeautotab").show();
|
||||
probeautotab()
|
||||
} else if (type == "z") {
|
||||
$(".needsXYZProbe").hide()
|
||||
probemode.probe = zprobeplate // customprobeplate, xyzprobeplate, zprobeplate
|
||||
|
@ -344,6 +356,7 @@ function probetype(type) {
|
|||
$(".probetabz").show();
|
||||
$("#editCustomProbeBtn").hide()
|
||||
$("#ProbeButtonBarSpacer").show()
|
||||
$("#probeautotab").hide();
|
||||
probezplatetab();
|
||||
} else if (type == "custom") {
|
||||
$(".needsXYZProbe").show()
|
||||
|
@ -354,6 +367,7 @@ function probetype(type) {
|
|||
$(".probetabxyz").show();
|
||||
$("#editCustomProbeBtn").show()
|
||||
$("#ProbeButtonBarSpacer").hide()
|
||||
$("#probeautotab").hide();
|
||||
probexyztab()
|
||||
}
|
||||
}
|
||||
|
@ -441,6 +455,10 @@ function runProbeNew() {
|
|||
|
||||
// alert(template)
|
||||
|
||||
if (probemode.mode == "auto") {
|
||||
findCenter();
|
||||
}
|
||||
|
||||
if (probemode.mode == "xzero") {
|
||||
var xoffset = (probemode.probe.xoffset + probemode.endmilldia / 2) * -1 // *-1 to make negative as we are off to the left too far from x0
|
||||
var yoffset = (probemode.probe.yoffset + probemode.endmilldia / 2) * -1 // *-1 to make negative as we are off to the front too far from y0
|
||||
|
|
|
@ -151,9 +151,9 @@ function initSocket() {
|
|||
showGrbl(true)
|
||||
});
|
||||
|
||||
socket.on("prbResult", function(data) {
|
||||
z0proberesult(data)
|
||||
});
|
||||
// socket.on("prbResult", function(data) {
|
||||
// console.log("Probe Data: ", data)
|
||||
// });
|
||||
|
||||
socket.on("jobComplete", function(data) {
|
||||
|
||||
|
@ -166,6 +166,7 @@ function initSocket() {
|
|||
$("#completeMsgDiv").html(data.jobCompletedMsg);
|
||||
Metro.dialog.open("#completeMsgModal");
|
||||
}
|
||||
$('#jobCompleteBtnOk').focus();
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -121,14 +121,20 @@ function parseGcodeInWebWorker(gcode) {
|
|||
}, 200);
|
||||
$('#3dviewicon').removeClass('fa-pulse');
|
||||
$('#3dviewlabel').html(' 3D View')
|
||||
} else {
|
||||
// Didn't get an Object
|
||||
$('#3dviewicon').removeClass('fa-pulse');
|
||||
$('#3dviewlabel').html(' 3D View')
|
||||
}
|
||||
}, false);
|
||||
|
||||
worker.postMessage({
|
||||
'data': gcode
|
||||
});
|
||||
|
||||
$('#3dviewicon').addClass('fa-pulse');
|
||||
$('#3dviewlabel').html(' 3D View (rendering, please wait...)')
|
||||
|
||||
// populateToolChanges(gcode)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ GCodeParser = function(handlers, modecmdhandlers) {
|
|||
'isComment': isComment,
|
||||
'feedrate': null
|
||||
};
|
||||
//console.log("args:", args);
|
||||
// console.log("args:", args);
|
||||
if (tokens.length > 1 && !isComment) {
|
||||
tokens.splice(1).forEach(function(token) {
|
||||
//console.log("token:", token);
|
||||
|
|
|
@ -32,7 +32,8 @@ function createSurfaceGcode() {
|
|||
surfaceX: $("#surfaceX").val(),
|
||||
surfaceY: $("#surfaceY").val(),
|
||||
surfaceDepth: $("#surfaceDepth").val(),
|
||||
surfaceType: $("input[name='surfaceType']:checked").val()
|
||||
surfaceType: $("input[name='surfaceType']:checked").val(),
|
||||
surfaceRPM: $('#surfaceRPM').val()
|
||||
};
|
||||
console.log(data);
|
||||
localStorage.setItem("lastSurfacingTool", JSON.stringify(data));
|
||||
|
@ -46,9 +47,7 @@ function createSurfaceGcode() {
|
|||
var lineOver = data.surfaceDiameter * (data.surfaceStepover / 100);
|
||||
|
||||
var gcode =
|
||||
`; Surfacing / Flattening Operation: ` +
|
||||
data.surfaceType +
|
||||
`
|
||||
`; Surfacing / Flattening Operation
|
||||
; Endmill Diameter: ` +
|
||||
data.surfaceDiameter +
|
||||
`mm
|
||||
|
@ -67,8 +66,10 @@ function createSurfaceGcode() {
|
|||
G54; Work Coordinates
|
||||
G21; mm-mode
|
||||
G90; Absolute Positioning
|
||||
M3 S1000; Spindle On
|
||||
G0 X0 Y0 Z10
|
||||
M3 S` + data.surfaceRPM + `; Spindle On
|
||||
G4 P1.8 ; Wait for spindle to come up to speed
|
||||
G0 Z10
|
||||
G0 X0 Y0
|
||||
G1 F` +
|
||||
data.surfaceFeedrate + `\n`;
|
||||
|
||||
|
@ -134,15 +135,15 @@ G1 X` +
|
|||
|
||||
// Framing Pass
|
||||
gcode += `; Framing pass\n`;
|
||||
gcode += `G0 X` + startpointX + ` Y` + startpointY + `Z10\n`; // position at start point
|
||||
gcode += `G1 Z-` + data.surfaceDepth + `\n`; // plunge
|
||||
gcode += `G1 X` + startpointX + ` Y` + endpointY + `Z-` + data.surfaceDepth + `\n`; // Cut side
|
||||
gcode += `G0 Z10\n`;
|
||||
gcode += `G0 X` + endpointX + ` Y` + endpointY +`\n`; // position at start point
|
||||
gcode += `G1 Z-` + data.surfaceDepth + `\n`; // plunge
|
||||
gcode += `G0 X` + endpointX + ` Y` + startpointY + `Z-` + data.surfaceDepth + `\n`; // Cut side
|
||||
gcode += `G0 Z10\n`;
|
||||
gcode += `G0 X0 Y0\n`;
|
||||
gcode += `G0 X` + startpointX + ` Y` + startpointY + `Z10\n`; // position at start point
|
||||
gcode += `G1 Z-` + data.surfaceDepth + `\n`; // plunge
|
||||
gcode += `G1 X` + startpointX + ` Y` + endpointY + `Z-` + data.surfaceDepth + `\n`; // Cut side
|
||||
gcode += `G0 Z10\n`;
|
||||
gcode += `G0 X` + endpointX + ` Y` + endpointY + `\n`; // position at start point
|
||||
gcode += `G1 Z-` + data.surfaceDepth + `\n`; // plunge
|
||||
gcode += `G0 X` + endpointX + ` Y` + startpointY + `Z-` + data.surfaceDepth + `\n`; // Cut side
|
||||
gcode += `G0 Z10\n`;
|
||||
gcode += `G0 X0 Y0\n`;
|
||||
|
||||
|
||||
gcode += `M5 S0\n`;
|
||||
|
@ -154,4 +155,4 @@ G1 X` +
|
|||
// console.log(gcode);
|
||||
//
|
||||
// $("#gcode").html(gcode.replace(/(?:\r\n|\r|\n)/g, "<br>"));
|
||||
}
|
||||
}
|
72
index.js
72
index.js
|
@ -323,9 +323,7 @@ var status = {
|
|||
x: 0.00,
|
||||
y: 0.00,
|
||||
z: 0.00,
|
||||
state: -1,
|
||||
plate: 0.00,
|
||||
request: {}
|
||||
state: -1
|
||||
},
|
||||
position: {
|
||||
work: {
|
||||
|
@ -926,33 +924,28 @@ io.on("connection", function(socket) {
|
|||
|
||||
// [PRB:0.000,0.000,0.000:0]
|
||||
if (data.indexOf("[PRB:") === 0) {
|
||||
if (status.machine.probe.request.plate) {
|
||||
debug_log(data)
|
||||
var prbLen = data.substr(5).search(/\]/);
|
||||
var prbData = data.substr(5, prbLen).split(/,/);
|
||||
var success = data.split(':')[2].split(']')[0];
|
||||
status.machine.probe.x = prbData[0];
|
||||
status.machine.probe.y = prbData[1];
|
||||
status.machine.probe.z = prbData[2];
|
||||
status.machine.probe.state = success;
|
||||
if (success > 0) {
|
||||
var output = {
|
||||
'command': '[ PROBE ]',
|
||||
'response': "Probe Completed. Setting Z to " + status.machine.probe.plate + 'mm',
|
||||
}
|
||||
io.sockets.emit('data', output);
|
||||
addQToEnd('G10 P1 L20 Z' + status.machine.probe.plate);
|
||||
send1Q();
|
||||
} else {
|
||||
var output = {
|
||||
'command': '[ PROBE ]',
|
||||
'response': "Probe move aborted - probe did not make contact within specified distance",
|
||||
}
|
||||
io.sockets.emit('data', output);
|
||||
debug_log(data)
|
||||
var prbLen = data.substr(5).search(/\]/);
|
||||
var prbData = data.substr(5, prbLen).split(/,/);
|
||||
var success = data.split(':')[2].split(']')[0];
|
||||
status.machine.probe.x = prbData[0];
|
||||
status.machine.probe.y = prbData[1];
|
||||
status.machine.probe.z = prbData[2].split(':')[0];
|
||||
status.machine.probe.state = success;
|
||||
if (success > 0) {
|
||||
var output = {
|
||||
'command': '[ PROBE ]',
|
||||
'response': "Probe Completed.",
|
||||
}
|
||||
io.sockets.emit('prbResult', status);
|
||||
status.machine.probe.request = "";
|
||||
io.sockets.emit('data', output);
|
||||
} else {
|
||||
var output = {
|
||||
'command': '[ PROBE ]',
|
||||
'response': "Probe move ERROR - probe did not make contact within specified distance",
|
||||
}
|
||||
io.sockets.emit('data', output);
|
||||
}
|
||||
io.sockets.emit('prbResult', status.machine.probe);
|
||||
};
|
||||
|
||||
// Machine Identification
|
||||
|
@ -1192,29 +1185,6 @@ io.on("connection", function(socket) {
|
|||
}
|
||||
});
|
||||
|
||||
socket.on('zProbe', function(data) {
|
||||
debug_log('Probing ' + data.direction + ' down to ' + data.dist + "mm at " + data.feedrate + "mm/min and then subtracting a plate of " + data.plate + "mm")
|
||||
status.machine.probe.request = data;
|
||||
status.machine.probe.x = 0.00;
|
||||
status.machine.probe.y = 0.00;
|
||||
status.machine.probe.z = 0.00;
|
||||
status.machine.probe.state = -1;
|
||||
status.machine.probe.plate = data.plate;
|
||||
switch (status.machine.firmware.type) {
|
||||
case 'grbl':
|
||||
addQToEnd('G21');
|
||||
addQToEnd('G10 P1 L20 Z0');
|
||||
addQToEnd('G38.2 Z-' + data.dist + ' F' + data.feedrate);
|
||||
send1Q();
|
||||
break;
|
||||
debug_log('ERROR: Unsupported firmware!');
|
||||
break;
|
||||
default:
|
||||
debug_log('ERROR: Unsupported firmware!');
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('jog', function(data) {
|
||||
debug_log('Jog ' + data);
|
||||
if (status.comms.connectionStatus > 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "OpenBuildsCONTROL",
|
||||
"version": "1.0.237",
|
||||
"version": "1.0.238",
|
||||
"license": "AGPL-3.0",
|
||||
"description": "OpenBuildsCONTROL CNC Machine Interface Software",
|
||||
"author": "github.com/openbuilds <webmaster@openbuilds.com>",
|
||||
|
|
Ładowanie…
Reference in New Issue