Added a popup to remind user to put away the probe

This commit is contained in:
David Carley
2021-03-06 00:02:32 -08:00
parent fd371f5189
commit 6f7853cc1f
3 changed files with 94 additions and 62 deletions

View File

@@ -385,10 +385,12 @@ module.exports = new Vue({
},
connect: function () {
this.sock = new Sock('//' + window.location.host + '/sockjs');
this.sock = new Sock(`//${location.host}/sockjs`);
this.sock.onmessage = function (e) {
if (typeof e.data != 'object') return;
this.sock.onmessage = (e) => {
if (typeof e.data != 'object') {
return;
}
if ('log' in e.data) {
this.$broadcast('log', e.data.log);
@@ -397,37 +399,44 @@ module.exports = new Vue({
// Check for session ID change on controller
if ('sid' in e.data) {
if (typeof this.sid == 'undefined') this.sid = e.data.sid;
else if (this.sid != e.data.sid) {
if (typeof this.hostname != 'undefined' &&
String(location.hostname) != 'localhost')
if (typeof this.sid == 'undefined') {
this.sid = e.data.sid;
} else if (this.sid != e.data.sid) {
if (typeof this.hostname !== 'undefined' && location.hostname !== 'localhost') {
location.hostname = this.hostname;
location.reload(true);
}
location.reload();
}
}
update_object(this.state, e.data, false);
if (this.state.pw === 0) {
Vue.set(this.state, "probe_connected", true);
Vue.set(this.state, "saw_probe_connected", true);
}
if (this.state.cycle === 'idle') {
if (this.state.wait_for_probing_complete) {
Vue.set(this.state, "wait_for_probing_complete", false);
Vue.set(this.state, "show_probe_complete_modal", true);
}
}
this.$broadcast('update');
};
}.bind(this)
this.sock.onopen = function (e) {
this.sock.onopen = () => {
this.status = 'connected';
this.$emit(this.status);
this.$broadcast(this.status);
}.bind(this)
};
this.sock.onclose = function (e) {
this.sock.onclose = () => {
this.status = 'disconnected';
this.$emit(this.status);
this.$broadcast(this.status);
}.bind(this)
};
},

View File

@@ -30,23 +30,10 @@
var api = require('./api');
var cookie = require('./cookie')('bbctrl-');
function _is_array(x) {
return Object.prototype.toString.call(x) === '[object Array]';
}
function escapeHTML(s) {
var entityMap = {'&': '&amp;', '<': '&lt;', '>': '&gt;'};
return String(s).replace(/[&<>]/g, function (s) {return entityMap[s];});
}
module.exports = {
template: '#control-view-template',
props: ['config', 'template', 'state'],
data: function () {
return {
mach_units: 'METRIC',
@@ -59,18 +46,40 @@ module.exports = {
history: [],
speed_override: 1,
feed_override: 1,
manual_home: {x: false, y: false, z: false, a: false, b: false, c: false},
position_msg: {x: false, y: false, z: false, a: false, b: false, c: false},
manual_home: {
x: false,
y: false,
z: false,
a: false,
b: false,
c: false
},
position_msg: {
x: false,
y: false,
z: false,
a: false,
b: false,
c: false
},
axis_position: 0,
jog_step: cookie.get_bool('jog-step'),
jog_adjust: parseInt(cookie.get('jog-adjust', 2)),
deleteGCode: false,
tab: 'auto',
jog_incr: 1.0,
probe_test: false,
tool_msg: false,
tool_diameter: 6.35,
toolpath_msg: {x: false, y: false, z: false, a: false, b: false, c: false},
show_probe_test_modal: false,
show_tool_diameter_modal: false,
show_probe_complete_modal: false,
toolpath_msg: {
x: false,
y: false,
z: false,
a: false,
b: false,
c: false
},
ask_home: true,
ask_home_msg: false,
ask_zero_xy_msg: false,
@@ -79,7 +88,6 @@ module.exports = {
}
},
components: {
'axis-control': require('./axis-control'),
'path-viewer': require('./path-viewer'),
@@ -256,18 +264,17 @@ module.exports = {
}
this.set_jog_incr('small');
},
start_probe_test: function(on_finish) {
this.probe_test = true;
Vue.set(this.state, "probe_connected", false);
this.show_probe_test_modal = true;
Vue.set(this.state, "saw_probe_connected", false);
Vue.set(this.state, "on_probe_finish", on_finish);
},
finish_probe_test: function() {
this.probe_test = false;
Vue.set(this.state, "probe_connected", false);
this.show_probe_test_modal = false;
Vue.set(this.state, "saw_probe_connected", false);
const on_finish = this.state.on_probe_finish;
Vue.set(this.state, "on_probe_finish", undefined);
@@ -275,15 +282,11 @@ module.exports = {
on_finish();
},
show_tool_diameter_prompt: function() {
this.tool_msg = true;
},
set_tool_diameter : function (new_diameter) {
if(isNaN(new_diameter))
return;
this.tool_msg = false;
this.show_tool_diameter_modal = false;
this.tool_diameter = parseFloat(new_diameter);
@@ -298,31 +301,30 @@ module.exports = {
document.getElementById("jog_button_medium").style.fontWeight = 'normal';
document.getElementById("jog_button_large").style.fontWeight = 'normal';
if(newValue == 'fine')
{
if (newValue == 'fine') {
document.getElementById("jog_button_fine").style.fontWeight = 'bold';
if(this.mach_units == 'METRIC')
this.jog_incr = 0.1;
else
this.jog_incr = 0.005;
} else if(newValue == 'small') {
} else if (newValue == 'small') {
document.getElementById("jog_button_small").style.fontWeight = 'bold';
if(this.mach_units == 'METRIC')
this.jog_incr = 1.0;
else
this.jog_incr = 0.05;
} else if(newValue == 'medium') {
} else if (newValue == 'medium') {
document.getElementById("jog_button_medium").style.fontWeight = 'bold';
if(this.mach_units == 'METRIC')
this.jog_incr = 10;
else
this.jog_incr = 0.5;
} else if(newValue == 'large') {
} else if (newValue == 'large') {
document.getElementById("jog_button_large").style.fontWeight = 'bold';
if(this.mach_units == 'METRIC')
this.jog_incr = 100;
else
this.jog_incr = 5;
this.jog_incr = (this.mach_units == 'METRIC')
? 100
: 5;
}
@@ -412,6 +414,8 @@ module.exports = {
M2
`);
setTimeout(() => Vue.set(this.state, "wait_for_probing_complete", true), 1000);
},
probe_z() {
@@ -445,6 +449,8 @@ module.exports = {
M2
`);
setTimeout(() => Vue.set(this.state, "wait_for_probing_complete", true), 1000);
},
jog_fn: function (x_jog,y_jog,z_jog,a_jog) {