@duet3d/objectmodel 3.5.0-b8 → 3.5.0-beta.12
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/dist/ModelObject.d.ts +10 -1
- package/dist/ModelObject.js +17 -6
- package/dist/move/kinematics/KinematicsBase.d.ts +10 -10
- package/dist/move/kinematics/KinematicsBase.js +10 -10
- package/dist/sensors/AnalogSensor.d.ts +22 -0
- package/dist/sensors/AnalogSensor.js +24 -1
- package/dist/spindles/index.d.ts +3 -0
- package/dist/spindles/index.js +3 -0
- package/dist/state/MessageBox.d.ts +1 -0
- package/dist/state/MessageBox.js +3 -0
- package/package.json +32 -32
package/dist/ModelObject.d.ts
CHANGED
|
@@ -24,12 +24,21 @@ export declare abstract class ModelObject implements IModelObject {
|
|
|
24
24
|
* @returns Updated instance (may not equal the original instance)
|
|
25
25
|
*/
|
|
26
26
|
update(jsonElement: any): IModelObject | null;
|
|
27
|
+
/**
|
|
28
|
+
* Called to check if a diverging property type may be set.
|
|
29
|
+
* Note that this is not applicable to null values; null is always legit
|
|
30
|
+
* @param key Property key
|
|
31
|
+
* @param oldValue Old member value
|
|
32
|
+
* @param newValue New member value
|
|
33
|
+
* @returns True if the value can be set by the update call
|
|
34
|
+
*/
|
|
35
|
+
protected checkDivergingDataType<K extends keyof this>(key: K, oldValue: typeof this[K], newValue: any): boolean;
|
|
27
36
|
/**
|
|
28
37
|
* Wrap a nullable model object property so that type checks can be performed
|
|
29
38
|
* @param key Property key of the derived class
|
|
30
39
|
* @param constructor Constructor for creating new elements
|
|
31
40
|
*/
|
|
32
|
-
wrapModelProperty<K extends keyof this, T extends IModelObject>(key: K, constructor: {
|
|
41
|
+
protected wrapModelProperty<K extends keyof this, T extends IModelObject>(key: K, constructor: {
|
|
33
42
|
new (): T;
|
|
34
43
|
}): void;
|
|
35
44
|
}
|
package/dist/ModelObject.js
CHANGED
|
@@ -105,7 +105,7 @@ class ModelObject {
|
|
|
105
105
|
if (typeof value === "boolean") {
|
|
106
106
|
this[ownKey] = value;
|
|
107
107
|
}
|
|
108
|
-
else if (typeof value === "number") {
|
|
108
|
+
else if (typeof value === "number" || this.checkDivergingDataType(ownKey, prop, value)) {
|
|
109
109
|
// RRF used to report booleans as integers so convert them if necessary
|
|
110
110
|
this[ownKey] = Boolean(value);
|
|
111
111
|
}
|
|
@@ -114,7 +114,7 @@ class ModelObject {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
else if (propType === "number") {
|
|
117
|
-
if (typeof value === "number" || typeof value === "bigint") {
|
|
117
|
+
if (typeof value === "number" || typeof value === "bigint" || this.checkDivergingDataType(ownKey, prop, value)) {
|
|
118
118
|
this[ownKey] = value;
|
|
119
119
|
}
|
|
120
120
|
else if (process.env.NODE_ENV !== "production") {
|
|
@@ -122,7 +122,7 @@ class ModelObject {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
else if (propType === "bigint") {
|
|
125
|
-
if (typeof value === "number" || typeof value === "bigint") {
|
|
125
|
+
if (typeof value === "number" || typeof value === "bigint" || this.checkDivergingDataType(ownKey, prop, value)) {
|
|
126
126
|
this[ownKey] = value;
|
|
127
127
|
}
|
|
128
128
|
else if (process.env.NODE_ENV !== "production") {
|
|
@@ -130,7 +130,7 @@ class ModelObject {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
else if (propType === "string") {
|
|
133
|
-
if (typeof value === "string") {
|
|
133
|
+
if (typeof value === "string" || this.checkDivergingDataType(ownKey, prop, value)) {
|
|
134
134
|
this[ownKey] = value;
|
|
135
135
|
}
|
|
136
136
|
else if (process.env.NODE_ENV !== "production") {
|
|
@@ -138,7 +138,7 @@ class ModelObject {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
else if (propType === "function") {
|
|
141
|
-
if (typeof value === "function") {
|
|
141
|
+
if (typeof value === "function" || this.checkDivergingDataType(ownKey, prop, value)) {
|
|
142
142
|
this[ownKey] = value;
|
|
143
143
|
}
|
|
144
144
|
else if (process.env.NODE_ENV !== "production") {
|
|
@@ -146,7 +146,7 @@ class ModelObject {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
else if (propType === "object") {
|
|
149
|
-
if (typeof value === "object") {
|
|
149
|
+
if (typeof value === "object" || this.checkDivergingDataType(ownKey, prop, value)) {
|
|
150
150
|
this[ownKey] = value;
|
|
151
151
|
}
|
|
152
152
|
else if (process.env.NODE_ENV !== "production") {
|
|
@@ -161,6 +161,17 @@ class ModelObject {
|
|
|
161
161
|
}
|
|
162
162
|
return this;
|
|
163
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Called to check if a diverging property type may be set.
|
|
166
|
+
* Note that this is not applicable to null values; null is always legit
|
|
167
|
+
* @param key Property key
|
|
168
|
+
* @param oldValue Old member value
|
|
169
|
+
* @param newValue New member value
|
|
170
|
+
* @returns True if the value can be set by the update call
|
|
171
|
+
*/
|
|
172
|
+
checkDivergingDataType(key, oldValue, newValue) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
164
175
|
/**
|
|
165
176
|
* Wrap a nullable model object property so that type checks can be performed
|
|
166
177
|
* @param key Property key of the derived class
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import ModelObject from "../../ModelObject";
|
|
2
2
|
export declare enum KinematicsName {
|
|
3
3
|
cartesian = "cartesian",
|
|
4
|
-
coreXY = "
|
|
5
|
-
coreXYU = "
|
|
6
|
-
coreXYUV = "
|
|
7
|
-
coreXZ = "
|
|
8
|
-
markForged = "
|
|
9
|
-
fiveBarScara = "
|
|
10
|
-
hangprinter = "
|
|
4
|
+
coreXY = "coreXY",
|
|
5
|
+
coreXYU = "coreXYU",
|
|
6
|
+
coreXYUV = "coreXYUV",
|
|
7
|
+
coreXZ = "coreXZ",
|
|
8
|
+
markForged = "markForged",
|
|
9
|
+
fiveBarScara = "FiveBarScara",
|
|
10
|
+
hangprinter = "Hangprinter",
|
|
11
11
|
delta = "delta",
|
|
12
|
-
polar = "
|
|
13
|
-
rotaryDelta = "
|
|
14
|
-
scara = "
|
|
12
|
+
polar = "Polar",
|
|
13
|
+
rotaryDelta = "Rotary delta",
|
|
14
|
+
scara = "Scara",
|
|
15
15
|
unknown = "unknown"
|
|
16
16
|
}
|
|
17
17
|
export declare class MoveSegmentation extends ModelObject {
|
|
@@ -5,17 +5,17 @@ const ModelObject_1 = require("../../ModelObject");
|
|
|
5
5
|
var KinematicsName;
|
|
6
6
|
(function (KinematicsName) {
|
|
7
7
|
KinematicsName["cartesian"] = "cartesian";
|
|
8
|
-
KinematicsName["coreXY"] = "
|
|
9
|
-
KinematicsName["coreXYU"] = "
|
|
10
|
-
KinematicsName["coreXYUV"] = "
|
|
11
|
-
KinematicsName["coreXZ"] = "
|
|
12
|
-
KinematicsName["markForged"] = "
|
|
13
|
-
KinematicsName["fiveBarScara"] = "
|
|
14
|
-
KinematicsName["hangprinter"] = "
|
|
8
|
+
KinematicsName["coreXY"] = "coreXY";
|
|
9
|
+
KinematicsName["coreXYU"] = "coreXYU";
|
|
10
|
+
KinematicsName["coreXYUV"] = "coreXYUV";
|
|
11
|
+
KinematicsName["coreXZ"] = "coreXZ";
|
|
12
|
+
KinematicsName["markForged"] = "markForged";
|
|
13
|
+
KinematicsName["fiveBarScara"] = "FiveBarScara";
|
|
14
|
+
KinematicsName["hangprinter"] = "Hangprinter";
|
|
15
15
|
KinematicsName["delta"] = "delta";
|
|
16
|
-
KinematicsName["polar"] = "
|
|
17
|
-
KinematicsName["rotaryDelta"] = "
|
|
18
|
-
KinematicsName["scara"] = "
|
|
16
|
+
KinematicsName["polar"] = "Polar";
|
|
17
|
+
KinematicsName["rotaryDelta"] = "Rotary delta";
|
|
18
|
+
KinematicsName["scara"] = "Scara";
|
|
19
19
|
KinematicsName["unknown"] = "unknown";
|
|
20
20
|
})(KinematicsName = exports.KinematicsName || (exports.KinematicsName = {}));
|
|
21
21
|
class MoveSegmentation extends ModelObject_1.default {
|
|
@@ -15,9 +15,31 @@ export declare enum AnalogSensorType {
|
|
|
15
15
|
driversDuex = "driversduex",
|
|
16
16
|
unknown = "unknown"
|
|
17
17
|
}
|
|
18
|
+
export declare enum TemperatureError {
|
|
19
|
+
ok = "ok",
|
|
20
|
+
shortCircuit = "shortCircuit",
|
|
21
|
+
shortToVcc = "shortToVcc",
|
|
22
|
+
shortToGround = "shortToGround",
|
|
23
|
+
openCircuit = "openCircuit",
|
|
24
|
+
timeout = "timeout",
|
|
25
|
+
ioError = "ioError",
|
|
26
|
+
hardwareError = "hardwareError",
|
|
27
|
+
notReady = "notReady",
|
|
28
|
+
invalidOutputNumber = "invalidOutputNumber",
|
|
29
|
+
busBusy = "busBusy",
|
|
30
|
+
badResponse = "badResponse",
|
|
31
|
+
unknownPort = "unknownPort",
|
|
32
|
+
notInitialised = "notInitialised",
|
|
33
|
+
unknownSensor = "unknownSensor",
|
|
34
|
+
overOrUnderVoltage = "overOrUnderVoltage",
|
|
35
|
+
badVref = "badVref",
|
|
36
|
+
badVssa = "badVssa",
|
|
37
|
+
unknownError = "unknownError"
|
|
38
|
+
}
|
|
18
39
|
export declare class AnalogSensor extends ModelObject {
|
|
19
40
|
lastReading: number | null;
|
|
20
41
|
name: string | null;
|
|
42
|
+
state: TemperatureError;
|
|
21
43
|
type: AnalogSensorType;
|
|
22
44
|
}
|
|
23
45
|
export default AnalogSensor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnalogSensor = exports.AnalogSensorType = void 0;
|
|
3
|
+
exports.AnalogSensor = exports.TemperatureError = exports.AnalogSensorType = void 0;
|
|
4
4
|
const ModelObject_1 = require("../ModelObject");
|
|
5
5
|
var AnalogSensorType;
|
|
6
6
|
(function (AnalogSensorType) {
|
|
@@ -19,11 +19,34 @@ var AnalogSensorType;
|
|
|
19
19
|
AnalogSensorType["driversDuex"] = "driversduex";
|
|
20
20
|
AnalogSensorType["unknown"] = "unknown";
|
|
21
21
|
})(AnalogSensorType = exports.AnalogSensorType || (exports.AnalogSensorType = {}));
|
|
22
|
+
var TemperatureError;
|
|
23
|
+
(function (TemperatureError) {
|
|
24
|
+
TemperatureError["ok"] = "ok";
|
|
25
|
+
TemperatureError["shortCircuit"] = "shortCircuit";
|
|
26
|
+
TemperatureError["shortToVcc"] = "shortToVcc";
|
|
27
|
+
TemperatureError["shortToGround"] = "shortToGround";
|
|
28
|
+
TemperatureError["openCircuit"] = "openCircuit";
|
|
29
|
+
TemperatureError["timeout"] = "timeout";
|
|
30
|
+
TemperatureError["ioError"] = "ioError";
|
|
31
|
+
TemperatureError["hardwareError"] = "hardwareError";
|
|
32
|
+
TemperatureError["notReady"] = "notReady";
|
|
33
|
+
TemperatureError["invalidOutputNumber"] = "invalidOutputNumber";
|
|
34
|
+
TemperatureError["busBusy"] = "busBusy";
|
|
35
|
+
TemperatureError["badResponse"] = "badResponse";
|
|
36
|
+
TemperatureError["unknownPort"] = "unknownPort";
|
|
37
|
+
TemperatureError["notInitialised"] = "notInitialised";
|
|
38
|
+
TemperatureError["unknownSensor"] = "unknownSensor";
|
|
39
|
+
TemperatureError["overOrUnderVoltage"] = "overOrUnderVoltage";
|
|
40
|
+
TemperatureError["badVref"] = "badVref";
|
|
41
|
+
TemperatureError["badVssa"] = "badVssa";
|
|
42
|
+
TemperatureError["unknownError"] = "unknownError";
|
|
43
|
+
})(TemperatureError = exports.TemperatureError || (exports.TemperatureError = {}));
|
|
22
44
|
class AnalogSensor extends ModelObject_1.default {
|
|
23
45
|
constructor() {
|
|
24
46
|
super(...arguments);
|
|
25
47
|
this.lastReading = null;
|
|
26
48
|
this.name = null;
|
|
49
|
+
this.state = TemperatureError.ok;
|
|
27
50
|
this.type = AnalogSensorType.unknown;
|
|
28
51
|
}
|
|
29
52
|
}
|
package/dist/spindles/index.d.ts
CHANGED
|
@@ -10,8 +10,11 @@ export declare class Spindle extends ModelObject {
|
|
|
10
10
|
canReverse: boolean;
|
|
11
11
|
current: number;
|
|
12
12
|
frequency: number;
|
|
13
|
+
idlePwm: number;
|
|
13
14
|
min: number;
|
|
15
|
+
minPwm: number;
|
|
14
16
|
max: number;
|
|
17
|
+
maxPwm: number;
|
|
15
18
|
state: SpindleState;
|
|
16
19
|
}
|
|
17
20
|
export default Spindle;
|
package/dist/spindles/index.js
CHANGED
|
@@ -16,8 +16,11 @@ class Spindle extends ModelObject_1.default {
|
|
|
16
16
|
this.canReverse = false;
|
|
17
17
|
this.current = 0;
|
|
18
18
|
this.frequency = 0;
|
|
19
|
+
this.idlePwm = 0;
|
|
19
20
|
this.min = 60;
|
|
21
|
+
this.minPwm = 0;
|
|
20
22
|
this.max = 10000;
|
|
23
|
+
this.maxPwm = 1;
|
|
21
24
|
this.state = SpindleState.unconfigured;
|
|
22
25
|
}
|
|
23
26
|
}
|
package/dist/state/MessageBox.js
CHANGED
|
@@ -28,6 +28,9 @@ class MessageBox extends ModelObject_1.default {
|
|
|
28
28
|
this.timeout = 0;
|
|
29
29
|
this.title = "";
|
|
30
30
|
}
|
|
31
|
+
checkDivergingDataType(key, oldValue, newValue) {
|
|
32
|
+
return key === "default" && (typeof newValue === "number" || typeof newValue === "string");
|
|
33
|
+
}
|
|
31
34
|
}
|
|
32
35
|
exports.MessageBox = MessageBox;
|
|
33
36
|
exports.default = MessageBox;
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@duet3d/objectmodel",
|
|
3
|
-
"version": "3.5.0-
|
|
4
|
-
"description": "TypeScript implementation of the Duet3D Object Model",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "jest --config jestconfig.json",
|
|
9
|
-
"build": "tsc",
|
|
10
|
-
"prepare": "npm run build",
|
|
11
|
-
"prepublishOnly": "npm test"
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/Duet3D/ObjectModel.git"
|
|
16
|
-
},
|
|
17
|
-
"author": "Christian Hammacher",
|
|
18
|
-
"license": "LGPL-2.1",
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/Duet3D/ObjectModel/issues"
|
|
21
|
-
},
|
|
22
|
-
"homepage": "https://github.com/Duet3D/ObjectModel#readme",
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@types/jest": "^27.5.0",
|
|
25
|
-
"jest": "^27.5.1",
|
|
26
|
-
"ts-jest": "^27.1.4",
|
|
27
|
-
"typescript": "^4.6.4"
|
|
28
|
-
},
|
|
29
|
-
"files": [
|
|
30
|
-
"/dist"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@duet3d/objectmodel",
|
|
3
|
+
"version": "3.5.0-beta.12",
|
|
4
|
+
"description": "TypeScript implementation of the Duet3D Object Model",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "jest --config jestconfig.json",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"prepare": "npm run build",
|
|
11
|
+
"prepublishOnly": "npm test"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/Duet3D/ObjectModel.git"
|
|
16
|
+
},
|
|
17
|
+
"author": "Christian Hammacher",
|
|
18
|
+
"license": "LGPL-2.1",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/Duet3D/ObjectModel/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/Duet3D/ObjectModel#readme",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/jest": "^27.5.0",
|
|
25
|
+
"jest": "^27.5.1",
|
|
26
|
+
"ts-jest": "^27.1.4",
|
|
27
|
+
"typescript": "^4.6.4"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"/dist"
|
|
31
|
+
]
|
|
32
|
+
}
|