Verison 1.0.5

This commit is contained in:
OneFinityCNC
2020-10-15 23:17:21 -04:00
parent 24dfa6c64d
commit 47af000045
20 changed files with 1282 additions and 56 deletions

View File

@@ -42,7 +42,8 @@ module.exports = {
confirmReset: false,
configReset: false,
latest: '',
autoCheckUpgrade: true
autoCheckUpgrade: true,
default_config: ''
}
},
@@ -72,13 +73,14 @@ module.exports = {
restore: function (e) {
debugger;
var files = e.target.files || e.dataTransfer.files;
if (!files.length) return;
var fr = new FileReader();
fr.onload = function (e) {
var config;
debugger;
try {
config = JSON.parse(e.target.result);
} catch (ex) {
@@ -98,6 +100,82 @@ module.exports = {
fr.readAsText(files[0]);
},
onefinity_woodworker_reset : function () {
var fr = new FileReader();
$.ajax({
type: 'GET',
url: 'onefinity_woodworker_defaults.json',
data: {hid: this.state.hid},
dataType: 'text',
cache: false
}).done(function (data) {
debugger;
//console.debug('>', data);
//this.default_config = data;
var config;
try {
config = JSON.parse(data);
} catch(ex) {
api.alert("Invalid default config file");
return;
}
api.put('config/save', config).done(function (data) {
this.confirmReset = false;
this.$dispatch('update');
this.configRestored = true;
}.bind(this)).fail(function (error) {
api.alert('Restore failed', error);
})
}.bind(this))
},
onefinity_machinist_reset : function () {
var fr = new FileReader();
$.ajax({
type: 'GET',
url: 'onefinity_machinist_defaults.json',
data: {hid: this.state.hid},
dataType: 'text',
cache: false
}).done(function (data) {
debugger;
//console.debug('>', data);
//this.default_config = data;
var config;
try {
config = JSON.parse(data);
} catch(ex) {
api.alert("Invalid default config file");
return;
}
api.put('config/save', config).done(function (data) {
this.confirmReset = false;
this.$dispatch('update');
this.configRestored = true;
}.bind(this)).fail(function (error) {
api.alert('Restore failed', error);
})
}.bind(this))
},
reset: function () {
this.confirmReset = false;

View File

@@ -117,7 +117,8 @@ module.exports = new Vue({
latestVersion: '',
password: '',
ipAddress: '0.0.0.0',
wifiSSID: ''
wifiSSID: '',
confirmShutdown: false
}
},
@@ -162,7 +163,7 @@ module.exports = new Vue({
$.ajax({
type: 'GET',
url: 'https://https://raw.githubusercontent.com/OneFinityCNC/onefinity/master/latest.txt',
url: 'https://raw.githubusercontent.com/OneFinityCNC/onefinity-release/master/latest.txt',
data: {hid: this.state.hid},
cache: false
@@ -308,6 +309,7 @@ module.exports = new Vue({
this.check_ip_address();
this.check_ssid();
}.bind(this))
},
@@ -321,7 +323,7 @@ module.exports = new Vue({
}).done(function (data) {
console.debug('>', data);
this.ipAddress = data;
this.ipAddress = 'IP:' + data;
this.$broadcast('ipAddress', data);
}.bind(this))
},
@@ -335,7 +337,7 @@ module.exports = new Vue({
}).done(function (data) {
console.debug('>', data);
this.wifiSSID = data;
this.wifiSSID = 'SSID:' + data;
this.$broadcast('wifiSSID', data);
}.bind(this))
},
@@ -349,6 +351,12 @@ module.exports = new Vue({
console.debug('get_ssid>', this.wifiSSID);
return this.wifiSSID;
},
shutdown : function() {
this.confirmShutdown = false;
api.put('shutdown');
},
connect: function () {
this.sock = new Sock('//' + window.location.host + '/sockjs');

View File

@@ -80,47 +80,41 @@ module.exports = {
var fault = this.state[motor_id + 'df'] & 0x1f;
var shutdown = this.state.power_shutdown;
var title;
var ticon = 'question-circle';
var tstate = 'NO FILE';
var toolmsg;
var tklass = (homed ? 'homed' : 'unhomed') + ' axis-' + axis;
if (fault || shutdown) {
state = shutdown ? 'SHUTDOWN' : 'FAULT';
klass += ' error';
icon = 'exclamation-circle';
} else if (0 < dim && dim < pathDim) {
state = 'NO FIT';
klass += ' error';
icon = 'ban';
} else if (homed) {
state = 'HOMED'
} else if(homed) {
state = 'HOMED';
icon = 'check-circle';
}
if (0 < dim && dim < pathDim) {
tstate = 'NO FIT';
tklass += ' error';
ticon = 'ban';
} else {
if (over || under) {
state = over ? 'OVER' : 'UNDER';
klass += ' warn';
icon = 'exclamation-circle';
tstate = over ? 'OVER' : 'UNDER';
tklass += ' warn';
ticon = 'exclamation-circle';
} else {
tstate = 'OK';
ticon = 'check-circle';
}
}
switch (state) {
case 'UNHOMED': title = 'Click the home button to home axis.'; break;
case 'HOMED': title = 'Axis successfuly homed.'; break;
case 'OVER':
title = 'Tool path would move ' +
this._length_str(pathMax + off - max) + ' beyond axis bounds.';
break;
case 'UNDER':
title = 'Tool path would move ' +
this._length_str(min - pathMin - off) + ' below axis bounds.';
break;
case 'NO FIT':
title = 'Tool path dimensions exceed axis dimensions by ' +
this._length_str(pathDim - dim) + '.';
break;
case 'FAULT':
title = 'Motor driver fault. A potentially damaging electrical ' +
'condition was detected and the motor driver was shutdown. ' +
@@ -128,12 +122,37 @@ module.exports = {
'See the "Motor Faults" table on the "Indicators" tab for more ' +
'information.';
break;
case 'SHUTDOWN':
title = 'Motor power fault. All motors in shutdown. ' +
'See the "Power Faults" table on the "Indicators" tab for more ' +
'information. Reboot controller to reset.';
}
switch(tstate) {
case 'OVER':
toolmsg = 'Caution: The current tool path file would move ' +
this._length_str(pathMax + off - max) + ' above axis limit with the current offset.';
break;
case 'UNDER':
toolmsg = 'Caution: The current tool path file would move ' +
this._length_str(min - pathMin - off) + ' below limit with the current offset.';
break;
case 'NO FIT':
toolmsg = 'Warning: The current tool path dimensions (' +
this._length_str(pathDim) + ') exceed axis dimensions (' +
this._length_str(dim) + ') by ' +
this._length_str(pathDim - dim) + '.';
break;
default:
toolmsg = 'Tool path ' + axis + ' dimensions OK.';
break;
}
return {
pos: abs - off,
@@ -152,7 +171,11 @@ module.exports = {
klass: klass,
state: state,
icon: icon,
title: title
title: title,
ticon: ticon,
tstate: tstate,
toolmsg: toolmsg,
tklass: tklass
}
},
@@ -194,6 +217,12 @@ module.exports = {
if (error) klass += ' error';
else if (warn) klass += ' warn';
if(!homed && this.ask_home)
{
this.ask_home_msg = true;
this.ask_home = false;
}
return {
homed: homed,
klass: klass

View File

@@ -60,8 +60,7 @@ module.exports = {
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},
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)),
@@ -69,7 +68,12 @@ module.exports = {
tab: 'auto',
jog_incr: 1.0,
tool_msg: false,
tool_diameter: 6.35
tool_diameter: 6.35,
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,
ask_zero_z_msg: false
}
},
@@ -303,7 +307,10 @@ module.exports = {
if(zero_z) zcmd = "Z0";
if(zero_a) acmd = "A0";
this.send('M70\nG90\nG0' + xcmd + ycmd + zcmd + acmd + '\nM72');
this.ask_zero_xy_msg = false;
this.ask_zero_z_msg = false;
this.send('G90\nG0' + xcmd + ycmd + zcmd + acmd + '\n');
},
probe_xyz() {
@@ -470,7 +477,7 @@ module.exports = {
console.log("Jog command: " + this.jog_incr);
//debugger;
this.send('M70\nG91\nG0' + xcmd + ycmd + zcmd + acmd + '\nM72');
this.send('G91\nG0' + xcmd + ycmd + zcmd + acmd + '\n');
},
send: function (msg) {this.$dispatch('send', msg)},
@@ -581,6 +588,10 @@ module.exports = {
home: function (axis) {
this.ask_home = false;
this.ask_home_msg = false;
if (typeof axis == 'undefined') api.put('home');
else {
@@ -606,6 +617,10 @@ module.exports = {
this.axis_position = 0;
this.position_msg[axis] = true;
},
show_toolpath_msg : function(axis) {
this.toolpath_msg[axis] = true;
},
set_position: function (axis, position) {