UI: render W (aux) axis row in the main DRO
Adds the auxcnc W axis to the front-page Position table:
- axis-vars.js exposes a 'w' computed property fed by state.aux_pos /
aux_enabled / aux_homed / aux_present (set by AuxAxis on the host).
No motor mapping, no soft-limit warnings - the aux controller does
its own bounds.
- control-view.pug adds a W row after the xyzabc loop. The Set/Zero
button calls /api/aux/set-zero {mm:0} and the Home button calls
/api/aux/home, which hit the new endpoints exposed by Web.py.
- control-view.js: aux_home(), aux_set_zero(), and aux_jog() helpers.
When aux_enabled is false (no aux.json or aux.json has enabled=false)
the row stays hidden, matching the existing axis-row behavior.
This commit is contained in:
@@ -32,6 +32,10 @@ module.exports = {
|
||||
return this._compute_axis("c");
|
||||
},
|
||||
|
||||
w: function() {
|
||||
return this._compute_aux_axis();
|
||||
},
|
||||
|
||||
axes: function() {
|
||||
return this._compute_axes();
|
||||
}
|
||||
@@ -203,6 +207,52 @@ module.exports = {
|
||||
return false;
|
||||
},
|
||||
|
||||
_compute_aux_axis: function() {
|
||||
// Virtual W axis driven by the auxcnc ESP32. Position, homed
|
||||
// flag and presence come from the bbctrl AuxAxis driver via
|
||||
// state.aux_*. No motor mapping, no soft-limit warnings on
|
||||
// toolpath bounds (auxcnc enforces its own).
|
||||
const enabled = !!this.state.aux_enabled;
|
||||
const present = !!this.state.aux_present;
|
||||
const homed = !!this.state.aux_homed;
|
||||
const pos = this.state.aux_pos || 0;
|
||||
|
||||
let klass = `${homed ? "homed" : "unhomed"} axis-w`;
|
||||
let state = present ? "UNHOMED" : "OFFLINE";
|
||||
let icon = present ? "question-circle" : "plug";
|
||||
let title = present
|
||||
? "Click the home button to home W axis."
|
||||
: "Aux controller not connected on /dev/ttyUSB0.";
|
||||
if (homed) {
|
||||
state = "HOMED";
|
||||
icon = "check-circle";
|
||||
title = "W axis successfully homed.";
|
||||
} else if (!present) {
|
||||
klass += " error";
|
||||
}
|
||||
|
||||
return {
|
||||
pos: pos,
|
||||
abs: pos,
|
||||
off: 0,
|
||||
min: 0, max: 0, dim: 0,
|
||||
pathMin: 0, pathMax: 0, pathDim: 0,
|
||||
motor: -1,
|
||||
enabled: enabled,
|
||||
homingMode: "limit-switch",
|
||||
homed: homed,
|
||||
klass: klass,
|
||||
state: state,
|
||||
icon: icon,
|
||||
title: title,
|
||||
ticon: "check-circle",
|
||||
tstate: "OK",
|
||||
toolmsg: "W axis is not constrained by tool path bounds.",
|
||||
tklass: `${homed ? "homed" : "unhomed"} axis-w`,
|
||||
isAux: true,
|
||||
};
|
||||
},
|
||||
|
||||
_compute_axes: function() {
|
||||
let homed = false;
|
||||
|
||||
|
||||
@@ -765,6 +765,24 @@ module.exports = {
|
||||
api.put(`home/${axis}/clear`);
|
||||
},
|
||||
|
||||
aux_home: function () {
|
||||
api.put("aux/home").catch(function (err) {
|
||||
console.error("W home failed:", err);
|
||||
});
|
||||
},
|
||||
|
||||
aux_set_zero: function () {
|
||||
api.put("aux/set-zero", { mm: 0 }).catch(function (err) {
|
||||
console.error("W set-zero failed:", err);
|
||||
});
|
||||
},
|
||||
|
||||
aux_jog: function (delta_mm) {
|
||||
api.put("aux/jog", { mm: delta_mm }).catch(function (err) {
|
||||
console.error("W jog failed:", err);
|
||||
});
|
||||
},
|
||||
|
||||
show_set_position: function (axis) {
|
||||
SvelteComponents.showDialog("SetAxisPosition", { axis });
|
||||
},
|
||||
|
||||
@@ -191,6 +191,28 @@ script#control-view-template(type="text/x-template")
|
||||
button.pure-button(:disabled="!is_idle", @click=`home('${axis}')`,
|
||||
title=`Home {{'${axis}' | upper}} axis.`, style="height:60px;width:60px")
|
||||
.fa.fa-home
|
||||
|
||||
// Auxiliary W axis (auxcnc ESP32 over /dev/ttyUSB0)
|
||||
tr.axis(:class="w.klass", v-if="w.enabled", :title="w.title")
|
||||
th.name w
|
||||
td.position: unit-value(:value="w.pos", precision=4)
|
||||
td.absolute: unit-value(:value="w.abs", precision=3)
|
||||
td.offset —
|
||||
td.state
|
||||
.fa(:class="'fa-' + w.icon")
|
||||
| {{w.state}}
|
||||
td.tstate(:class="w.tklass", :title="w.toolmsg")
|
||||
.fa(:class="'fa-' + w.ticon")
|
||||
| {{w.tstate}}
|
||||
|
||||
th.actions
|
||||
button.pure-button(title="Set W axis position to 0.",
|
||||
@click="aux_set_zero()", style="height:60px;width:60px")
|
||||
.fa.fa-map-marker
|
||||
|
||||
button.pure-button(:disabled="!w.enabled", @click="aux_home()",
|
||||
title="Home W axis.", style="height:60px;width:60px")
|
||||
.fa.fa-home
|
||||
|
||||
tr(style="vertical-align: top;")
|
||||
td
|
||||
|
||||
Reference in New Issue
Block a user