Merge branch '1.0.7-devel' into put-away-probe-modal

This commit is contained in:
OneFinityCNC
2021-03-06 11:58:20 -05:00
committed by GitHub
12 changed files with 157 additions and 144 deletions

View File

@@ -30,27 +30,39 @@
var api = require('./api');
var cookie = require('./cookie')('bbctrl-');
var Sock = require('./sock');
const { exec } = require('child_process');
function compare_versions(a, b) {
var reStripTrailingZeros = /(\.0+)+$/;
var segsA = a.replace(reStripTrailingZeros, '').split('.');
var segsB = b.replace(reStripTrailingZeros, '').split('.');
var l = Math.min(segsA.length, segsB.length);
function is_newer_version(current, latest) {
const pattern = /(\d+)\.(\d+)\.(\d+)(.*)/;
const currentParts = current.match(pattern);
const latestParts = latest.match(pattern);
for (var i = 0; i < l; i++) {
var diff = parseInt(segsA[i], 10) - parseInt(segsB[i], 10);
if (diff) return diff;
}
if (!currentParts || !latestParts) {
return false;
}
return segsA.length - segsB.length;
// Normal version comparisons
const major = latestParts[1] - currentParts[1];
const minor = latestParts[2] - currentParts[2];
const patch = latestParts[3] - currentParts[3];
// If current is a pre-release, and latest is a release
const betaToRelease = latestParts[4].length === 0 && currentParts[4].length > 0;
switch (true) {
case major > 0:
case major === 0 && minor > 0:
case major === 0 && minor === 0 && patch > 0:
case major === 0 && minor === 0 && patch === 0 && betaToRelease:
return true;
default:
return false;
}
}
function is_object(o) {return o !== null && typeof o == 'object'}
function is_array(o) {return Array.isArray(o)}
function update_array(dst, src) {
while (dst.length) dst.pop()
for (var i = 0; i < src.length; i++)
@@ -292,7 +304,7 @@ module.exports = new Vue({
show_upgrade: function () {
if (!this.latestVersion) return false;
return compare_versions(this.config.version, this.latestVersion) < 0;
return is_newer_version(this.config.version, this.latestVersion);
},
update: function () {

View File

@@ -348,68 +348,54 @@ module.exports = {
},
probe_xyz() {
let xoffset = this.config.probe["probe-xdim"];
let yoffset = this.config.probe["probe-ydim"];
let zoffset = this.config.probe["probe-zdim"];
let fastSeek = this.config.probe["probe-fast-seek"];
let slowSeek = this.config.probe["probe-slow-seek"];
const xdim = this.config.probe["probe-xdim"];
const ydim = this.config.probe["probe-ydim"];
const zdim = this.config.probe["probe-zdim"];
const slowSeek = this.config.probe["probe-slow-seek"];
const fastSeek = this.config.probe["probe-fast-seek"];
xoffset += this.tool_diameter / 2.0;
yoffset += this.tool_diameter / 2.0;
if (this.mach_units !== "METRIC") {
xoffset /= 25.4;
yoffset /= 25.4;
zoffset /= 25.4;
slowSeek /= 25.4;
fastSeek /= 25.4;
}
const zlift = 1;
const xoffset = xdim + (this.tool_diameter / 2.0);
const yoffset = ydim + (this.tool_diameter / 2.0);
const zoffset = zdim;
const metric = this.mach_units == "METRIC";
const mm = n => (metric ? n : n / 25.4).toFixed(5);
const speed = s => `F${mm(s)}`;
// After probing Z, we want to drop the bit down:
// Ideally, 12.7mm/0.5in
// And we don't want to be more than 75% down on the probe block
let plunge = Math.min(12.7, zoffset * 0.75);
plunge += zlift; // Compensate for the fact that we lift after probing Z
xoffset = xoffset.toFixed(5);
yoffset = yoffset.toFixed(5);
zoffset = zoffset.toFixed(5);
slowSeek = slowSeek.toFixed(5);
fastSeek = fastSeek.toFixed(5);
plunge = plunge.toFixed(5);
slowSeek = `F${slowSeek}`;
fastSeek = `F${fastSeek}`;
// Also, add zlift to compensate for the fact that we lift after probing Z
const plunge = Math.min(12.7, zoffset * 0.75) + zlift;
this.send(`
G21
${metric ? "G21" : "G20"}
G92 X0 Y0 Z0
G38.2 Z -25.4 ${fastSeek}
G91 G1 Z 1
G38.2 Z -2 ${slowSeek}
G92 Z ${zoffset}
G38.2 Z ${mm(-25.4)} ${speed(fastSeek)}
G91 G1 Z ${mm(1)}
G38.2 Z ${mm(-2)} ${speed(slowSeek)}
G92 Z ${mm(zoffset)}
G91 G0 Z ${zlift}
G91 G0 X 20
G91 G0 Z -${plunge}
G38.2 X -20 ${fastSeek}
G91 G1 X 1
G38.2 X -2 ${slowSeek}
G92 X ${xoffset}
G91 G0 Z ${mm(zlift)}
G91 G0 X ${mm(20)}
G91 G0 Z ${mm(-plunge)}
G38.2 X ${mm(-20)} ${speed(fastSeek)}
G91 G1 X ${mm(1)}
G38.2 X ${mm(-2)} ${speed(slowSeek)}
G92 X ${mm(xoffset)}
G91 G0 X 1
G91 G0 Y 20
G91 G0 X -20
G38.2 Y -20 ${fastSeek}
G91 G1 Y 1
G38.2 Y -2 ${slowSeek}
G92 Y ${yoffset}
G91 G0 X ${mm(1)}
G91 G0 Y ${mm(20)}
G91 G0 X ${mm(-20)}
G38.2 Y ${mm(-20)} ${speed(fastSeek)}
G91 G1 Y ${mm(1)}
G38.2 Y ${mm(-2)} ${speed(slowSeek)}
G92 Y ${mm(yoffset)}
G91 G0 Y 3
G91 G0 Z 25.4
G91 G0 Y ${mm(3)}
G91 G0 Z ${mm(25.4)}
G90 G0 X0 Y0
M2
@@ -419,33 +405,28 @@ module.exports = {
},
probe_z() {
let fastSeek = this.config.probe["probe-fast-seek"];
let slowSeek = this.config.probe["probe-slow-seek"];
let zoffset = this.config.probe["probe-zdim"];
if (this.mach_units !== "METRIC") {
zoffset /= 25.4;
slowSeek /= 25.4;
fastSeek /= 25.4;
}
const xdim = this.config.probe["probe-xdim"];
const ydim = this.config.probe["probe-ydim"];
const zdim = this.config.probe["probe-zdim"];
const slowSeek = this.config.probe["probe-slow-seek"];
const fastSeek = this.config.probe["probe-fast-seek"];
zoffset = zoffset.toFixed(5);
slowSeek = slowSeek.toFixed(5);
fastSeek = fastSeek.toFixed(5);
const zoffset = zdim;
slowSeek = `F${slowSeek}`;
fastSeek = `F${fastSeek}`;
const metric = this.mach_units == "METRIC";
const mm = n => (metric ? n : n / 25.4).toFixed(5);
const speed = s => `F${mm(s)}`;
this.send(`
G21
${metric ? "G21" : "G20"}
G92 Z0
G38.2 Z -25.4 ${fastSeek}
G91 G1 Z 1
G38.2 Z -2 ${slowSeek}
G92 Z ${zoffset}
G38.2 Z ${mm(-25.4)} ${speed(fastSeek)}
G91 G1 Z ${mm(1)}
G38.2 Z ${mm(-2)} ${speed(slowSeek)}
G92 Z ${mm(zoffset)}
G91 G0 Z3
G91 G0 Z ${mm(3)}
M2
`);

View File

@@ -113,7 +113,7 @@ html(lang="en")
a.upgrade-version(v-if="show_upgrade()", href="#admin-general")
| Upgrade to v{{latestVersion}}
.fa.fa-check(v-if="!show_upgrade() && latestVersion",
title="Firmware up to date")
title="Firmware up to date" style="font-size: inherit")
.p {{get_ip_address()}} {{get_ssid()}}
.estop(:class="{active: state.es}")

View File

@@ -79,7 +79,7 @@ script#control-view-template(type="text/x-template")
table(width="99%")
tr
td(style="white-space: nowrap;")
table(table-layout="fixed")
table.control-buttons(table-layout="fixed")
colgroup
col(style="width:100px")
col(style="width:100px")
@@ -88,11 +88,13 @@ script#control-view-template(type="text/x-template")
col(style="width:100px")
tr
td(style="height:100px",align="center")
button(style="height:100px;width:100px",@click="jog_fn(-1,1,0,0)") &#x2b01
button(style="height:100px;width:100px",@click="jog_fn(-1,1,0,0)")
.fa.fa-arrow-right(style="transform: rotate(-135deg);")
td(style="height:100px",align="center")
button(style="height:100px;width:100px",@click="jog_fn(0,1,0,0)") Y+
td(style="height:100px",align="center")
button(style="height:100px;width:100px",@click="jog_fn(1,1,0,0)") &#x2b00
button(style="height:100px;width:100px",@click="jog_fn(1,1,0,0)")
.fa.fa-arrow-right(style="transform: rotate(-45deg);")
td
td(style="height:100px",align="center")
button(style="height:100px;width:100px",,@click="jog_fn(0,0,1,0)") Z+
@@ -101,7 +103,7 @@ script#control-view-template(type="text/x-template")
button(style="height:100px;width:100px",@click="jog_fn(-1,0,0,0)") X-
td(style="height:100px",align="center")
button(style="height:100px;width:100px",@click="ask_zero_xy_msg = true")
.fa.fa-bullseye
.fa.fa-bullseye(style="font-size: 172%")
td(style="height:100px",align="center")
button(style="height:100px;width:100px",@click="jog_fn(1,0,0,0)") X+
td
@@ -109,11 +111,13 @@ script#control-view-template(type="text/x-template")
button(style="height:100px;width:100px",@click='ask_zero_z_msg = true') Z0
tr
td(style="height:100px",align="center")
button(style="height:100px;width:100px",@click="jog_fn(-1,-1,0,0)") &#x2b03
button(style="height:100px;width:100px",@click="jog_fn(-1,-1,0,0)")
.fa.fa-arrow-right(style="transform: rotate(135deg);")
td(style="height:100px",align="center")
button(style="height:100px;width:100px",@click="jog_fn(0,-1,0,0)") Y-
td(style="height:100px",align="center")
button(style="height:100px;width:100px",@click="jog_fn(1,-1,0,0)") &#x2b02
button(style="height:100px;width:100px",@click="jog_fn(1,-1,0,0)")
.fa.fa-arrow-right(style="transform: rotate(45deg);")
td
td(style="height:100px",align="center")
button(style="height:100px;width:100px",@click="jog_fn(0,0,-1,0)") Z-
@@ -130,7 +134,8 @@ script#control-view-template(type="text/x-template")
//th.tstate Max
th.actions
button.pure-button(:disabled="!can_set_axis",
title="Zero all axis offsets.", @click="zero()",style="height:60px;width:60px") &empty;
title="Zero all axis offsets.", @click="zero()",style="height:60px;width:60px")
.fa.fa-map-marker
button.pure-button(title="Home all axes.", @click="home()",
:disabled="!is_idle",style="height:60px;width:60px")
@@ -170,7 +175,8 @@ script#control-view-template(type="text/x-template")
button.pure-button(:disabled="!can_set_axis",
title=`Zero {{'${axis}' | upper}} axis offset.`,
@click=`zero('${axis}')`,style="height:60px;width:60px") &empty;
@click=`zero('${axis}')`,style="height:60px;width:60px")
.fa.fa-map-marker
button.pure-button(:disabled="!is_idle", @click=`home('${axis}')`,
title=`Home {{'${axis}' | upper}} axis.`,style="height:60px;width:60px")
@@ -220,7 +226,7 @@ script#control-view-template(type="text/x-template")
title=`Home {{'${axis}' | upper}} axis.`,
@click=`set_home('${axis}', axis_position)`) Set
tr
td(style="white-space: nowrap;")
td.control-buttons(style="white-space: nowrap;")
button(style="height:100px;width:100px;font-weight:normal",id="jog_button_fine",@click=`set_jog_incr('fine')`) 0.1
button(style="height:100px;width:100px;font-weight:bold",id="jog_button_small",@click=`set_jog_incr('small')`) 1.0
button(style="height:100px;width:100px;font-weight:normal",id="jog_button_medium",@click=`set_jog_incr('medium')`) 10
@@ -305,8 +311,10 @@ script#control-view-template(type="text/x-template")
label {{(progress || 0) | percent}}
.bar(:style="'width:' + (progress || 0) * 100 + '%'")
tr
td(style="white-space: nowrap;text-align:center")
message(:show.sync=`show_probe_test_modal`)
h3(slot="header") Test probe connection
div(slot="body")
@@ -406,12 +414,11 @@ script#control-view-template(type="text/x-template")
input(type="file", @change="upload", :disabled="!is_ready",
accept="text/*,.nc,.gcode,.gc,.ngc,.txt,.tap,.cnc")
a.pure-button(:disabled="!state.selected", download,
:href="'/api/file/' + state.selected",
title="Download the selected GCode program.",style="height:100px;width:100px")
br
br
.fa.fa-download
a(:disabled="!state.selected", download,
:href="'/api/file/' + state.selected",
title="Download the selected GCode program.")
button.pure-button(style="height:100px;width:100px")
.fa.fa-download
button.pure-button(title="Delete current GCode program.",
@click="deleteGCode = true",

View File

@@ -63,7 +63,7 @@ script#settings-view-template(type="text/x-template")
- var base = '//linuxcnc.org/docs/html/gcode/g-code.html'
p.
GCode commands
#[a(href=base + "#gcode:g61-g61.1", target="_blank") G61, G61.1] and
#[a(href=base + "#gcode:g61", target="_blank") G61, G61.1] and
#[a(href=base + "#gcode:g64", target="_blank") G64] also affect path
planning accuracy.

View File

@@ -141,35 +141,23 @@ class Config(object):
version = version.split('b')[0] # Strip off any "beta" suffix
version = tuple(map(int, version.split('.'))) # Break it into a tuple of integers
if version < (0, 2, 4):
if version < (1, 0, 7):
config['settings']['max-deviation'] = 0.001
config['settings']['junction-accel'] = 200000
for motor in config['motors']:
for key in 'max-jerk max-velocity'.split():
if key in motor: motor[key] /= 1000
if version < (0, 3, 4):
for motor in config['motors']:
for key in 'max-accel latch-velocity search-velocity'.split():
if key in motor: motor[key] /= 1000
if version <= (0, 3, 22):
if 'tool' in config:
if 'spindle-type' in config['tool']:
type = config['tool']['spindle-type']
if type == 'PWM': type = 'PWM Spindle'
if type == 'Huanyang': type = 'Huanyang VFD'
config['tool']['tool-type'] = type
del config['tool']['spindle-type']
if 'spin-reversed' in config['tool']:
reversed = config['tool']['spin-reversed']
config['tool']['tool-reversed'] = reversed
del config['tool']['spin-reversed']
if version <= (0, 4, 6):
for motor in config['motors']:
if 2 < motor.get('idle-current', 0): motor['idle-current'] = 2
if 'enabled' not in motor:
motor['enabled'] = motor.get('power-mode', '') != 'disabled'
motor['stall-microstep'] = 8
motor['stall-current'] = 1
motor['max-accel'] = 750
if motor['axis'] == 'X' or motor['axis'] == 'Y':
motor['search-velocity'] = 1.688
motor['max-velocity'] = 10
motor['max-jerk'] = 15000
motor['zero-backoff'] = 1.5
if motor['axis'] == 'Z':
motor['search-velocity'] = 0.675
motor['max-velocity'] = 3
motor['max-jerk'] = 1000
motor['zero-backoff'] = 1
config['version'] = self.version

View File

@@ -50,9 +50,15 @@ axis_homing_procedure = '''
G90 G28.3 %(axis)s[#<_%(axis)s_home_position>]
'''
# The stepper drivers have a stall flag that is reset
# by moving the motors without a stall condition.
# The "wiggle" in the stall procedure is to clear the flag.
# This was to correct the issue where the stepper motors
# may already be in a stall condition when homing is started.
# For example, if a user tried to home twice in a row
# the second homing attempt would immediately think it
# was stalled if we didn't first back it up a bit
stall_homing_procedure = '''
G91 G1 %(axis)s [#<_%(axis)s_zero_backoff> * -1] F[#<_%(axis)s_search_velocity>]
G4 P0.25
G91 G1 %(axis)s [#<_%(axis)s_zero_backoff>] F[#<_%(axis)s_search_velocity>]
G4 P0.25
G28.2 %(axis)s0 F[#<_%(axis)s_search_velocity>]
@@ -275,11 +281,13 @@ class Mach(Comm):
# Home axis
self.mlog.info('Homing %s axis' % axis)
self._begin_cycle('homing')
if mode.startswith('stall-'): procedure = stall_homing_procedure
else: procedure = axis_homing_procedure
self.planner.mdi(procedure % {'axis': axis}, False)
# self.planner.mdi(axis_homing_procedure % {'axis': axis}, False)
gcode = procedure % {'axis': axis}
self.planner.mdi(gcode, False)
super().resume()

View File

@@ -96,6 +96,12 @@ class Planner():
'junction-accel': config.get('junction-accel'),
}
# We place an upper limit of 1000 km/min^3 on jerk for MDI movements
if mdi:
for axis in 'xyzabc':
if axis in cfg['max-jerk']:
cfg['max-jerk'][axis] = min(1000 * 1000000, cfg['max-jerk'][axis])
if with_limits:
minLimit = state.get_soft_limit_vector('tn', -math.inf)
maxLimit = state.get_soft_limit_vector('tm', math.inf)

View File

@@ -12,8 +12,6 @@
"min": 0.001,
"max": 100,
"unit": "mm",
"iunit": "in",
"scale": 25.4,
"default": 0.1
},
"junction-accel": {
@@ -23,8 +21,6 @@
"min": 10000,
"max": 100000000,
"unit": "mm/min²",
"iunit": "in/min²",
"scale": 25.4,
"default": 200000
}
},

View File

@@ -16,7 +16,7 @@
"probe": {
"probe-ydim": 53.975,
"probe-slow-seek": 25,
"probe-fast-seek": 100,
"probe-fast-seek": 75,
"probe-zdim": 15.4,
"probe-xdim": 53.975
},
@@ -27,7 +27,7 @@
"load-2": "disabled"
},
"settings": {
"junction-accel": 199999.999,
"junction-accel": 200000,
"max-deviation": 0.001,
"units": "METRIC"
},

View File

@@ -16,7 +16,7 @@
"probe": {
"probe-ydim": 53.975,
"probe-slow-seek": 25,
"probe-fast-seek": 100,
"probe-fast-seek": 75,
"probe-zdim": 15.4,
"probe-xdim": 53.975
},
@@ -27,7 +27,7 @@
"load-2": "disabled"
},
"settings": {
"junction-accel": 199999.999,
"junction-accel": 200000,
"max-deviation": 0.001,
"units": "METRIC"
},

View File

@@ -120,6 +120,12 @@ tt
.success
background green
.fa
font-size 150%
.modal-mask .fa
font-size inherit
.fa.error
background inherit
color red
@@ -252,6 +258,17 @@ span.unit
table
border-collapse collapse
// Make sure buttons don't turn into circles
button
-webkit-appearance none
border-radius 2px
border-width 1px
border-color darkgrey
// The jogging buttons, etc.
.control-buttons button
font-size 150%
&:first-child
margin 0.5em 0
@@ -330,7 +347,6 @@ span.unit
text-align left
.fa
font-size 140%
margin-left 2px
margin-right 6px
@@ -341,7 +357,6 @@ span.unit
text-align left
.fa
font-size 140%
margin-left 2px
margin-right 6px