Checkpoint
This commit is contained in:
2
Makefile
2
Makefile
@@ -107,7 +107,7 @@ $(TARGET_DIR)/index.html: $(wildcard src/pug/templates/*)
|
|||||||
$(TARGET_DIR)/index.html: $(wildcard src/js/*)
|
$(TARGET_DIR)/index.html: $(wildcard src/js/*)
|
||||||
$(TARGET_DIR)/index.html: $(wildcard src/stylus/*)
|
$(TARGET_DIR)/index.html: $(wildcard src/stylus/*)
|
||||||
$(TARGET_DIR)/index.html: src/resources/config-template.json
|
$(TARGET_DIR)/index.html: src/resources/config-template.json
|
||||||
$(TARGET_DIR)/index.html: $(wildcard src/resources/onefinity_*_defaults.json)
|
$(TARGET_DIR)/index.html: $(wildcard src/resources/onefinity*defaults.json)
|
||||||
|
|
||||||
$(TARGET_DIR)/%.html: src/pug/%.pug node_modules
|
$(TARGET_DIR)/%.html: src/pug/%.pug node_modules
|
||||||
@mkdir -p $(shell dirname $@)
|
@mkdir -p $(shell dirname $@)
|
||||||
|
|||||||
@@ -37,7 +37,78 @@ module.exports = {
|
|||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
address: 0,
|
address: 0,
|
||||||
value: 0
|
value: 0,
|
||||||
|
toolList: [
|
||||||
|
{
|
||||||
|
id: "disabled",
|
||||||
|
name: "Disabled"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "router",
|
||||||
|
type: "PWM Spindle",
|
||||||
|
name: "Router (Makita, etc)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "laser",
|
||||||
|
type: "PWM Spindle",
|
||||||
|
name: "Laser (J Tech, etc)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "pwm",
|
||||||
|
name: "PWM Spindle"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "unsupported-separator",
|
||||||
|
name: "Unsupported Tools",
|
||||||
|
disabled: true,
|
||||||
|
unsupported: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "huanyang-vfd",
|
||||||
|
name: "Huanyang VFD",
|
||||||
|
unsupported: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "custom-modbus-vfd",
|
||||||
|
name: "Custom Modbus VFD",
|
||||||
|
unsupported: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "ac-tech-vfd",
|
||||||
|
name: "AC-Tech VFD",
|
||||||
|
unsupported: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "nowforever-vfd",
|
||||||
|
name: "Nowforever VFD",
|
||||||
|
unsupported: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "delta-vfd",
|
||||||
|
name: "Delta VFD015M21A (Beta)",
|
||||||
|
unsupported: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "yl600-vfd",
|
||||||
|
name: "YL600, YL620, YL620-A VFD (Beta)",
|
||||||
|
unsupported: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "fr-d700-vfd",
|
||||||
|
name: "FR-D700 (Beta)",
|
||||||
|
unsupported: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "sunfar-e300-vfd",
|
||||||
|
name: "Sunfar E300 (Beta)",
|
||||||
|
unsupported: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "omron-mx2-vfd",
|
||||||
|
name: "OMRON MX2",
|
||||||
|
unsupported: true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -69,23 +140,20 @@ module.exports = {
|
|||||||
return this.config.tool['tool-type'].toUpperCase();
|
return this.config.tool['tool-type'].toUpperCase();
|
||||||
},
|
},
|
||||||
|
|
||||||
show_tool_settings: function() {
|
selected_tool: function() {
|
||||||
return !(
|
return this.config.tool['selected-tool'].toUpperCase();
|
||||||
this.tool_type == "DISABLED" ||
|
|
||||||
this.is_laser
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
is_pwm_spindle: function() {
|
is_pwm_spindle: function () {
|
||||||
return this.tool_type == 'PWM SPINDLE';
|
return this.selected_tool == 'PWM';
|
||||||
},
|
},
|
||||||
|
|
||||||
is_laser: function() {
|
is_laser: function () {
|
||||||
return this.tool_type.includes("LASER");
|
return this.selected_tool.includes("LASER");
|
||||||
},
|
},
|
||||||
|
|
||||||
is_router: function() {
|
is_router: function () {
|
||||||
return this.tool_type.includes("ROUTER");
|
return this.selected_tool.includes("ROUTER");
|
||||||
},
|
},
|
||||||
|
|
||||||
is_modbus: function () {
|
is_modbus: function () {
|
||||||
@@ -99,6 +167,39 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
change_selected_tool: function(...args) {
|
||||||
|
const tool = this.toolList.find(tool => tool.id == this.config.tool['selected-tool']);
|
||||||
|
this.config.tool["tool-type"] = tool.type || tool.name;
|
||||||
|
|
||||||
|
console.log(this.config.tool["tool-type"]);
|
||||||
|
|
||||||
|
this.$dispatch("config-changed");
|
||||||
|
},
|
||||||
|
|
||||||
|
show_tool_settings: function (key) {
|
||||||
|
switch (true) {
|
||||||
|
case key === "tool-type":
|
||||||
|
case key === "selected-tool":
|
||||||
|
return false;
|
||||||
|
|
||||||
|
case this.selected_tool === "DISABLED":
|
||||||
|
case this.selected_tool.includes("LASER"):
|
||||||
|
return false;
|
||||||
|
|
||||||
|
case this.selected_tool.includes("ROUTER"):
|
||||||
|
switch (key) {
|
||||||
|
case "tool-enable-mode":
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
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']];
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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" :disabled="opt === '-----' ? true : false") {{opt}}
|
option(v-for="opt in template.values", track-by="$index", :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")
|
||||||
|
|||||||
@@ -31,14 +31,23 @@ script#tool-view-template(type="text/x-template")
|
|||||||
|
|
||||||
.pure-form.pure-form-aligned
|
.pure-form.pure-form-aligned
|
||||||
fieldset
|
fieldset
|
||||||
templated-input(v-for="templ in template.tool", :name="$key",
|
.pure-control-group
|
||||||
:model.sync="config.tool[$key]", :template="templ",
|
label(for="tool-type") tool-type
|
||||||
v-if="$key == 'tool-type' || show_tool_settings")
|
|
||||||
|
select(v-model="config.tool['selected-tool']", name="tool-type", @change="change_selected_tool")
|
||||||
|
option(v-for="tool in toolList", :value="tool.id", :disabled="tool.disabled") {{tool.name}}
|
||||||
|
|
||||||
|
templated-input(v-for="templ in template.tool",
|
||||||
|
:name="$key", v-if="show_tool_settings($key)"
|
||||||
|
:model.sync="config.tool[$key]", :template="templ")
|
||||||
|
|
||||||
label.extra(slot="extra", v-if="$key == 'tool-enable-mode' || $key == 'tool-direction-mode'")
|
label.extra(slot="extra", 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")
|
||||||
|
|
||||||
|
div(v-if="is_laser")
|
||||||
|
label Laser support is pre-configured, there are no user-adjustable settings.
|
||||||
|
|
||||||
fieldset(v-if="is_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']",
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import subprocess
|
|
||||||
import copy
|
|
||||||
from pkg_resources import Requirement, resource_filename
|
from pkg_resources import Requirement, resource_filename
|
||||||
|
|
||||||
|
|
||||||
@@ -55,14 +53,6 @@ class Config(object):
|
|||||||
except Exception: self.log.exception('Internal error: Failed to load config template')
|
except Exception: self.log.exception('Internal error: Failed to load config template')
|
||||||
|
|
||||||
|
|
||||||
def get(self, name, default = None):
|
|
||||||
return self.values.get(name, default)
|
|
||||||
|
|
||||||
|
|
||||||
def get_index(self, name, index, default = None):
|
|
||||||
return self.values.get(name, {}).get(str(index), None)
|
|
||||||
|
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
path = self.ctrl.get_path('config.json')
|
path = self.ctrl.get_path('config.json')
|
||||||
|
|
||||||
@@ -72,7 +62,7 @@ class Config(object):
|
|||||||
else: config = {'version': self.version}
|
else: config = {'version': self.version}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.upgrade(config)
|
self._upgrade(config)
|
||||||
except Exception: self.log.exception('Internal error: Failed to upgrade config')
|
except Exception: self.log.exception('Internal error: Failed to upgrade config')
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -83,6 +73,33 @@ class Config(object):
|
|||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
def reload(self):
|
||||||
|
self._update(self.load(), True)
|
||||||
|
|
||||||
|
|
||||||
|
def get(self, name, default = None):
|
||||||
|
return self.values.get(name, default)
|
||||||
|
|
||||||
|
|
||||||
|
def save(self, config):
|
||||||
|
self._upgrade(config)
|
||||||
|
self._update(config, False)
|
||||||
|
|
||||||
|
with open(self.ctrl.get_path('config.json'), 'w') as f:
|
||||||
|
json.dump(config, f, indent=2)
|
||||||
|
|
||||||
|
os.sync()
|
||||||
|
|
||||||
|
self.ctrl.preplanner.invalidate_all()
|
||||||
|
self.log.info('Saved')
|
||||||
|
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
if os.path.exists('config.json'): os.unlink('config.json')
|
||||||
|
self.reload()
|
||||||
|
self.ctrl.preplanner.invalidate_all()
|
||||||
|
|
||||||
|
|
||||||
def _valid_value(self, template, value):
|
def _valid_value(self, template, value):
|
||||||
type = template['type']
|
type = template['type']
|
||||||
|
|
||||||
@@ -136,7 +153,7 @@ class Config(object):
|
|||||||
self.__defaults(conf, name, tmpl)
|
self.__defaults(conf, name, tmpl)
|
||||||
|
|
||||||
|
|
||||||
def upgrade(self, config):
|
def _upgrade(self, config):
|
||||||
version = config['version']
|
version = config['version']
|
||||||
version = version.split('b')[0] # Strip off any "beta" suffix
|
version = version.split('b')[0] # Strip off any "beta" suffix
|
||||||
version = tuple(map(int, version.split('.'))) # Break it into a tuple of integers
|
version = tuple(map(int, version.split('.'))) # Break it into a tuple of integers
|
||||||
@@ -171,24 +188,6 @@ class Config(object):
|
|||||||
config['version'] = self.version.split('b')[0]
|
config['version'] = self.version.split('b')[0]
|
||||||
config['full_version'] = self.version
|
config['full_version'] = self.version
|
||||||
|
|
||||||
def save(self, config):
|
|
||||||
self.upgrade(config)
|
|
||||||
self._update(config, False)
|
|
||||||
|
|
||||||
with open(self.ctrl.get_path('config.json'), 'w') as f:
|
|
||||||
json.dump(config, f, indent=2)
|
|
||||||
|
|
||||||
os.sync()
|
|
||||||
|
|
||||||
self.ctrl.preplanner.invalidate_all()
|
|
||||||
self.log.info('Saved')
|
|
||||||
|
|
||||||
|
|
||||||
def reset(self):
|
|
||||||
if os.path.exists('config.json'): os.unlink('config.json')
|
|
||||||
self.reload()
|
|
||||||
self.ctrl.preplanner.invalidate_all()
|
|
||||||
|
|
||||||
|
|
||||||
def _encode(self, name, index, config, tmpl, with_defaults):
|
def _encode(self, name, index, config, tmpl, with_defaults):
|
||||||
# Handle category
|
# Handle category
|
||||||
@@ -238,6 +237,3 @@ class Config(object):
|
|||||||
for name, tmpl in self.template.items():
|
for name, tmpl in self.template.items():
|
||||||
conf = config.get(name, None)
|
conf = config.get(name, None)
|
||||||
self._encode(name, '', conf, tmpl, with_defaults)
|
self._encode(name, '', conf, tmpl, with_defaults)
|
||||||
|
|
||||||
|
|
||||||
def reload(self): self._update(self.load(), True)
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class Planner():
|
|||||||
'max-merge-error': deviation,
|
'max-merge-error': deviation,
|
||||||
'max-arc-error': deviation / 10,
|
'max-arc-error': deviation / 10,
|
||||||
'junction-accel': config.get('junction-accel'),
|
'junction-accel': config.get('junction-accel'),
|
||||||
}
|
}
|
||||||
|
|
||||||
# We place an upper limit of 1000 km/min^3 on jerk for MDI movements
|
# We place an upper limit of 1000 km/min^3 on jerk for MDI movements
|
||||||
if mdi:
|
if mdi:
|
||||||
|
|||||||
@@ -93,16 +93,15 @@ class State(object):
|
|||||||
observer.start()
|
observer.start()
|
||||||
|
|
||||||
|
|
||||||
#def is_metric(self): return self.get('units', 'METRIC') == 'METRIC'
|
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
# Init machine units
|
# Init machine units
|
||||||
metric = self.ctrl.config.get('units', 'METRIC').upper() == 'METRIC'
|
metric = self.ctrl.config.get('units', 'METRIC').upper() == 'METRIC'
|
||||||
self.log.info('INIT Metric %d' % metric)
|
self.log.info('INIT Metric %d' % metric)
|
||||||
if not 'metric' in self.vars: self.set('metric', metric)
|
if not 'metric' in self.vars: self.set('metric', metric)
|
||||||
if not 'imperial' in self.vars: self.set('imperial', not metric)
|
if not 'imperial' in self.vars: self.set('imperial', not metric)
|
||||||
#Bit diameter for probing
|
|
||||||
diameter = self.ctrl.config.get('probe-diameter',6.35)
|
# Bit diameter for probing
|
||||||
|
diameter = self.ctrl.config.get('probe-diameter', 6.35)
|
||||||
self.log.info('INIT Diameter %f' % diameter)
|
self.log.info('INIT Diameter %f' % diameter)
|
||||||
self.set('bitDiameter',diameter)
|
self.set('bitDiameter',diameter)
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,8 @@ class PasswordHandler(bbctrl.APIHandler):
|
|||||||
|
|
||||||
|
|
||||||
class ConfigLoadHandler(bbctrl.APIHandler):
|
class ConfigLoadHandler(bbctrl.APIHandler):
|
||||||
def get(self): self.write_json(self.get_ctrl().config.load())
|
def get(self):
|
||||||
|
self.write_json(self.get_ctrl().config.load())
|
||||||
|
|
||||||
|
|
||||||
class ConfigDownloadHandler(bbctrl.APIHandler):
|
class ConfigDownloadHandler(bbctrl.APIHandler):
|
||||||
|
|||||||
@@ -249,15 +249,15 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"tool": {
|
"tool": {
|
||||||
|
"selected-tool": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "disabled"
|
||||||
|
},
|
||||||
"tool-type": {
|
"tool-type": {
|
||||||
"type": "enum",
|
"type": "enum",
|
||||||
"values": [
|
"values": [
|
||||||
"Disabled",
|
"Disabled",
|
||||||
"-----",
|
|
||||||
"Router (Makita, etc)",
|
|
||||||
"J Tech Laser",
|
|
||||||
"PWM Spindle",
|
"PWM Spindle",
|
||||||
"-----",
|
|
||||||
"Huanyang VFD",
|
"Huanyang VFD",
|
||||||
"Custom Modbus VFD",
|
"Custom Modbus VFD",
|
||||||
"AC-Tech VFD",
|
"AC-Tech VFD",
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ span.unit
|
|||||||
height 12em
|
height 12em
|
||||||
|
|
||||||
> select, > input:not([type=checkbox])
|
> select, > input:not([type=checkbox])
|
||||||
min-width 200px
|
min-width 300px
|
||||||
|
|
||||||
> tt
|
> tt
|
||||||
min-width 15.25em
|
min-width 15.25em
|
||||||
@@ -1009,3 +1009,9 @@ tt.save
|
|||||||
label
|
label
|
||||||
font-size 16pt
|
font-size 16pt
|
||||||
align-self center
|
align-self center
|
||||||
|
|
||||||
|
.pure-form-aligned .pure-control-group label:not(.extra)
|
||||||
|
width 12em
|
||||||
|
|
||||||
|
.pure-form-aligned .pure-control-group label.extra
|
||||||
|
width 8em
|
||||||
|
|||||||
Reference in New Issue
Block a user