stop and go

This commit is contained in:
Martin Fuchs
2026-08-16 15:54:30 +02:00
parent 0a0b8b19dc
commit 606752fbec
4 changed files with 1033 additions and 683 deletions
+16 -6
View File
@@ -53,16 +53,20 @@ Keyboard controls. Call from `setup()`. No arguments.
| `← → ↑ ↓` | Jog one step, pen up |
| `Shift + arrows` | Jog one step, pen down |
| `+` / `-` | Jog step size 1–100 mm |
| `L` `R` `T` `B` | Mark left / right / top / bottom bound at current position |
### `enablePlotButtons(options?)`
Adds Plot and Test buttons. Expects global `plot()` and `test()` in the sketch.
Adds Connect, Plot, and Test buttons. Expects global `plot()` and `test()` in the sketch.
**Connect** is shown only while disconnected (same as key **C**). While a path is running, Plot becomes **Pause**; while paused it becomes **Resume**. Test becomes **Stop** during a test.
| Option | Default | What it is |
|--------|---------|------------|
| `parentId` | `'wallplotter-controls'` | DOM id for the button row |
| `plotLabel` | `'Plot'` | Plot button text |
| `connectLabel` | `'Connect'` | Connect button text |
| `plotLabel` | `'Plot'` | Plot button text when idle |
| `pauseLabel` | `'Pause'` | Plot button while a path is running |
| `resumeLabel` | `'Resume'` | Plot button while paused |
| `testLabel` | `'Test'` | Test button text |
| `stopLabel` | `'Stop'` | Test button while a test is running |
@@ -146,7 +150,13 @@ Returns estimated duration in **milliseconds** for the current path buffer, or f
### `stopPath()` / `stopPlot()`
`stopPath()` aborts the current `runPath`. `stopPlot()` also sends Marlin `M410` (quick stop) during a live plot. Key **S** calls `stopPlot()` while plotting.
`stopPath()` aborts the current `runPath` and unblocks any wait for Marlin `ok`.
`stopPlot()` **halts and pauses** so **Resume** can continue from the current position (live plot: `M410` quick-stop, then `M114`). Key **S** and a Marlin `ok` timeout do the same. **S** / Stop again while paused aborts the run.
### `pausePlot()` / `resumePlot()`
**Pause** waits for the current segment to finish, then lifts the pen. **Stop** / timeout interrupt the current move immediately. Both leave the Plot button as **Resume**. Elapsed / remaining HUD time freezes while paused.
---
@@ -169,7 +179,7 @@ Write one G-code line and wait for Marlin `ok`.
- `line` (string): command without newline, e.g. `'M114'`.
- `options.allowWithoutHome` (boolean): allow `G0`/`G1` before home. Default `false`.
- `options.waitOk` (boolean): wait for `ok`. Default `true`.
- `options.timeoutMs` (number): `ok` timeout, default `300000`.
- `options.timeoutMs` (number): `ok` timeout. Default **15000**. `M400` / `G4` use a longer timeout based on the move or dwell. After 1s with no `ok`, the log shows `waiting for Marlin ok` and the HUD says **Waiting for plotter…**. During a plot, a timeout **pauses** so **Resume** can continue; **S** / Stop does the same.
### `penUp(force?)` / `penDown(force?)`
@@ -209,7 +219,7 @@ Relative move in mm.
| `x`, `y` | Current position, mm |
| `isPenDown` | Pen state |
| `isPlotting` | `runPath` in progress |
| `isPaused` | `runPath` is paused |
| `feedRateTravel` / `feedRateDraw` | Current speeds, mm/min |
| `timingMultiplier` | Preview wait scale |
| `stepSize` | Jog step, mm |
| `drawBounds` | `{ left, right, top, bottom }` or `null` |