Fixed imperial probing

This commit is contained in:
David Carley
2021-03-16 09:33:40 -07:00
parent 77d064badc
commit a5474f7086
3 changed files with 36 additions and 25 deletions

View File

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

View File

@@ -100,8 +100,7 @@ script#control-view-template(type="text/x-template")
.pure-form
.pure-control-group
label="{{metric ? 'Diameter (mm)' : 'Diameter (inches)'}}"
input(v-model="tool_diameter",size="8",
@keyup.enter=`set_tool_diameter(tool_diameter)`)
input(v-model="tool_diameter_for_prompt", size="8")
p
div(slot="footer")
@@ -109,7 +108,7 @@ script#control-view-template(type="text/x-template")
| Cancel
button.pure-button.button-success(
@click=`set_tool_diameter(tool_diameter)`)
@click=`set_tool_diameter`)
| Set
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")
button(:class="state['pw'] ? '' : 'load-on'",
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
td(style="height:100px", align="center", colspan="2")
button(:class="state['pw'] ? '' : 'load-on'",

View File

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