@meshbench/client 0.0.1 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/device.mjs CHANGED
@@ -46,6 +46,14 @@ export class Device {
46
46
  * Held rather than clicked because the firmware cares: MeshCore wakes a
47
47
  * sleeping display on a press and powers the board off on a long one, so a
48
48
  * caller times the release itself - or uses `tap`, which does not hold. */
49
+ /** Restart the board, the way pressing its own reset button does.
50
+ *
51
+ * Torn down and built again from the same flash: whatever the firmware
52
+ * wrote survives and whatever it held in memory does not. */
53
+ async reset() {
54
+ await this._wb.call("board.reset", { node: this.name });
55
+ }
56
+
49
57
  async press(pin, down = true) {
50
58
  await this._wb.call("board.press", { node: this.name, pin, down });
51
59
  }
package/lib/sim.mjs CHANGED
@@ -34,17 +34,16 @@ export class Sim {
34
34
  // The links first. Nothing that follows means anything against a matrix
35
35
  // that is still being measured.
36
36
  await this._wb.waitIdle(warmMs);
37
- // Idle is not the same as measured. A warm that stopped to ask permission
38
- // to download terrain finishes its own job row, so the wait above returns
39
- // in a moment having waited for nothing: no link was measured, and every
40
- // study after this would answer over free space.
41
- const held = await this.state();
42
- if (held.warm_held) {
43
- const note = (held.ground || {}).note ||
44
- "call terrain.allow to answer the question either way";
37
+ // Idle is not the same as measured. A warm that failed or was cancelled
38
+ // finishes its own job row, so the wait above returns having waited for
39
+ // nothing: no link was measured, and every study after this would answer
40
+ // over free space.
41
+ const now = await this.state();
42
+ if (!now.links_measured && !now.warming) {
43
+ const note = (now.ground || {}).note ||
44
+ "warm the links again before reading anything from this run";
45
45
  throw new MeshbenchError(
46
- "the link measurement is held: no terrain has been downloaded and no " +
47
- `link has been measured. ${note}`);
46
+ `no link has been measured, so nothing here can reach anything. ${note}`);
48
47
  }
49
48
  // Then every node that is not up, which firmware.start does and sim.start
50
49
  // does only when none of them are.
package/lib/workbench.mjs CHANGED
@@ -298,6 +298,22 @@ export class Workbench {
298
298
  return (got || {}).tab || "";
299
299
  }
300
300
 
301
+ /** Open a node's board view and return the board it is showing.
302
+ *
303
+ * The board in full: its panel, the controls for what it has wired, and what
304
+ * its profile declares beside what the firmware left in the chip. Windowed
305
+ * sessions only, for the same reason window() is, and refused for a node
306
+ * running a host build: there is no board to show. */
307
+ async boardView(node) {
308
+ if (this.isHeadless) {
309
+ throw new Unavailable("node.boardview",
310
+ "this session has no interface attached, so there is nothing to show",
311
+ "unavailable");
312
+ }
313
+ const got = await this.call("node.boardview", { node: String(node) });
314
+ return (got || {}).board || "";
315
+ }
316
+
301
317
  // ---- the shape -------------------------------------------------------
302
318
 
303
319
  get nodes() { return new Nodes(this); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshbench/client",
3
- "version": "0.0.1",
3
+ "version": "0.0.7",
4
4
  "description": "Drive a running MeshBench workbench from Node over its control socket.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "type": "module",