@duet3d/objectmodel 3.7.0 → 3.7.1-alpha.2

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.
@@ -1154,9 +1154,10 @@
1154
1154
  "updating": "The firmware is being updated",
1155
1155
  "off": "The machine is turned off (i.e. the input voltage is too low for operation)",
1156
1156
  "halted": "The machine has encountered an emergency stop and is ready to reset",
1157
+ "held": "A feed hold has stopped all motion and keeps the queued moves until M24 releases it",
1157
1158
  "pausing": "The machine is about to pause a file job",
1158
1159
  "paused": "The machine has paused a file job",
1159
- "resuming": "The machine is about to resume a paused file job",
1160
+ "resuming": "The machine is about to resume a paused file job or is moving back to the position where a feed hold stopped it",
1160
1161
  "cancelling": "Job file is being cancelled",
1161
1162
  "processing": "The machine is processing a file job",
1162
1163
  "simulating": "The machine is simulating a file job to determine its processing time",
package/dist/enums.json CHANGED
@@ -324,6 +324,7 @@
324
324
  "updating",
325
325
  "off",
326
326
  "halted",
327
+ "held",
327
328
  "pausing",
328
329
  "paused",
329
330
  "resuming",
@@ -1,9 +1,7 @@
1
- import type { IModelObject } from "../../ModelObject";
2
1
  import { KinematicsName, ZLeadscrewKinematics } from "./KinematicsBase";
3
2
  export declare class CoreKinematics extends ZLeadscrewKinematics {
4
3
  constructor(name: KinematicsName);
5
4
  forwardMatrix: Array<Array<number>>;
6
5
  inverseMatrix: Array<Array<number>>;
7
- update(jsonElement: any, authoritative?: boolean): IModelObject | null;
8
6
  }
9
7
  export default CoreKinematics;
@@ -1,5 +1,4 @@
1
1
  import { KinematicsName, ZLeadscrewKinematics } from "./KinematicsBase";
2
- import { getKinematics } from "./index";
3
2
  export class CoreKinematics extends ZLeadscrewKinematics {
4
3
  constructor(name) {
5
4
  super(name);
@@ -14,14 +13,5 @@ export class CoreKinematics extends ZLeadscrewKinematics {
14
13
  [0, 0, 1]
15
14
  ];
16
15
  }
17
- update(jsonElement, authoritative = false) {
18
- if (jsonElement === null) {
19
- throw new Error("Kinematics must not be null");
20
- }
21
- if (typeof jsonElement.name === "string" && this.name !== jsonElement.name) {
22
- return getKinematics(jsonElement.name).update(jsonElement, authoritative);
23
- }
24
- return super.update(jsonElement, authoritative);
25
- }
26
16
  }
27
17
  export default CoreKinematics;
@@ -1,6 +1,5 @@
1
1
  import ModelCollection from "../../ModelCollection";
2
2
  import ModelObject from "../../ModelObject";
3
- import type { IModelObject } from "../../ModelObject";
4
3
  import KinematicsBase from "./KinematicsBase";
5
4
  export declare class DeltaTower extends ModelObject {
6
5
  angleCorrection: number;
@@ -16,6 +15,5 @@ export declare class DeltaKinematics extends KinematicsBase {
16
15
  readonly towers: ModelCollection<DeltaTower>;
17
16
  xTilt: number;
18
17
  yTilt: number;
19
- update(jsonElement: any, authoritative?: boolean): IModelObject | null;
20
18
  }
21
19
  export default DeltaKinematics;
@@ -1,7 +1,6 @@
1
1
  import ModelCollection, { initCollection } from "../../ModelCollection";
2
2
  import ModelObject from "../../ModelObject";
3
3
  import KinematicsBase from "./KinematicsBase";
4
- import { getKinematics } from "./index";
5
4
  export class DeltaTower extends ModelObject {
6
5
  constructor() {
7
6
  super(...arguments);
@@ -22,14 +21,5 @@ export class DeltaKinematics extends KinematicsBase {
22
21
  this.xTilt = 0;
23
22
  this.yTilt = 0;
24
23
  }
25
- update(jsonElement, authoritative = false) {
26
- if (jsonElement === null) {
27
- throw new Error("Kinematics must not be null");
28
- }
29
- if (typeof jsonElement.name === "string" && this.name !== jsonElement.name) {
30
- return getKinematics(jsonElement.name).update(jsonElement, authoritative);
31
- }
32
- return super.update(jsonElement, authoritative);
33
- }
34
24
  }
35
25
  export default DeltaKinematics;
@@ -1,9 +1,7 @@
1
- import type { IModelObject } from "../../ModelObject";
2
1
  import KinematicsBase from "./KinematicsBase";
3
2
  export declare class HangprinterKinematics extends KinematicsBase {
4
3
  anchors: Array<Array<number>>;
5
4
  printRadius: number;
6
5
  constructor();
7
- update(jsonElement: any, authoritative?: boolean): IModelObject | null;
8
6
  }
9
7
  export default HangprinterKinematics;
@@ -1,5 +1,4 @@
1
1
  import KinematicsBase, { KinematicsName } from "./KinematicsBase";
2
- import { getKinematics } from "./index";
3
2
  export class HangprinterKinematics extends KinematicsBase {
4
3
  constructor() {
5
4
  super(KinematicsName.hangprinter);
@@ -11,14 +10,5 @@ export class HangprinterKinematics extends KinematicsBase {
11
10
  ];
12
11
  this.printRadius = 1500;
13
12
  }
14
- update(jsonElement, authoritative = false) {
15
- if (jsonElement === null) {
16
- throw new Error("Kinematics must not be null");
17
- }
18
- if (typeof jsonElement.name === "string" && this.name !== jsonElement.name) {
19
- return getKinematics(jsonElement.name).update(jsonElement, authoritative);
20
- }
21
- return super.update(jsonElement, authoritative);
22
- }
23
13
  }
24
14
  export default HangprinterKinematics;
@@ -1,4 +1,4 @@
1
- import ModelObject from "../../ModelObject";
1
+ import ModelObject, { type IModelObject } from "../../ModelObject";
2
2
  export declare enum KinematicsName {
3
3
  cartesian = "cartesian",
4
4
  coreXY = "coreXY",
@@ -14,6 +14,13 @@ export declare enum KinematicsName {
14
14
  scara = "Scara",
15
15
  unknown = "unknown"
16
16
  }
17
+ /**
18
+ * Convert a kinematics name as reported by RepRapFirmware or DSF to the corresponding enum value.
19
+ * RRF 3.7 reports normalized names (linearDelta, scara) whereas DSF and older firmware report
20
+ * capitalized ones (delta, Scara), so both spellings must be accepted
21
+ * @param name Reported kinematics name
22
+ */
23
+ export declare function parseKinematicsName(name: string): KinematicsName;
17
24
  export declare class MoveSegmentation extends ModelObject {
18
25
  segmentsPerSec: number;
19
26
  minSegLength: number;
@@ -22,6 +29,7 @@ export declare abstract class KinematicsBase extends ModelObject {
22
29
  readonly name: KinematicsName;
23
30
  segmentation: MoveSegmentation | null;
24
31
  constructor(name: KinematicsName);
32
+ update(jsonElement: any, authoritative?: boolean): IModelObject | null;
25
33
  }
26
34
  export default KinematicsBase;
27
35
  export declare class TiltCorrection extends ModelObject {
@@ -1,5 +1,6 @@
1
- import ModelObject from "../../ModelObject";
2
- // Values are the spellings reported by RepRapFirmware, which are inconsistently capitalized
1
+ import ModelObject, {} from "../../ModelObject";
2
+ import { getKinematics } from "./index";
3
+ // Values are the spellings DSF reports, which are inconsistently capitalized
3
4
  export var KinematicsName;
4
5
  (function (KinematicsName) {
5
6
  KinematicsName["cartesian"] = "cartesian";
@@ -16,6 +17,31 @@ export var KinematicsName;
16
17
  KinematicsName["scara"] = "Scara";
17
18
  KinematicsName["unknown"] = "unknown";
18
19
  })(KinematicsName || (KinematicsName = {}));
20
+ /**
21
+ * Convert a kinematics name as reported by RepRapFirmware or DSF to the corresponding enum value.
22
+ * RRF 3.7 reports normalized names (linearDelta, scara) whereas DSF and older firmware report
23
+ * capitalized ones (delta, Scara), so both spellings must be accepted
24
+ * @param name Reported kinematics name
25
+ */
26
+ export function parseKinematicsName(name) {
27
+ switch (name.toLowerCase()) {
28
+ case "cartesian": return KinematicsName.cartesian;
29
+ case "corexy": return KinematicsName.coreXY;
30
+ case "corexyu": return KinematicsName.coreXYU;
31
+ case "corexyuv": return KinematicsName.coreXYUV;
32
+ case "corexz": return KinematicsName.coreXZ;
33
+ case "markforged": return KinematicsName.markForged;
34
+ case "fivebarscara": return KinematicsName.fiveBarScara;
35
+ case "hangprinter": return KinematicsName.hangprinter;
36
+ case "delta":
37
+ case "lineardelta": return KinematicsName.linearDelta;
38
+ case "polar": return KinematicsName.polar;
39
+ case "rotary delta":
40
+ case "rotarydelta": return KinematicsName.rotaryDelta;
41
+ case "scara": return KinematicsName.scara;
42
+ default: return KinematicsName.unknown;
43
+ }
44
+ }
19
45
  export class MoveSegmentation extends ModelObject {
20
46
  constructor() {
21
47
  super(...arguments);
@@ -30,6 +56,20 @@ export class KinematicsBase extends ModelObject {
30
56
  this.name = name;
31
57
  ModelObject.wrapModelProperty(this, "segmentation", MoveSegmentation);
32
58
  }
59
+ update(jsonElement, authoritative = false) {
60
+ if (jsonElement === null) {
61
+ throw new Error("Kinematics must not be null");
62
+ }
63
+ if (typeof jsonElement.name === "string") {
64
+ const name = parseKinematicsName(jsonElement.name);
65
+ if (this.name !== name) {
66
+ return getKinematics(name).update(jsonElement, authoritative);
67
+ }
68
+ // The generic update assigns strings verbatim, so the reported spelling must be normalized first
69
+ jsonElement = { ...jsonElement, name };
70
+ }
71
+ return super.update(jsonElement, authoritative);
72
+ }
33
73
  }
34
74
  export default KinematicsBase;
35
75
  export class TiltCorrection extends ModelObject {
@@ -1,4 +1,3 @@
1
- import type { IModelObject } from "../../ModelObject";
2
1
  import KinematicsBase from "./KinematicsBase";
3
2
  export declare class PolarKinematics extends KinematicsBase {
4
3
  constructor();
@@ -7,6 +6,5 @@ export declare class PolarKinematics extends KinematicsBase {
7
6
  radiusMin: number;
8
7
  ttAccMax: number;
9
8
  ttSpeedMax: number;
10
- update(jsonElement: any, authoritative?: boolean): IModelObject | null;
11
9
  }
12
10
  export default PolarKinematics;
@@ -1,5 +1,4 @@
1
1
  import KinematicsBase, { KinematicsName } from "./KinematicsBase";
2
- import { getKinematics } from "./index";
3
2
  export class PolarKinematics extends KinematicsBase {
4
3
  constructor() {
5
4
  super(KinematicsName.polar);
@@ -9,14 +8,5 @@ export class PolarKinematics extends KinematicsBase {
9
8
  this.ttAccMax = 0;
10
9
  this.ttSpeedMax = 0;
11
10
  }
12
- update(jsonElement, authoritative = false) {
13
- if (jsonElement === null) {
14
- throw new Error("Kinematics must not be null");
15
- }
16
- if (typeof jsonElement.name === "string" && this.name !== jsonElement.name) {
17
- return getKinematics(jsonElement.name).update(jsonElement, authoritative);
18
- }
19
- return super.update(jsonElement, authoritative);
20
- }
21
11
  }
22
12
  export default PolarKinematics;
@@ -1,4 +1,3 @@
1
- import type { IModelObject } from "../../ModelObject";
2
1
  import { ZLeadscrewKinematics } from "./KinematicsBase";
3
2
  export declare class ScaraKinematics extends ZLeadscrewKinematics {
4
3
  crosstalk: number[];
@@ -9,6 +8,5 @@ export declare class ScaraKinematics extends ZLeadscrewKinematics {
9
8
  thetaLimits: number[];
10
9
  xOffset: number;
11
10
  yOffset: number;
12
- update(jsonElement: any, authoritative?: boolean): IModelObject | null;
13
11
  }
14
12
  export default ScaraKinematics;
@@ -1,5 +1,4 @@
1
1
  import { ZLeadscrewKinematics } from "./KinematicsBase";
2
- import { getKinematics } from "./index";
3
2
  export class ScaraKinematics extends ZLeadscrewKinematics {
4
3
  constructor() {
5
4
  super(...arguments);
@@ -12,14 +11,5 @@ export class ScaraKinematics extends ZLeadscrewKinematics {
12
11
  this.xOffset = 0;
13
12
  this.yOffset = 0;
14
13
  }
15
- update(jsonElement, authoritative = false) {
16
- if (jsonElement === null) {
17
- throw new Error("Kinematics must not be null");
18
- }
19
- if (typeof jsonElement.name === "string" && this.name !== jsonElement.name) {
20
- return getKinematics(jsonElement.name).update(jsonElement, authoritative);
21
- }
22
- return super.update(jsonElement, authoritative);
23
- }
24
14
  }
25
15
  export default ScaraKinematics;
@@ -1,8 +1,6 @@
1
- import type { IModelObject } from "../../ModelObject";
2
1
  import KinematicsBase, { KinematicsName } from "./KinematicsBase";
3
2
  export declare class Kinematics extends KinematicsBase {
4
3
  constructor(name?: KinematicsName);
5
- update(jsonElement: any, authoritative?: boolean): IModelObject | null;
6
4
  }
7
5
  export default Kinematics;
8
6
  export declare function getKinematics(name: KinematicsName): KinematicsBase;
@@ -8,15 +8,6 @@ export class Kinematics extends KinematicsBase {
8
8
  constructor(name = KinematicsName.cartesian) {
9
9
  super(name);
10
10
  }
11
- update(jsonElement, authoritative = false) {
12
- if (jsonElement === null) {
13
- throw new Error("Kinematics must not be null");
14
- }
15
- if (typeof jsonElement.name === "string" && this.name !== jsonElement.name) {
16
- return getKinematics(jsonElement.name).update(jsonElement, authoritative);
17
- }
18
- return super.update(jsonElement, authoritative);
19
- }
20
11
  }
21
12
  export default Kinematics;
22
13
  export function getKinematics(name) {
@@ -4,6 +4,7 @@ export declare enum MachineStatus {
4
4
  updating = "updating",
5
5
  off = "off",
6
6
  halted = "halted",
7
+ held = "held",
7
8
  pausing = "pausing",
8
9
  paused = "paused",
9
10
  resuming = "resuming",
@@ -5,6 +5,7 @@ export var MachineStatus;
5
5
  MachineStatus["updating"] = "updating";
6
6
  MachineStatus["off"] = "off";
7
7
  MachineStatus["halted"] = "halted";
8
+ MachineStatus["held"] = "held";
8
9
  MachineStatus["pausing"] = "pausing";
9
10
  MachineStatus["paused"] = "paused";
10
11
  MachineStatus["resuming"] = "resuming";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duet3d/objectmodel",
3
- "version": "3.7.0",
3
+ "version": "3.7.1-alpha.2",
4
4
  "description": "TypeScript implementation of the Duet3D Object Model",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",