Merge pull request #43 from dacarley/fix-imperial-probing

Fixed imperial probing
This commit is contained in:
OneFinityCNC
2021-03-17 00:38:15 -04:00
committed by GitHub
3 changed files with 36 additions and 25 deletions

View File

@@ -69,6 +69,7 @@ module.exports = {
tab: 'auto', tab: 'auto',
jog_incr: 1.0, jog_incr: 1.0,
tool_diameter: 6.35, tool_diameter: 6.35,
tool_diameter_for_prompt: 6.35,
show_probe_test_modal: false, show_probe_test_modal: false,
show_tool_diameter_modal: false, show_tool_diameter_modal: false,
show_probe_complete_modal: false, show_probe_complete_modal: false,
@@ -105,12 +106,7 @@ module.exports = {
'state.bitDiameter': { 'state.bitDiameter': {
handler: function (bitDiameter) { handler: function (bitDiameter) {
if(this.mach_units == 'IMPERIAL') {
this.tool_diameter = bitDiameter / 25.4;
}
else {
this.tool_diameter = bitDiameter; this.tool_diameter = bitDiameter;
}
}, },
immediate: true immediate: true
}, },
@@ -123,21 +119,29 @@ module.exports = {
this.units_changed(); this.units_changed();
}, },
'state.line': function () { 'state.line': function () {
if (this.mach_state != 'HOMING') if (this.mach_state != 'HOMING')
this.$broadcast('gcode-line', this.state.line); this.$broadcast('gcode-line', this.state.line);
}, },
'state.selected_time': function () {
this.load();
},
'state.selected_time': function () {this.load()}, jog_step: function () {
jog_step: function () {cookie.set_bool('jog-step', this.jog_step)}, cookie.set_bool('jog-step', this.jog_step);
jog_adjust: function () {cookie.set('jog-adjust', this.jog_adjust)} },
jog_adjust: function () {
cookie.set('jog-adjust', this.jog_adjust);
}
}, },
computed: { computed: {
metric: function () {return !this.state.imperial}, metric: function () {
return !this.state.imperial;
},
mach_state: function () { mach_state: function () {
@@ -243,24 +247,17 @@ module.exports = {
methods: { methods: {
units_changed : function() { units_changed : function() {
console.log("Units changed!");
if(this.mach_units == 'METRIC') { if(this.mach_units == 'METRIC') {
document.getElementById("jog_button_fine").innerHTML = "0.1"; document.getElementById("jog_button_fine").innerHTML = "0.1";
document.getElementById("jog_button_small").innerHTML = "1.0"; document.getElementById("jog_button_small").innerHTML = "1.0";
document.getElementById("jog_button_medium").innerHTML = "10"; document.getElementById("jog_button_medium").innerHTML = "10";
document.getElementById("jog_button_large").innerHTML = "100"; document.getElementById("jog_button_large").innerHTML = "100";
this.tool_diameter = this.tool_diameter * 25.4;
this.tool_diameter = this.tool_diameter.toFixed(3);
} else { } else {
document.getElementById("jog_button_fine").innerHTML = "0.005"; document.getElementById("jog_button_fine").innerHTML = "0.005";
document.getElementById("jog_button_small").innerHTML = "0.05"; document.getElementById("jog_button_small").innerHTML = "0.05";
document.getElementById("jog_button_medium").innerHTML = "0.5"; document.getElementById("jog_button_medium").innerHTML = "0.5";
document.getElementById("jog_button_large").innerHTML = "5"; document.getElementById("jog_button_large").innerHTML = "5";
this.tool_diameter = this.tool_diameter / 25.4;
this.tool_diameter = this.tool_diameter.toFixed(3);
} }
this.set_jog_incr('small'); this.set_jog_incr('small');
@@ -282,13 +279,28 @@ module.exports = {
on_finish(); on_finish();
}, },
set_tool_diameter : function (new_diameter) { prep_and_show_tool_diameter_modal() {
if(isNaN(new_diameter)) this.tool_diameter_for_prompt = (this.mach_units == 'METRIC')
? this.tool_diameter
: this.tool_diameter / 25.4;
this.tool_diameter_for_prompt = this.tool_diameter_for_prompt.toFixed(3).replace(/0+$/, "");
this.show_tool_diameter_modal = true;
},
set_tool_diameter() {
this.tool_diameter = parseFloat(this.tool_diameter_for_prompt);
if (!isFinite(this.tool_diameter)) {
return; return;
}
this.show_tool_diameter_modal = false; this.show_tool_diameter_modal = false;
this.tool_diameter = parseFloat(new_diameter); if (this.mach_units !== "METRIC") {
this.tool_diameter *= 25.4;
}
this.probe_xyz(); this.probe_xyz();
}, },

View File

@@ -100,8 +100,7 @@ script#control-view-template(type="text/x-template")
.pure-form .pure-form
.pure-control-group .pure-control-group
label="{{metric ? 'Diameter (mm)' : 'Diameter (inches)'}}" label="{{metric ? 'Diameter (mm)' : 'Diameter (inches)'}}"
input(v-model="tool_diameter",size="8", input(v-model="tool_diameter_for_prompt", size="8")
@keyup.enter=`set_tool_diameter(tool_diameter)`)
p p
div(slot="footer") div(slot="footer")
@@ -109,7 +108,7 @@ script#control-view-template(type="text/x-template")
| Cancel | Cancel
button.pure-button.button-success( button.pure-button.button-success(
@click=`set_tool_diameter(tool_diameter)`) @click=`set_tool_diameter`)
| Set | Set
message(:show.sync=`state.show_probe_complete_modal`) message(:show.sync=`state.show_probe_complete_modal`)
@@ -177,7 +176,7 @@ script#control-view-template(type="text/x-template")
td(style="height:100px", align="center", colspan="2") td(style="height:100px", align="center", colspan="2")
button(:class="state['pw'] ? '' : 'load-on'", button(:class="state['pw'] ? '' : 'load-on'",
style="height:100px;width:200px", style="height:100px;width:200px",
@click=`start_probe_test(() => { show_tool_diameter_modal = true })`) @click=`start_probe_test(prep_and_show_tool_diameter_modal)`)
| Probe XYZ | Probe XYZ
td(style="height:100px", align="center", colspan="2") td(style="height:100px", align="center", colspan="2")
button(:class="state['pw'] ? '' : 'load-on'", button(:class="state['pw'] ? '' : 'load-on'",

View File

@@ -461,7 +461,7 @@
"probe-diameter": { "probe-diameter": {
"type": "float", "type": "float",
"min": 0, "min": 0,
"max": 10, "max": 25.4,
"unit": "mm", "unit": "mm",
"default": 6.35 "default": 6.35
}, },