From cf5c60da38657aa3abd7db50726429296eea702a Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sun, 16 Aug 2026 16:31:48 +0200 Subject: [PATCH] stop fix --- lib/README.md | 2 +- lib/WallPlotter.js | 24 ++++++++---------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/lib/README.md b/lib/README.md index ebfa4a0..3ba74f6 100644 --- a/lib/README.md +++ b/lib/README.md @@ -152,7 +152,7 @@ Returns estimated duration in **milliseconds** for the current path buffer, or f `stopPath()` aborts the current `runPath` and unblocks any wait for Marlin `ok`. -`stopPlot()` first press is the same as **Pause**: finish the current stroke, then **Resume** continues. Second press is an emergency `M410` quick-stop. That leaves belt length unknown on a polargraph, so **home is cleared** — jog to origin and press **H** before plotting again. An `ok` timeout pauses the same way (no `M410`); that segment is skipped. +`stopPlot()` first press is the same as **Pause**: finish the current stroke, then **Resume** continues. Second press stops the browser from sending more moves. The **in-flight** `G1` still runs — this firmware does not have `EMERGENCY_PARSER`, so `M410` cannot interrupt motion (and on a polargraph it desyncs belts). Unplug power for a hard stop. ### `pausePlot()` / `resumePlot()` diff --git a/lib/WallPlotter.js b/lib/WallPlotter.js index d14e435..ce8c6c3 100644 --- a/lib/WallPlotter.js +++ b/lib/WallPlotter.js @@ -354,27 +354,19 @@ class WallPlotter { /** * First press: pause after the current stroke (safe to Resume). - * Second press: emergency M410 — home is cleared, do not resume. + * Second press: stop sending more moves. The in-flight G1 still finishes + * (Marlin has no emergency parser). Do not send M410 — it cannot interrupt + * a running move, and on a polargraph it desyncs belt lengths. */ async stopPlot() { const hadWait = this._okResolvers.length > 0; if (this.isPlotting && this.isPaused) { this.stopPath(); - if (this.connected && !this._plotTestOnly) { - try { - await this.send('M410', { waitOk: false, allowWithoutHome: true }); - } catch (_) { - /* port may be busy */ - } - this.homeSet = false; - this._okIgnoreUntil = performance.now() + 1500; - this._homeWarning = 'Re-home (H) after emergency stop — position is unknown'; - this.statusText = this._homeWarning; - } else { - this.statusText = 'Stopped'; - } - this.onLog('plot aborted — set home before plotting again'); + this.statusText = 'Stopped — current stroke may still finish'; + this.onLog( + 'plot aborted — motors finish the in-flight move (unplug power for a hard stop)' + ); return; } @@ -1517,7 +1509,7 @@ class WallPlotter { 'H set current pos as home (G92) — required first', '0 go to origin (0, 0)', 'P toggle pen (test up/down angles)', - 'S stop after current stroke (S again = e-stop, re-home)', + 'S stop sending (in-flight stroke still finishes)', 'C connect / disconnect', ]; for (let i = 0; i < help.length; i++) {