@synapticon/motion-master-client 6.0.0-alpha.37 → 6.0.0-alpha.38

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.
@@ -931,6 +931,22 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
931
931
  * @request GET:/api/game-loop
932
932
  */
933
933
  getGameLoop: (params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<GameLoopHealth, any>>;
934
+ /**
935
+ * @description Retimes the running RT loop to a new cycle period, in microseconds. The change takes effect within one cycle and is transient — it is not written back to the config file, so a restart reverts to the configured `gameLoop.periodUs`. Intended for tuning on hosts that cannot sustain the configured rate: if `skippedCycles` climbs steadily (common on Windows userspace), raise the period (e.g. from 1000 to 2000 µs) until the loop meets its grid. Only the master cadence is retimed — the process-data recorder ring is not resized, and no drive-side watchdog is touched, so raising the period toward a drive's PDO/SM watchdog window can fault that drive. Applying a period starts a fresh health epoch: the cumulative counters (`executedCycles`, `skippedCycles`, the `achievedHz` average, and `maxExecNs`/`avgExecNs`) reset so the snapshot reflects only the new period — letting you see straight away whether the change improved the loop's health. Returns the updated health snapshot.
936
+ *
937
+ * @name SetGameLoopPeriod
938
+ * @summary Change the real-time cycle period
939
+ * @request PUT:/api/game-loop
940
+ */
941
+ setGameLoopPeriod: (data: {
942
+ /**
943
+ * New cycle period in microseconds. Must be greater than 0.
944
+ * @format int64
945
+ * @min 1
946
+ * @example 2000
947
+ */
948
+ periodUs: number;
949
+ }, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<GameLoopHealth, void>>;
934
950
  /**
935
951
  * @description Streams the same `.mmpd` serialisation as the POST variant (the recorder's current span, with the process image embedded as a header) directly in the response body instead of writing a file — for the client SDK / browser, which parses the bytes offline. Request with `Accept: application/octet-stream`. Same span semantics as the POST; works in any state.
936
952
  *
@@ -552,6 +552,21 @@ export class Api extends HttpClient {
552
552
  format: "json",
553
553
  ...params,
554
554
  });
555
+ /**
556
+ * @description Retimes the running RT loop to a new cycle period, in microseconds. The change takes effect within one cycle and is transient — it is not written back to the config file, so a restart reverts to the configured `gameLoop.periodUs`. Intended for tuning on hosts that cannot sustain the configured rate: if `skippedCycles` climbs steadily (common on Windows userspace), raise the period (e.g. from 1000 to 2000 µs) until the loop meets its grid. Only the master cadence is retimed — the process-data recorder ring is not resized, and no drive-side watchdog is touched, so raising the period toward a drive's PDO/SM watchdog window can fault that drive. Applying a period starts a fresh health epoch: the cumulative counters (`executedCycles`, `skippedCycles`, the `achievedHz` average, and `maxExecNs`/`avgExecNs`) reset so the snapshot reflects only the new period — letting you see straight away whether the change improved the loop's health. Returns the updated health snapshot.
557
+ *
558
+ * @name SetGameLoopPeriod
559
+ * @summary Change the real-time cycle period
560
+ * @request PUT:/api/game-loop
561
+ */
562
+ setGameLoopPeriod = (data, params = {}) => this.request({
563
+ path: `/api/game-loop`,
564
+ method: "PUT",
565
+ body: data,
566
+ type: ContentType.Json,
567
+ format: "json",
568
+ ...params,
569
+ });
555
570
  /**
556
571
  * @description Streams the same `.mmpd` serialisation as the POST variant (the recorder's current span, with the process image embedded as a header) directly in the response body instead of writing a file — for the client SDK / browser, which parses the bytes offline. Request with `Accept: application/octet-stream`. Same span semantics as the POST; works in any state.
557
572
  *
package/dist/mmpd.d.ts CHANGED
@@ -19,7 +19,6 @@ export interface MmpdDevice {
19
19
  export interface MmpdHeader {
20
20
  formatVersion: number;
21
21
  flags: number;
22
- cyclePeriodUs: number;
23
22
  startSequence: bigint;
24
23
  rowCount: number;
25
24
  inputBytes: number;
package/dist/mmpd.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // Master and no live bus. All multi-byte integers are little-endian.
4
4
  //
5
5
  // Layout:
6
- // Prefix (40 bytes): magic 'MMPD', u16 formatVersion, u16 flags, u32 cyclePeriodUs,
6
+ // Prefix (36 bytes): magic 'MMPD', u16 formatVersion, u16 flags,
7
7
  // u64 startSequence, u64 rowCount, u32 inputBytes, u32 outputBytes, u32 deviceCount.
8
8
  // Device table (deviceCount): u16 slavePosition, u32 vendorId/productCode/revisionNumber/
9
9
  // serialNumber, str name, u32 entryCount, then per entry: u16 index, u8 subindex,
@@ -124,7 +124,7 @@ export class MmpdFile {
124
124
  export function parseMmpd(data) {
125
125
  const u8 = data instanceof Uint8Array ? data : new Uint8Array(data);
126
126
  const dv = new DataView(u8.buffer, u8.byteOffset, u8.byteLength);
127
- if (u8.byteLength < 40 || dv.getUint32(0, true) !== MAGIC) {
127
+ if (u8.byteLength < 36 || dv.getUint32(0, true) !== MAGIC) {
128
128
  throw new Error('Not a .mmpd file (bad magic)');
129
129
  }
130
130
  const formatVersion = dv.getUint16(4, true);
@@ -134,15 +134,14 @@ export function parseMmpd(data) {
134
134
  const header = {
135
135
  formatVersion,
136
136
  flags: dv.getUint16(6, true),
137
- cyclePeriodUs: dv.getUint32(8, true),
138
- startSequence: dv.getBigUint64(12, true),
139
- rowCount: Number(dv.getBigUint64(20, true)),
140
- inputBytes: dv.getUint32(28, true),
141
- outputBytes: dv.getUint32(32, true),
137
+ startSequence: dv.getBigUint64(8, true),
138
+ rowCount: Number(dv.getBigUint64(16, true)),
139
+ inputBytes: dv.getUint32(24, true),
140
+ outputBytes: dv.getUint32(28, true),
142
141
  devices: [],
143
142
  };
144
- const deviceCount = dv.getUint32(36, true);
145
- const cursor = new Cursor(dv, u8, 40);
143
+ const deviceCount = dv.getUint32(32, true);
144
+ const cursor = new Cursor(dv, u8, 36);
146
145
  for (let d = 0; d < deviceCount; d++) {
147
146
  const device = {
148
147
  slavePosition: cursor.u16(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synapticon/motion-master-client",
3
- "version": "6.0.0-alpha.37",
3
+ "version": "6.0.0-alpha.38",
4
4
  "description": "Isomorphic TypeScript client for Motion Master: the generated HTTP API client, the WebSocket connection, and helpers.",
5
5
  "license": "MIT",
6
6
  "repository": {