Merge pull request #54 from dacarley/x50-defaults

Added defaults for the new X-50 models
This commit is contained in:
OneFinityCNC
2021-10-09 00:15:52 -04:00
committed by GitHub
8 changed files with 713 additions and 99 deletions

View File

@@ -107,8 +107,7 @@ $(TARGET_DIR)/index.html: $(wildcard src/pug/templates/*)
$(TARGET_DIR)/index.html: $(wildcard src/js/*)
$(TARGET_DIR)/index.html: $(wildcard src/stylus/*)
$(TARGET_DIR)/index.html: src/resources/config-template.json
$(TARGET_DIR)/index.html: src/resources/onefinity_woodworker_defaults.json
$(TARGET_DIR)/index.html: src/resources/onefinity_machinist_defaults.json
$(TARGET_DIR)/index.html: $(wildcard src/resources/onefinity_*_defaults.json)
$(TARGET_DIR)/%.html: src/pug/%.pug node_modules
@mkdir -p $(shell dirname $@)

View File

@@ -27,15 +27,18 @@
'use strict'
const api = require('./api');
var api = require('./api');
async function fetchJSON(url, options) {
const response = await fetch(url, options);
return response.json();
}
module.exports = {
template: '#admin-general-view-template',
props: ['config', 'state'],
data: function () {
return {
configRestored: false,
@@ -43,27 +46,25 @@ module.exports = {
configReset: false,
latest: '',
autoCheckUpgrade: true,
default_config: ''
reset_variant: ''
}
},
events: {
latest_version: function (version) {this.latest = version}
latest_version: function (version) {
this.latest = version
}
},
ready: function () {
this.autoCheckUpgrade = this.config.admin['auto-check-upgrade']
},
methods: {
backup: function () {
document.getElementById('download-target').src = '/api/config/download';
},
restore_config: function () {
// If we don't reset the form the browser may cache file if name is same
// even if contents have changed
@@ -71,7 +72,6 @@ module.exports = {
$('.restore-config input').click();
},
restore: function (e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length) return;
@@ -98,92 +98,37 @@ 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) {
var config;
reset: async function () {
const fetchConfig = async () => {
try {
config = JSON.parse(data);
} catch(ex) {
return await fetchJSON(`onefinity_${this.reset_variant}_defaults.json`);
} catch (err) {
api.alert("Invalid default config file");
return;
console.error('Invalid default config file', err);
return undefined;
}
}
api.put('config/save', config).done(function (data) {
this.confirmReset = false;
const config = await fetchConfig();
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) {
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;
api.put('config/reset').done(function () {
try {
await api.put('config/save', config)
this.confirmReset = false;
this.$dispatch('update');
this.configReset = true;
}.bind(this)).fail(function (error) {
api.alert('Reset failed', error);
});
this.configRestored = true;
} catch (err) {
api.alert('Restore failed');
console.error('Restore failed', err);
}
},
check: function () {
this.$dispatch('check')
},
check: function () {this.$dispatch('check')},
upgrade: function () {this.$dispatch('upgrade')},
upgrade: function () {
this.$dispatch('upgrade')
},
upload_firmware: function () {
// If we don't reset the form the browser may cache file if name is same
@@ -192,14 +137,12 @@ module.exports = {
$('.upload-firmware input').click();
},
upload: function (e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length) return;
this.$dispatch('upload', files[0]);
},
change_auto_check_upgrade: function () {
this.config.admin['auto-check-upgrade'] = this.autoCheckUpgrade;
this.$dispatch('config-changed');

View File

@@ -53,14 +53,22 @@ script#admin-general-view-template(type="text/x-template")
message(:show.sync="confirmReset")
h3(slot="header") Reset to default configuration?
p(slot="body") Non-network configuration changes will be lost.
p(slot="body") Select defaults to restore
p(slot="body")
button.pure-button.button-success(@click="onefinity_woodworker_reset") Woodworker
button.pure-button.button-success(@click="onefinity_machinist_reset") Machinist
p(slot="body") Select defaults to restore:
p.reset-variants(slot="body")
input#tab1(type="radio", name="reset_variant" @click="reset_variant = 'machinist_x35'")
label(for="tab1", title="Machinist X-35") Machinist X-35
input#tab2(type="radio", name="reset_variant" @click="reset_variant = 'woodworker_x35'")
label(for="tab2", title="Woodworker X-35") Woodworker X-35
input#tab3(type="radio", name="reset_variant" @click="reset_variant = 'woodworker_x50'")
label(for="tab3", title="Woodworker X-50") Woodworker X-50
input#tab4(type="radio", name="reset_variant" @click="reset_variant = 'journeyman_x50'")
label(for="tab4", title="Journeyman X-50") Journeyman X-50
div(slot="footer")
button.pure-button(@click="confirmReset = false") Cancel
button.pure-button.pure-button-primary(@click="reset") Reset
message(:show.sync="configReset")
h3(slot="header") Success
@@ -71,5 +79,3 @@ script#admin-general-view-template(type="text/x-template")
button.pure-button.pure-button-primary View Log
a(href="/api/bugreport")
button.pure-button.pure-button-primary Bug Report

View File

@@ -0,0 +1,325 @@
{
"tool": {
"tool-reversed": false,
"tool-enable-mode": "disabled",
"tool-direction-mode": "disabled",
"tool-type": "PWM Spindle",
"min-spin": 0,
"max-spin": 255
},
"switches": {
"switch-lockout": 250,
"estop": "disabled",
"switch-debounce": 5,
"probe": "normally-open"
},
"probe": {
"probe-ydim": 53.975,
"probe-slow-seek": 25,
"probe-fast-seek": 75,
"probe-zdim": 15.4,
"probe-xdim": 53.975
},
"version": "1.0.4",
"outputs": {
"load-1": "disabled",
"fault": "disabled",
"load-2": "disabled"
},
"settings": {
"junction-accel": 200000,
"max-deviation": 0.05,
"units": "METRIC",
"probing-prompts": true
},
"motors": [
{
"latch-velocity": 0.1,
"max-accel": 750,
"max-velocity": 10,
"search-velocity": 1.688,
"travel-per-rev": 16,
"idle-current": 1,
"drive-current": 2.8,
"latch-backoff": 5,
"enabled": true,
"homing-mode": "stall-min",
"reverse": false,
"stall-microstep": 8,
"min-soft-limit": 0,
"max-switch": "disabled",
"step-angle": 1.8,
"stall-current": 1,
"stall-sample-time": 200,
"microsteps": 16,
"stall-volts": 2,
"axis": "X",
"min-switch": "disabled",
"max-jerk": 1000,
"max-soft-limit": 1220,
"zero-backoff": 1.5
},
{
"latch-velocity": 0.1,
"max-accel": 750,
"max-velocity": 10,
"search-velocity": 1.688,
"travel-per-rev": 10,
"idle-current": 1,
"drive-current": 2.8,
"latch-backoff": 5,
"enabled": true,
"homing-mode": "stall-min",
"reverse": false,
"stall-microstep": 8,
"min-soft-limit": 0,
"max-switch": "disabled",
"step-angle": 1.8,
"stall-current": 1,
"stall-sample-time": 200,
"microsteps": 16,
"stall-volts": 2,
"axis": "Y",
"min-switch": "disabled",
"max-jerk": 1000,
"max-soft-limit": 816,
"zero-backoff": 1.5
},
{
"latch-velocity": 0.1,
"max-accel": 750,
"max-velocity": 10,
"search-velocity": 1.688,
"travel-per-rev": 10,
"idle-current": 1,
"drive-current": 2.8,
"latch-backoff": 5,
"enabled": true,
"homing-mode": "stall-min",
"reverse": false,
"stall-microstep": 8,
"min-soft-limit": 0,
"max-switch": "disabled",
"step-angle": 1.8,
"stall-current": 1,
"stall-sample-time": 200,
"microsteps": 16,
"stall-volts": 2,
"axis": "Y",
"min-switch": "disabled",
"max-jerk": 1000,
"max-soft-limit": 816,
"zero-backoff": 1.5
},
{
"latch-velocity": 0.1,
"max-accel": 750,
"max-velocity": 3,
"search-velocity": 0.675,
"travel-per-rev": 4,
"idle-current": 1,
"drive-current": 2.8,
"latch-backoff": 5,
"enabled": true,
"homing-mode": "stall-max",
"reverse": true,
"stall-microstep": 8,
"min-soft-limit": -133,
"max-switch": "disabled",
"step-angle": 1.8,
"stall-current": 1,
"stall-sample-time": 200,
"microsteps": 16,
"stall-volts": 2,
"axis": "Z",
"min-switch": "disabled",
"max-jerk": 1000,
"max-soft-limit": 0,
"zero-backoff": 1
}
],
"modbus-spindle": {
"baud": "9600",
"multi-write": false,
"regs": [
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
}
],
"bus-id": "1",
"parity": "None"
},
"pwm-spindle": {
"pwm-min-duty": 1,
"pwm-inverted": false,
"pwm-max-duty": 99.99,
"pwm-freq": 1000,
"dynamic-power": true,
"rapid-auto-off": true
},
"admin": {
"auto-check-upgrade": true
},
"gcode": {
"program-start": "(Runs at program start)\nG90 (Absolute distance mode)\nG17 (Select XY plane)\n",
"tool-change": "(Runs on M6, tool change)\nM70\nG21\nS0\nM0 M6 (MSG, Change tool and attach probe)\nF100\n(probe to minimum z soft limit, which is -10)\nG38.2 Z-10\nG92 Z15.4\ng0 Z30\nM0 (MSG, Remove probe, start spindle)\nM72\n\n",
"program-end": "(Runs on M2, program end)\nM2"
}
}

View File

@@ -0,0 +1,325 @@
{
"tool": {
"tool-reversed": false,
"tool-enable-mode": "disabled",
"tool-direction-mode": "disabled",
"tool-type": "PWM Spindle",
"min-spin": 0,
"max-spin": 255
},
"switches": {
"switch-lockout": 250,
"estop": "disabled",
"switch-debounce": 5,
"probe": "normally-open"
},
"probe": {
"probe-ydim": 53.975,
"probe-slow-seek": 25,
"probe-fast-seek": 75,
"probe-zdim": 15.4,
"probe-xdim": 53.975
},
"version": "1.0.4",
"outputs": {
"load-1": "disabled",
"fault": "disabled",
"load-2": "disabled"
},
"settings": {
"junction-accel": 200000,
"max-deviation": 0.05,
"units": "METRIC",
"probing-prompts": true
},
"motors": [
{
"latch-velocity": 0.1,
"max-accel": 750,
"max-velocity": 10,
"search-velocity": 1.688,
"travel-per-rev": 16,
"idle-current": 1,
"drive-current": 2.8,
"latch-backoff": 5,
"enabled": true,
"homing-mode": "stall-min",
"reverse": false,
"stall-microstep": 8,
"min-soft-limit": 0,
"max-switch": "disabled",
"step-angle": 1.8,
"stall-current": 1,
"stall-sample-time": 200,
"microsteps": 16,
"stall-volts": 2,
"axis": "X",
"min-switch": "disabled",
"max-jerk": 1000,
"max-soft-limit": 816,
"zero-backoff": 1.5
},
{
"latch-velocity": 0.1,
"max-accel": 750,
"max-velocity": 10,
"search-velocity": 1.688,
"travel-per-rev": 10,
"idle-current": 1,
"drive-current": 2.8,
"latch-backoff": 5,
"enabled": true,
"homing-mode": "stall-min",
"reverse": false,
"stall-microstep": 8,
"min-soft-limit": 0,
"max-switch": "disabled",
"step-angle": 1.8,
"stall-current": 1,
"stall-sample-time": 200,
"microsteps": 16,
"stall-volts": 2,
"axis": "Y",
"min-switch": "disabled",
"max-jerk": 1000,
"max-soft-limit": 816,
"zero-backoff": 1.5
},
{
"latch-velocity": 0.1,
"max-accel": 750,
"max-velocity": 10,
"search-velocity": 1.688,
"travel-per-rev": 10,
"idle-current": 1,
"drive-current": 2.8,
"latch-backoff": 5,
"enabled": true,
"homing-mode": "stall-min",
"reverse": false,
"stall-microstep": 8,
"min-soft-limit": 0,
"max-switch": "disabled",
"step-angle": 1.8,
"stall-current": 1,
"stall-sample-time": 200,
"microsteps": 16,
"stall-volts": 2,
"axis": "Y",
"min-switch": "disabled",
"max-jerk": 1000,
"max-soft-limit": 816,
"zero-backoff": 1.5
},
{
"latch-velocity": 0.1,
"max-accel": 750,
"max-velocity": 3,
"search-velocity": 0.675,
"travel-per-rev": 4,
"idle-current": 1,
"drive-current": 2.8,
"latch-backoff": 5,
"enabled": true,
"homing-mode": "stall-max",
"reverse": true,
"stall-microstep": 8,
"min-soft-limit": -133,
"max-switch": "disabled",
"step-angle": 1.8,
"stall-current": 1,
"stall-sample-time": 200,
"microsteps": 16,
"stall-volts": 2,
"axis": "Z",
"min-switch": "disabled",
"max-jerk": 1000,
"max-soft-limit": 0,
"zero-backoff": 1
}
],
"modbus-spindle": {
"baud": "9600",
"multi-write": false,
"regs": [
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
},
{
"reg-type": "disabled",
"reg-value": 0,
"reg-addr": 0
}
],
"bus-id": "1",
"parity": "None"
},
"pwm-spindle": {
"pwm-min-duty": 1,
"pwm-inverted": false,
"pwm-max-duty": 99.99,
"pwm-freq": 1000,
"dynamic-power": true,
"rapid-auto-off": true
},
"admin": {
"auto-check-upgrade": true
},
"gcode": {
"program-start": "(Runs at program start)\nG90 (Absolute distance mode)\nG17 (Select XY plane)\n",
"tool-change": "(Runs on M6, tool change)\nM70\nG21\nS0\nM0 M6 (MSG, Change tool and attach probe)\nF100\n(probe to minimum z soft limit, which is -10)\nG38.2 Z-10\nG92 Z15.4\ng0 Z30\nM0 (MSG, Remove probe, start spindle)\nM72\n\n",
"program-end": "(Runs on M2, program end)\nM2"
}
}

View File

@@ -993,3 +993,19 @@ tt.save
.tab_container
width 98%
.reset-variants
padding-left 40px
padding-bottom 20px
display grid
grid-template-rows repeat(4, auto)
grid-template-columns min-content auto
grid-gap 20px 10px
input[type="radio"]
width 30px
height 30px
label
font-size 16pt
align-self center