WIP: laser tool support
This commit is contained in:
@@ -30,12 +30,10 @@
|
|||||||
var api = require('./api');
|
var api = require('./api');
|
||||||
var modbus = require('./modbus.js');
|
var modbus = require('./modbus.js');
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
template: '#tool-view-template',
|
template: '#tool-view-template',
|
||||||
props: ['config', 'template', 'state'],
|
props: ['config', 'template', 'state'],
|
||||||
|
|
||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
address: 0,
|
address: 0,
|
||||||
@@ -43,15 +41,14 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
components: {
|
||||||
components: {'modbus-reg': require('./modbus-reg.js')},
|
'modbus-reg': require('./modbus-reg.js')
|
||||||
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
'state.mr': function () { this.value = this.state.mr }
|
'state.mr': function () { this.value = this.state.mr }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'input-changed': function () {
|
'input-changed': function () {
|
||||||
this.$dispatch('config-changed');
|
this.$dispatch('config-changed');
|
||||||
@@ -59,58 +56,81 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ready: function () {
|
||||||
ready: function () {this.value = this.state.mr},
|
this.value = this.state.mr;
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
regs_tmpl: function () {return this.template['modbus-spindle'].regs},
|
regs_tmpl: function () {
|
||||||
tool_type: function () {return this.config.tool['tool-type'].toUpperCase()},
|
return this.template['modbus-spindle'].regs;
|
||||||
|
},
|
||||||
|
|
||||||
|
tool_type: function () {
|
||||||
|
return this.config.tool['tool-type'].toUpperCase();
|
||||||
|
},
|
||||||
|
|
||||||
|
show_tool_settings: function() {
|
||||||
|
return !(
|
||||||
|
this.tool_type == "DISABLED" ||
|
||||||
|
this.is_laser
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
is_pwm_spindle: function() {
|
||||||
|
return this.tool_type == 'PWM SPINDLE';
|
||||||
|
},
|
||||||
|
|
||||||
|
is_laser: function() {
|
||||||
|
return this.tool_type.includes("LASER");
|
||||||
|
},
|
||||||
|
|
||||||
|
is_router: function() {
|
||||||
|
return this.tool_type.includes("ROUTER");
|
||||||
|
},
|
||||||
|
|
||||||
is_modbus: function () {
|
is_modbus: function () {
|
||||||
return this.tool_type != 'DISABLED' && this.tool_type != 'PWM SPINDLE'
|
return this.tool_type != 'DISABLED' &&
|
||||||
|
!this.is_pwm_spindle && !this.is_laser && !this.is_router;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
modbus_status: function () {
|
||||||
modbus_status: function () {return modbus.status_to_string(this.state.mx)}
|
return modbus.status_to_string(this.state.mx);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
get_reg_type: function (reg) {
|
get_reg_type: function (reg) {
|
||||||
return this.regs_tmpl.template['reg-type'].values[this.state[reg + 'vt']]
|
return this.regs_tmpl.template['reg-type'].values[this.state[reg + 'vt']];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get_reg_addr: function (reg) {
|
||||||
|
return this.state[reg + 'va'];
|
||||||
|
},
|
||||||
|
|
||||||
get_reg_addr: function (reg) {return this.state[reg + 'va']},
|
get_reg_value: function (reg) {
|
||||||
get_reg_value: function (reg) {return this.state[reg + 'vv']},
|
return this.state[reg + 'vv'];
|
||||||
|
},
|
||||||
|
|
||||||
get_reg_fails: function (reg) {
|
get_reg_fails: function (reg) {
|
||||||
var fails = this.state[reg + 'vr']
|
var fails = this.state[reg + 'vr']
|
||||||
return fails == 255 ? 'Max' : fails;
|
return fails == 255 ? 'Max' : fails;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
show_modbus_field: function (key) {
|
show_modbus_field: function (key) {
|
||||||
return key != 'regs' &&
|
return key != 'regs' &&
|
||||||
(key != 'multi-write' || this.tool_type == 'CUSTOM MODBUS VFD');
|
(key != 'multi-write' || this.tool_type == 'CUSTOM MODBUS VFD');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
read: function (e) {
|
read: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
api.put('modbus/read', { address: this.address });
|
api.put('modbus/read', { address: this.address });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
write: function (e) {
|
write: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
api.put('modbus/write', { address: this.address, value: this.value });
|
api.put('modbus/write', { address: this.address, value: this.value });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
customize: function (e) {
|
customize: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.config.tool['tool-type'] = 'Custom Modbus VFD';
|
this.config.tool['tool-type'] = 'Custom Modbus VFD';
|
||||||
@@ -126,7 +146,6 @@ module.exports = {
|
|||||||
this.$dispatch('config-changed');
|
this.$dispatch('config-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
clear: function (e) {
|
clear: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.config.tool['tool-type'] = 'Custom Modbus VFD';
|
this.config.tool['tool-type'] = 'Custom Modbus VFD';
|
||||||
@@ -141,7 +160,6 @@ module.exports = {
|
|||||||
this.$dispatch('config-changed');
|
this.$dispatch('config-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
reset_failures: function (e) {
|
reset_failures: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var regs = this.config['modbus-spindle'].regs;
|
var regs = this.config['modbus-spindle'].regs;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ script#templated-input-template(type="text/x-template")
|
|||||||
|
|
||||||
select(v-if="template.type == 'enum' || template.values", v-model="view",
|
select(v-if="template.type == 'enum' || template.values", v-model="view",
|
||||||
:name="name", @change="change")
|
:name="name", @change="change")
|
||||||
option(v-for="opt in template.values", :value="opt") {{opt}}
|
option(v-for="opt in template.values", :value="opt" :disabled="opt === '-----' ? true : false") {{opt}}
|
||||||
|
|
||||||
input(v-if="template.type == 'bool'", type="checkbox", v-model="view",
|
input(v-if="template.type == 'bool'", type="checkbox", v-model="view",
|
||||||
:name="name", @change="change")
|
:name="name", @change="change")
|
||||||
|
|||||||
@@ -33,14 +33,13 @@ script#tool-view-template(type="text/x-template")
|
|||||||
fieldset
|
fieldset
|
||||||
templated-input(v-for="templ in template.tool", :name="$key",
|
templated-input(v-for="templ in template.tool", :name="$key",
|
||||||
:model.sync="config.tool[$key]", :template="templ",
|
:model.sync="config.tool[$key]", :template="templ",
|
||||||
v-if="tool_type != 'DISABLED' || $key == 'tool-type'")
|
v-if="$key == 'tool-type' || show_tool_settings")
|
||||||
|
|
||||||
label.extra(slot="extra",
|
label.extra(slot="extra", v-if="$key == 'tool-enable-mode' || $key == 'tool-direction-mode'")
|
||||||
v-if="$key == 'tool-enable-mode' || $key == 'tool-direction-mode'")
|
|
||||||
| Pin {{templ.pin}}
|
| Pin {{templ.pin}}
|
||||||
io-indicator(:name="$key", :state="state")
|
io-indicator(:name="$key", :state="state")
|
||||||
|
|
||||||
fieldset(v-if="tool_type == 'PWM SPINDLE'")
|
fieldset(v-if="is_pwm_spindle")
|
||||||
h2 PWM Spindle
|
h2 PWM Spindle
|
||||||
templated-input(v-for="templ in template['pwm-spindle']",
|
templated-input(v-for="templ in template['pwm-spindle']",
|
||||||
:name="$key", :model.sync="config['pwm-spindle'][$key]",
|
:name="$key", :model.sync="config['pwm-spindle'][$key]",
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
"default": true
|
"default": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"motors": {
|
"motors": {
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"index": "0123",
|
"index": "0123",
|
||||||
@@ -250,10 +251,23 @@
|
|||||||
"tool": {
|
"tool": {
|
||||||
"tool-type": {
|
"tool-type": {
|
||||||
"type": "enum",
|
"type": "enum",
|
||||||
"values": ["Disabled", "PWM Spindle", "Huanyang VFD", "Custom Modbus VFD",
|
"values": [
|
||||||
"AC-Tech VFD", "Nowforever VFD", "Delta VFD015M21A (Beta)",
|
"Disabled",
|
||||||
"YL600, YL620, YL620-A VFD (Beta)", "FR-D700 (Beta)",
|
"-----",
|
||||||
"Sunfar E300 (Beta)", "OMRON MX2"],
|
"Router (Makita, etc)",
|
||||||
|
"J Tech Laser",
|
||||||
|
"PWM Spindle",
|
||||||
|
"-----",
|
||||||
|
"Huanyang VFD",
|
||||||
|
"Custom Modbus VFD",
|
||||||
|
"AC-Tech VFD",
|
||||||
|
"Nowforever VFD",
|
||||||
|
"Delta VFD015M21A (Beta)",
|
||||||
|
"YL600, YL620, YL620-A VFD (Beta)",
|
||||||
|
"FR-D700 (Beta)",
|
||||||
|
"Sunfar E300 (Beta)",
|
||||||
|
"OMRON MX2"
|
||||||
|
],
|
||||||
"default": "Disabled",
|
"default": "Disabled",
|
||||||
"code": "st"
|
"code": "st"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user