@duet3d/objectmodel 3.7.0-beta.8 → 3.7.0-rc.1
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/ModelCollection.d.ts +11 -1
- package/dist/ModelCollection.js +24 -4
- package/dist/ObjectModel.js +2 -2
- package/dist/boards/directDisplay/DirectDisplayScreen.d.ts +1 -1
- package/dist/boards/directDisplay/DirectDisplayScreen.js +3 -3
- package/dist/boards/directDisplay/DirectDisplayScreenST7567.d.ts +1 -1
- package/dist/boards/directDisplay/DirectDisplayScreenST7567.js +3 -3
- package/dist/boards/index.d.ts +25 -10
- package/dist/boards/index.js +35 -14
- package/dist/documentation.json +1005 -206
- package/dist/enums.json +8 -7
- package/dist/move/index.d.ts +1 -0
- package/dist/move/index.js +1 -0
- package/dist/move/kinematics/CoreKinematics.d.ts +1 -1
- package/dist/move/kinematics/CoreKinematics.js +3 -3
- package/dist/move/kinematics/DeltaKinematics.d.ts +1 -1
- package/dist/move/kinematics/DeltaKinematics.js +3 -3
- package/dist/move/kinematics/HangprinterKinematics.d.ts +1 -1
- package/dist/move/kinematics/HangprinterKinematics.js +3 -3
- package/dist/move/kinematics/KinematicsBase.d.ts +6 -6
- package/dist/move/kinematics/KinematicsBase.js +7 -6
- package/dist/move/kinematics/PolarKinematics.d.ts +1 -1
- package/dist/move/kinematics/PolarKinematics.js +3 -3
- package/dist/move/kinematics/ScaraKinematics.d.ts +1 -1
- package/dist/move/kinematics/ScaraKinematics.js +3 -3
- package/dist/move/kinematics/index.d.ts +1 -1
- package/dist/move/kinematics/index.js +3 -3
- package/dist/plugins/PluginManifest.d.ts +1 -1
- package/dist/plugins/PluginManifest.js +2 -2
- package/dist/sensors/FilamentMonitors/LaserFilamentMonitor.d.ts +1 -1
- package/dist/sensors/FilamentMonitors/LaserFilamentMonitor.js +3 -3
- package/dist/sensors/FilamentMonitors/PulsedFilamentMonitor.d.ts +1 -1
- package/dist/sensors/FilamentMonitors/PulsedFilamentMonitor.js +3 -3
- package/dist/sensors/FilamentMonitors/RotatingMagnetFilamentMonitor.d.ts +1 -1
- package/dist/sensors/FilamentMonitors/RotatingMagnetFilamentMonitor.js +3 -3
- package/dist/sensors/FilamentMonitors/index.d.ts +1 -1
- package/dist/sensors/FilamentMonitors/index.js +3 -3
- package/dist/sensors/Probe.d.ts +9 -1
- package/dist/sensors/Probe.js +12 -0
- package/dist/state/MessageBox.d.ts +1 -1
- package/dist/state/MessageBox.js +2 -2
- package/package.json +2 -2
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import type { IModelObject } from "./ModelObject";
|
|
2
|
+
/**
|
|
3
|
+
* Factory creating the item for a given index
|
|
4
|
+
*/
|
|
5
|
+
export type ItemFactory<T> = (index: number) => T;
|
|
2
6
|
/**
|
|
3
7
|
* Class for storing model object items in an array
|
|
4
8
|
*/
|
|
5
9
|
export declare class ModelCollection<T extends IModelObject | null> extends Array<T> implements IModelObject {
|
|
10
|
+
/**
|
|
11
|
+
* Derived arrays from filter, map, slice etc. would otherwise be constructed as
|
|
12
|
+
* new ModelCollection(length), leaving $itemConstructor set to a number
|
|
13
|
+
*/
|
|
14
|
+
static get [Symbol.species](): ArrayConstructor;
|
|
6
15
|
/**
|
|
7
16
|
* Constructor of this class
|
|
8
17
|
* @param itemConstructor Item constructor type that items must derive from
|
|
18
|
+
* @param itemFactory Factory to use for collections whose item class depends on the position, e.g. boards
|
|
9
19
|
*/
|
|
10
20
|
constructor(itemConstructor: {
|
|
11
21
|
new (): T;
|
|
12
|
-
});
|
|
22
|
+
}, itemFactory?: ItemFactory<T> | null);
|
|
13
23
|
/**
|
|
14
24
|
* Overridden push method to perform better type checks
|
|
15
25
|
* @param items Items to add
|
package/dist/ModelCollection.js
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
import { isModelObject } from "./ModelObject";
|
|
2
|
+
/**
|
|
3
|
+
* Create the item for a given index. This is deliberately not a method of the collection because
|
|
4
|
+
* a non-public member would make the class nominally typed, which breaks assignability of the
|
|
5
|
+
* reactive proxies consumers wrap the object model in
|
|
6
|
+
* @param collection Collection the item is created for
|
|
7
|
+
* @param index Index the new item is going to be stored at
|
|
8
|
+
* @returns New item
|
|
9
|
+
*/
|
|
10
|
+
function createItem(collection, index) {
|
|
11
|
+
return (collection.$itemFactory !== null) ? collection.$itemFactory(index) : new collection.$itemConstructor();
|
|
12
|
+
}
|
|
2
13
|
/**
|
|
3
14
|
* Class for storing model object items in an array
|
|
4
15
|
*/
|
|
5
16
|
export class ModelCollection extends Array {
|
|
17
|
+
/**
|
|
18
|
+
* Derived arrays from filter, map, slice etc. would otherwise be constructed as
|
|
19
|
+
* new ModelCollection(length), leaving $itemConstructor set to a number
|
|
20
|
+
*/
|
|
21
|
+
static get [Symbol.species]() {
|
|
22
|
+
return Array;
|
|
23
|
+
}
|
|
6
24
|
/**
|
|
7
25
|
* Constructor of this class
|
|
8
26
|
* @param itemConstructor Item constructor type that items must derive from
|
|
27
|
+
* @param itemFactory Factory to use for collections whose item class depends on the position, e.g. boards
|
|
9
28
|
*/
|
|
10
|
-
constructor(itemConstructor) {
|
|
29
|
+
constructor(itemConstructor, itemFactory = null) {
|
|
11
30
|
super();
|
|
12
31
|
Object.setPrototypeOf(this, ModelCollection.prototype);
|
|
13
32
|
Object.defineProperty(this, "$itemConstructor", { enumerable: false, value: itemConstructor });
|
|
33
|
+
Object.defineProperty(this, "$itemFactory", { enumerable: false, value: itemFactory });
|
|
14
34
|
}
|
|
15
35
|
// Unfortunately it isn't possible to override index operators in JS/TS
|
|
16
36
|
/**
|
|
@@ -24,7 +44,7 @@ export class ModelCollection extends Array {
|
|
|
24
44
|
super.push(item);
|
|
25
45
|
}
|
|
26
46
|
else {
|
|
27
|
-
const newItem =
|
|
47
|
+
const newItem = createItem(that, this.length);
|
|
28
48
|
super.push(newItem.update(item));
|
|
29
49
|
}
|
|
30
50
|
}
|
|
@@ -55,7 +75,7 @@ export class ModelCollection extends Array {
|
|
|
55
75
|
this[i] = jsonElement[i];
|
|
56
76
|
}
|
|
57
77
|
else {
|
|
58
|
-
const refItem =
|
|
78
|
+
const refItem = createItem(that, i);
|
|
59
79
|
this[i] = refItem.update(newItem, authoritative);
|
|
60
80
|
}
|
|
61
81
|
}
|
|
@@ -79,7 +99,7 @@ export class ModelCollection extends Array {
|
|
|
79
99
|
super.push(itemToAdd);
|
|
80
100
|
}
|
|
81
101
|
else {
|
|
82
|
-
const newItem =
|
|
102
|
+
const newItem = createItem(that, i);
|
|
83
103
|
super.push(newItem.update(itemToAdd, authoritative));
|
|
84
104
|
}
|
|
85
105
|
}
|
package/dist/ObjectModel.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ModelCollection from "./ModelCollection";
|
|
2
2
|
import ModelDictionary from "./ModelDictionary";
|
|
3
3
|
import ModelObject from "./ModelObject";
|
|
4
|
-
import Board from "./boards";
|
|
4
|
+
import Board, { getBoard } from "./boards";
|
|
5
5
|
import Directories from "./directories";
|
|
6
6
|
import Fan from "./fans";
|
|
7
7
|
import Heat from "./heat";
|
|
@@ -25,7 +25,7 @@ import LedStrip from "./ledStrips";
|
|
|
25
25
|
export class ObjectModel extends ModelObject {
|
|
26
26
|
constructor() {
|
|
27
27
|
super();
|
|
28
|
-
this.boards = new ModelCollection(Board);
|
|
28
|
+
this.boards = new ModelCollection(Board, getBoard);
|
|
29
29
|
this.directories = new Directories();
|
|
30
30
|
this.fans = new ModelCollection(Fan);
|
|
31
31
|
this.global = new ModelDictionary(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IModelObject } from "../../ModelObject";
|
|
2
2
|
import DirectDisplayScreenBase from "./DirectDisplayScreenBase";
|
|
3
3
|
export declare class DirectDisplayScreen extends DirectDisplayScreenBase {
|
|
4
|
-
update(jsonElement: any): IModelObject | null;
|
|
4
|
+
update(jsonElement: any, authoritative?: boolean): IModelObject | null;
|
|
5
5
|
}
|
|
6
6
|
export default DirectDisplayScreen;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { getDirectDisplayScreen } from ".";
|
|
2
2
|
import DirectDisplayScreenBase from "./DirectDisplayScreenBase";
|
|
3
3
|
export class DirectDisplayScreen extends DirectDisplayScreenBase {
|
|
4
|
-
update(jsonElement) {
|
|
4
|
+
update(jsonElement, authoritative = false) {
|
|
5
5
|
if (jsonElement === null) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
8
|
if (typeof jsonElement.controller === "string" && jsonElement.controller !== this.controller) {
|
|
9
|
-
return getDirectDisplayScreen(jsonElement.controller).update(jsonElement);
|
|
9
|
+
return getDirectDisplayScreen(jsonElement.controller).update(jsonElement, authoritative);
|
|
10
10
|
}
|
|
11
|
-
return super.update(jsonElement);
|
|
11
|
+
return super.update(jsonElement, authoritative);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
export default DirectDisplayScreen;
|
|
@@ -4,6 +4,6 @@ export declare class DirectDisplayScreenST7567 extends DirectDisplayScreenBase {
|
|
|
4
4
|
constructor();
|
|
5
5
|
contrast: number;
|
|
6
6
|
resistorRatio: number;
|
|
7
|
-
update(jsonElement: any): IModelObject | null;
|
|
7
|
+
update(jsonElement: any, authoritative?: boolean): IModelObject | null;
|
|
8
8
|
}
|
|
9
9
|
export default DirectDisplayScreenST7567;
|
|
@@ -6,14 +6,14 @@ export class DirectDisplayScreenST7567 extends DirectDisplayScreenBase {
|
|
|
6
6
|
this.contrast = 30;
|
|
7
7
|
this.resistorRatio = 6;
|
|
8
8
|
}
|
|
9
|
-
update(jsonElement) {
|
|
9
|
+
update(jsonElement, authoritative = false) {
|
|
10
10
|
if (jsonElement === null) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
if (typeof jsonElement.controller === "string" && jsonElement.controller !== this.controller) {
|
|
14
|
-
return getDirectDisplayScreen(jsonElement.controller).update(jsonElement);
|
|
14
|
+
return getDirectDisplayScreen(jsonElement.controller).update(jsonElement, authoritative);
|
|
15
15
|
}
|
|
16
|
-
return super.update(jsonElement);
|
|
16
|
+
return super.update(jsonElement, authoritative);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
export default DirectDisplayScreenST7567;
|
package/dist/boards/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ import Driver from "./Driver";
|
|
|
5
5
|
export declare class Accelerometer extends ModelObject {
|
|
6
6
|
orientation: number;
|
|
7
7
|
points: number;
|
|
8
|
+
resolution: number;
|
|
8
9
|
runs: number;
|
|
10
|
+
samplingRate: number;
|
|
9
11
|
}
|
|
10
12
|
export declare class BoardClosedLoop extends ModelObject {
|
|
11
13
|
points: number;
|
|
@@ -30,30 +32,43 @@ export declare class Board extends ModelObject {
|
|
|
30
32
|
constructor();
|
|
31
33
|
accelerometer: Accelerometer | null;
|
|
32
34
|
canAddress: number | null;
|
|
33
|
-
closedLoop: BoardClosedLoop | null;
|
|
34
|
-
directDisplay: DirectDisplay | null;
|
|
35
35
|
drivers: ModelCollection<Driver> | null;
|
|
36
36
|
firmwareDate: string;
|
|
37
37
|
firmwareFileName: string;
|
|
38
|
-
firmwareName: string;
|
|
39
38
|
firmwareVersion: string;
|
|
40
39
|
freeRam: number | null;
|
|
41
|
-
iapFileNameSBC: string | null;
|
|
42
|
-
iapFileNameSD: string | null;
|
|
43
|
-
inductiveSensor: InductiveSensor | null;
|
|
44
|
-
maxHeaters: number;
|
|
45
40
|
maxMotors: number;
|
|
46
41
|
mcuTemp: MinMaxCurrent | null;
|
|
47
42
|
name: string;
|
|
48
43
|
shortName: string;
|
|
49
|
-
state: BoardState;
|
|
50
|
-
supportsDirectDisplay: boolean;
|
|
51
|
-
timeout: number;
|
|
52
44
|
uniqueId: string | null;
|
|
53
45
|
v12: MinMaxCurrent | null;
|
|
54
46
|
vIn: MinMaxCurrent | null;
|
|
47
|
+
}
|
|
48
|
+
export declare class MainBoard extends Board {
|
|
49
|
+
constructor();
|
|
50
|
+
directDisplay: DirectDisplay | null;
|
|
51
|
+
firmwareName: string;
|
|
52
|
+
iapFileNameSBC: string | null;
|
|
53
|
+
iapFileNameSD: string | null;
|
|
54
|
+
maxHeaters: number;
|
|
55
|
+
supportsDirectDisplay: boolean;
|
|
55
56
|
wifiFirmwareFileName: string | null;
|
|
56
57
|
}
|
|
58
|
+
export declare class ExpansionBoard extends Board {
|
|
59
|
+
constructor();
|
|
60
|
+
closedLoop: BoardClosedLoop | null;
|
|
61
|
+
inductiveSensor: InductiveSensor | null;
|
|
62
|
+
state: BoardState;
|
|
63
|
+
timeout: number;
|
|
64
|
+
}
|
|
57
65
|
export default Board;
|
|
66
|
+
/**
|
|
67
|
+
* Create the board instance for a given index. The first item is always the mainboard,
|
|
68
|
+
* every other item is an expansion board connected over CAN
|
|
69
|
+
* @param index Index in the boards array
|
|
70
|
+
* @returns New board instance
|
|
71
|
+
*/
|
|
72
|
+
export declare function getBoard(index: number): Board;
|
|
58
73
|
export * from "./directDisplay";
|
|
59
74
|
export * from "./Driver";
|
package/dist/boards/index.js
CHANGED
|
@@ -7,7 +7,9 @@ export class Accelerometer extends ModelObject {
|
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.orientation = 20;
|
|
9
9
|
this.points = 0;
|
|
10
|
+
this.resolution = 0;
|
|
10
11
|
this.runs = 0;
|
|
12
|
+
this.samplingRate = 0;
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
15
|
export class BoardClosedLoop extends ModelObject {
|
|
@@ -41,39 +43,58 @@ export class Board extends ModelObject {
|
|
|
41
43
|
super();
|
|
42
44
|
this.accelerometer = null;
|
|
43
45
|
this.canAddress = null;
|
|
44
|
-
this.closedLoop = null;
|
|
45
|
-
this.directDisplay = null;
|
|
46
46
|
this.drivers = null;
|
|
47
47
|
this.firmwareDate = "";
|
|
48
48
|
this.firmwareFileName = "";
|
|
49
|
-
this.firmwareName = "";
|
|
50
49
|
this.firmwareVersion = "";
|
|
51
50
|
this.freeRam = null;
|
|
52
|
-
this.iapFileNameSBC = null;
|
|
53
|
-
this.iapFileNameSD = null;
|
|
54
|
-
this.inductiveSensor = null;
|
|
55
|
-
this.maxHeaters = 0;
|
|
56
51
|
this.maxMotors = 0;
|
|
57
52
|
this.mcuTemp = null;
|
|
58
53
|
this.name = "";
|
|
59
54
|
this.shortName = "";
|
|
60
|
-
this.state = BoardState.unknown;
|
|
61
|
-
this.supportsDirectDisplay = false;
|
|
62
|
-
this.timeout = 10;
|
|
63
55
|
this.uniqueId = null;
|
|
64
56
|
this.v12 = null;
|
|
65
57
|
this.vIn = null;
|
|
66
|
-
this.wifiFirmwareFileName = null;
|
|
67
58
|
ModelObject.wrapModelProperty(this, "accelerometer", Accelerometer);
|
|
68
|
-
ModelObject.wrapModelProperty(this, "closedLoop", BoardClosedLoop);
|
|
69
|
-
ModelObject.wrapModelProperty(this, "directDisplay", DirectDisplay);
|
|
70
59
|
ModelObject.wrapModelCollectionProperty(this, "drivers", Driver);
|
|
71
|
-
ModelObject.wrapModelProperty(this, "inductiveSensor", InductiveSensor);
|
|
72
60
|
ModelObject.wrapModelProperty(this, "mcuTemp", MinMaxCurrent);
|
|
73
61
|
ModelObject.wrapModelProperty(this, "v12", MinMaxCurrent);
|
|
74
62
|
ModelObject.wrapModelProperty(this, "vIn", MinMaxCurrent);
|
|
75
63
|
}
|
|
76
64
|
}
|
|
65
|
+
export class MainBoard extends Board {
|
|
66
|
+
constructor() {
|
|
67
|
+
super();
|
|
68
|
+
this.directDisplay = null;
|
|
69
|
+
this.firmwareName = "";
|
|
70
|
+
this.iapFileNameSBC = null;
|
|
71
|
+
this.iapFileNameSD = null;
|
|
72
|
+
this.maxHeaters = 0;
|
|
73
|
+
this.supportsDirectDisplay = false;
|
|
74
|
+
this.wifiFirmwareFileName = null;
|
|
75
|
+
ModelObject.wrapModelProperty(this, "directDisplay", DirectDisplay);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export class ExpansionBoard extends Board {
|
|
79
|
+
constructor() {
|
|
80
|
+
super();
|
|
81
|
+
this.closedLoop = null;
|
|
82
|
+
this.inductiveSensor = null;
|
|
83
|
+
this.state = BoardState.unknown;
|
|
84
|
+
this.timeout = 10;
|
|
85
|
+
ModelObject.wrapModelProperty(this, "closedLoop", BoardClosedLoop);
|
|
86
|
+
ModelObject.wrapModelProperty(this, "inductiveSensor", InductiveSensor);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
77
89
|
export default Board;
|
|
90
|
+
/**
|
|
91
|
+
* Create the board instance for a given index. The first item is always the mainboard,
|
|
92
|
+
* every other item is an expansion board connected over CAN
|
|
93
|
+
* @param index Index in the boards array
|
|
94
|
+
* @returns New board instance
|
|
95
|
+
*/
|
|
96
|
+
export function getBoard(index) {
|
|
97
|
+
return (index === 0) ? new MainBoard() : new ExpansionBoard();
|
|
98
|
+
}
|
|
78
99
|
export * from "./directDisplay";
|
|
79
100
|
export * from "./Driver";
|