control: skip redundant aux/home in Home All when W is mapped to A

When the auxcnc axis is integrated as a virtual machine axis via
ExternalAxis (synthetic motor 4 enabled), Mach.home(None) already
homes the external axis as it iterates xyzabc. The legacy 'home W
last' path in home_all() then fired PUT /api/aux/home a second time,
causing the A axis to home twice on Home All.

Skip the trailing aux/home when state['4me'] is set; keep the
fallback for setups where aux is enabled but not integrated as a
virtual axis.
This commit is contained in:
2026-05-03 11:58:08 +02:00
parent 3b622d3d17
commit f545438fa8

View File

@@ -258,6 +258,11 @@ module.exports = {
// Home every enabled axis (legacy Onefinity "Home All"). Sequence:
// 1. Z, X, Y (and A/B/C if enabled) via /api/home on the AVR
// 2. W axis via /api/aux/home on the ESP
// ONLY when the auxcnc axis is not integrated as a virtual
// machine axis. With the gplan W-as-A integration
// (synthetic motor 4 enabled), Mach.home() already homes
// the external axis as part of the xyzabc pass — calling
// aux/home afterwards would home it a second time.
// /api/home returns as soon as the request is queued, not when
// homing completes, so we have to watch state.cycle:
// - first wait for it to *leave* 'idle' (cycle began),
@@ -274,6 +279,11 @@ module.exports = {
}
if (!this.w || !this.w.enabled) return;
// When the synthetic external motor (index 4) is enabled,
// the auxcnc axis is mapped onto a real machine axis letter
// (e.g. A) and was already homed by /api/home above.
if (this.state && this.state["4me"]) return;
const wait = (ms) => new Promise(r => setTimeout(r, ms));
const cycleNow = () => (this.state && this.state.cycle) || "idle";