@duet3d/objectmodel 3.4.0

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.
Files changed (119) hide show
  1. package/LICENSE +504 -0
  2. package/README.md +7 -0
  3. package/lib/ModelCollection.d.ts +25 -0
  4. package/lib/ModelCollection.js +79 -0
  5. package/lib/ModelDictionary.d.ts +28 -0
  6. package/lib/ModelDictionary.js +68 -0
  7. package/lib/ModelObject.d.ts +35 -0
  8. package/lib/ModelObject.js +155 -0
  9. package/lib/boards/index.d.ts +49 -0
  10. package/lib/boards/index.js +78 -0
  11. package/lib/directories/index.d.ts +11 -0
  12. package/lib/directories/index.js +17 -0
  13. package/lib/fans/index.d.ts +17 -0
  14. package/lib/fans/index.js +28 -0
  15. package/lib/heat/Heater.d.ts +24 -0
  16. package/lib/heat/Heater.js +32 -0
  17. package/lib/heat/HeaterModel.d.ts +20 -0
  18. package/lib/heat/HeaterModel.js +31 -0
  19. package/lib/heat/HeaterMonitor.d.ts +17 -0
  20. package/lib/heat/HeaterMonitor.js +26 -0
  21. package/lib/heat/index.d.ts +10 -0
  22. package/lib/heat/index.js +16 -0
  23. package/lib/httpEndpoints/index.d.ts +18 -0
  24. package/lib/httpEndpoints/index.js +26 -0
  25. package/lib/index.d.ts +44 -0
  26. package/lib/index.js +59 -0
  27. package/lib/inputs/CodeChannel.d.ts +15 -0
  28. package/lib/inputs/CodeChannel.js +19 -0
  29. package/lib/inputs/Compatibility.d.ts +9 -0
  30. package/lib/inputs/Compatibility.js +13 -0
  31. package/lib/inputs/InputChannel.d.ts +27 -0
  32. package/lib/inputs/InputChannel.js +36 -0
  33. package/lib/job/Build.d.ts +14 -0
  34. package/lib/job/Build.js +25 -0
  35. package/lib/job/GCodeFileInfo.d.ts +16 -0
  36. package/lib/job/GCodeFileInfo.js +22 -0
  37. package/lib/job/ThumbnailInfo.d.ts +14 -0
  38. package/lib/job/ThumbnailInfo.js +22 -0
  39. package/lib/job/index.d.ts +36 -0
  40. package/lib/job/index.js +52 -0
  41. package/lib/limits/index.d.ts +28 -0
  42. package/lib/limits/index.js +34 -0
  43. package/lib/messages/index.d.ts +12 -0
  44. package/lib/messages/index.js +26 -0
  45. package/lib/move/Axis.d.ts +51 -0
  46. package/lib/move/Axis.js +59 -0
  47. package/lib/move/DriverId.d.ts +7 -0
  48. package/lib/move/DriverId.js +29 -0
  49. package/lib/move/Extruder.d.ts +26 -0
  50. package/lib/move/Extruder.js +37 -0
  51. package/lib/move/InputShaping.d.ts +18 -0
  52. package/lib/move/InputShaping.js +26 -0
  53. package/lib/move/Microstepping.d.ts +5 -0
  54. package/lib/move/Microstepping.js +11 -0
  55. package/lib/move/MoveCalibration.d.ts +10 -0
  56. package/lib/move/MoveCalibration.js +21 -0
  57. package/lib/move/MoveCompensation.d.ts +29 -0
  58. package/lib/move/MoveCompensation.js +46 -0
  59. package/lib/move/index.d.ts +46 -0
  60. package/lib/move/index.js +69 -0
  61. package/lib/move/kinematics/CoreKinematics.d.ts +8 -0
  62. package/lib/move/kinematics/CoreKinematics.js +29 -0
  63. package/lib/move/kinematics/DeltaKinematics.d.ts +19 -0
  64. package/lib/move/kinematics/DeltaKinematics.js +39 -0
  65. package/lib/move/kinematics/HangprinterKinematics.d.ts +8 -0
  66. package/lib/move/kinematics/HangprinterKinematics.js +25 -0
  67. package/lib/move/kinematics/KinematicsBase.d.ts +36 -0
  68. package/lib/move/kinematics/KinematicsBase.js +55 -0
  69. package/lib/move/kinematics/PolarKinematics.d.ts +6 -0
  70. package/lib/move/kinematics/PolarKinematics.js +19 -0
  71. package/lib/move/kinematics/ScaraKinematics.d.ts +5 -0
  72. package/lib/move/kinematics/ScaraKinematics.js +16 -0
  73. package/lib/move/kinematics/index.d.ts +7 -0
  74. package/lib/move/kinematics/index.js +48 -0
  75. package/lib/network/NetworkInterface.d.ts +27 -0
  76. package/lib/network/NetworkInterface.js +36 -0
  77. package/lib/network/index.d.ts +12 -0
  78. package/lib/network/index.js +19 -0
  79. package/lib/plugins/PluginManifest.d.ts +59 -0
  80. package/lib/plugins/PluginManifest.js +112 -0
  81. package/lib/plugins/index.d.ts +7 -0
  82. package/lib/plugins/index.js +13 -0
  83. package/lib/scanner/index.d.ts +13 -0
  84. package/lib/scanner/index.js +21 -0
  85. package/lib/sensors/AnalogSensor.d.ts +23 -0
  86. package/lib/sensors/AnalogSensor.js +31 -0
  87. package/lib/sensors/Endstop.d.ts +13 -0
  88. package/lib/sensors/Endstop.js +21 -0
  89. package/lib/sensors/FilamentMonitors/FilamentMonitorBase.d.ts +23 -0
  90. package/lib/sensors/FilamentMonitors/FilamentMonitorBase.js +31 -0
  91. package/lib/sensors/FilamentMonitors/LaserFilamentMonitor.d.ts +21 -0
  92. package/lib/sensors/FilamentMonitors/LaserFilamentMonitor.js +45 -0
  93. package/lib/sensors/FilamentMonitors/PulsedFilamentMonitor.d.ts +20 -0
  94. package/lib/sensors/FilamentMonitors/PulsedFilamentMonitor.js +44 -0
  95. package/lib/sensors/FilamentMonitors/RotatingMagnetFilamentMonitor.d.ts +21 -0
  96. package/lib/sensors/FilamentMonitors/RotatingMagnetFilamentMonitor.js +45 -0
  97. package/lib/sensors/FilamentMonitors/index.d.ts +6 -0
  98. package/lib/sensors/FilamentMonitors/index.js +32 -0
  99. package/lib/sensors/Probe.d.ts +32 -0
  100. package/lib/sensors/Probe.js +40 -0
  101. package/lib/sensors/index.d.ts +16 -0
  102. package/lib/sensors/index.js +27 -0
  103. package/lib/spindles/index.d.ts +16 -0
  104. package/lib/spindles/index.js +24 -0
  105. package/lib/state/MachineStatus.d.ts +16 -0
  106. package/lib/state/MachineStatus.js +20 -0
  107. package/lib/state/MessageBox.d.ts +15 -0
  108. package/lib/state/MessageBox.js +23 -0
  109. package/lib/state/RestorePoint.d.ts +11 -0
  110. package/lib/state/RestorePoint.js +17 -0
  111. package/lib/state/index.d.ts +52 -0
  112. package/lib/state/index.js +70 -0
  113. package/lib/tools/index.d.ts +25 -0
  114. package/lib/tools/index.js +33 -0
  115. package/lib/userSessions/index.d.ts +17 -0
  116. package/lib/userSessions/index.js +26 -0
  117. package/lib/volumes/index.d.ts +10 -0
  118. package/lib/volumes/index.js +16 -0
  119. package/package.json +29 -0
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModelDictionary = void 0;
4
+ const ModelObject_1 = require("./ModelObject");
5
+ /**
6
+ * Dictionary class to map object model data
7
+ */
8
+ class ModelDictionary extends Map {
9
+ /**
10
+ * Constructor of this class
11
+ * @param nullDeletesKeys Whether setting null to items effectively deletes them
12
+ * @param itemConstructor Item constructor type to use for type-checking
13
+ */
14
+ constructor(nullDeletesKeys, itemConstructor = null) {
15
+ super();
16
+ this.itemConstructor = itemConstructor;
17
+ this.nullDeletesKeys = nullDeletesKeys;
18
+ Object.setPrototypeOf(this, ModelDictionary.prototype);
19
+ }
20
+ /**
21
+ * Overridden set method to perform type-checks and update
22
+ * @param key Key to set
23
+ * @param value Value to set
24
+ */
25
+ set(key, value) {
26
+ if (value === null) {
27
+ if (this.nullDeletesKeys) {
28
+ this.delete(key);
29
+ return this;
30
+ }
31
+ return super.set(key, value);
32
+ }
33
+ const currentItem = this.get(key);
34
+ if (currentItem == null) {
35
+ if (this.itemConstructor !== null && !(value instanceof this.itemConstructor)) {
36
+ const newItem = new this.itemConstructor();
37
+ if ((0, ModelObject_1.isModelObject)(newItem)) {
38
+ const updatedItem = newItem.update(value);
39
+ return super.set(key, updatedItem);
40
+ }
41
+ }
42
+ }
43
+ else if ((0, ModelObject_1.isModelObject)(currentItem)) {
44
+ const newItem = currentItem.update(value);
45
+ if (currentItem !== newItem) {
46
+ return super.set(key, value);
47
+ }
48
+ }
49
+ return super.set(key, value);
50
+ }
51
+ /**
52
+ * Update this instance from the given data
53
+ * @param jsonElement JSON data to upgrade this instance from
54
+ * @returns Updated instance
55
+ */
56
+ update(jsonElement) {
57
+ if (jsonElement === null) {
58
+ this.clear();
59
+ }
60
+ else {
61
+ for (const [key, value] of Object.entries(jsonElement)) {
62
+ this.set(key, value);
63
+ }
64
+ }
65
+ return this;
66
+ }
67
+ }
68
+ exports.ModelDictionary = ModelDictionary;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Interface for updating model objects using JSON data
3
+ */
4
+ export interface IModelObject {
5
+ /**
6
+ * Update this instance from the given data
7
+ * @param jsonElement JSON data to upgrade this instance from
8
+ * @returns Updated instance (may not equal the original instance)
9
+ */
10
+ update(jsonElement: any): IModelObject | null;
11
+ }
12
+ /**
13
+ * Check whether a given value provides model update functionality
14
+ * @param value Value to check
15
+ */
16
+ export declare function isModelObject(value: any): value is IModelObject;
17
+ /**
18
+ * Base class for object model classes
19
+ */
20
+ export default abstract class ModelObject implements IModelObject {
21
+ /**
22
+ * Update this instance from the given data
23
+ * @param jsonElement JSON data to upgrade this instance from
24
+ * @returns Updated instance (may not equal the original instance)
25
+ */
26
+ update(jsonElement: any): IModelObject | null;
27
+ /**
28
+ * Wrap a nullable model object property so that type checks can be performed
29
+ * @param key Property key of the derived class
30
+ * @param constructor Constructor for creating new elements
31
+ */
32
+ wrapModelProperty<K extends keyof this, T extends IModelObject>(key: K, constructor: {
33
+ new (): T;
34
+ }): void;
35
+ }
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isModelObject = void 0;
4
+ const index_1 = require("./index");
5
+ /**
6
+ * Check whether a given value provides model update functionality
7
+ * @param value Value to check
8
+ */
9
+ function isModelObject(value) {
10
+ return (value instanceof Object) && value.update !== undefined;
11
+ }
12
+ exports.isModelObject = isModelObject;
13
+ /**
14
+ * Base class for object model classes
15
+ */
16
+ class ModelObject {
17
+ /**
18
+ * Update this instance from the given data
19
+ * @param jsonElement JSON data to upgrade this instance from
20
+ * @returns Updated instance (may not equal the original instance)
21
+ */
22
+ update(jsonElement) {
23
+ if (jsonElement === null) {
24
+ return null;
25
+ }
26
+ for (const [key, value] of Object.entries(jsonElement)) {
27
+ if (key in this) {
28
+ const ownKey = key;
29
+ const prop = this[ownKey];
30
+ if (isModelObject(prop)) {
31
+ // Update model objects
32
+ const updatedObject = prop.update(value);
33
+ if (prop !== updatedObject) {
34
+ const propDescriptor = Object.getOwnPropertyDescriptor(this, key);
35
+ if (propDescriptor !== undefined) {
36
+ if (propDescriptor.writable) {
37
+ this[ownKey] = updatedObject;
38
+ }
39
+ else if (propDescriptor.set !== undefined) {
40
+ propDescriptor.set(updatedObject);
41
+ }
42
+ else if (process.env.NODE_ENV !== "production") {
43
+ console.warn(`Model object ${key} changed but it could not be set due to missing setter`);
44
+ }
45
+ }
46
+ }
47
+ }
48
+ else if (prop instanceof Array) {
49
+ if (value instanceof Array) {
50
+ // Remove deleted items
51
+ prop.splice(value.length);
52
+ // Update existing items
53
+ for (let i = 0; i < Math.min(prop.length, value.length); i++) {
54
+ const propItem = prop[i];
55
+ if (propItem === null) {
56
+ (0, index_1.setArrayItem)(prop, i, value[i]);
57
+ }
58
+ else {
59
+ const newItem = value[i];
60
+ if (propItem !== newItem) {
61
+ (0, index_1.setArrayItem)(prop, i, newItem);
62
+ }
63
+ }
64
+ }
65
+ // Add new items
66
+ for (let i = prop.length; i < value.length; i++) {
67
+ prop.push(value[i]);
68
+ }
69
+ }
70
+ else if (process.env.NODE_ENV !== "production") {
71
+ console.warn(`Model array ${key} could not be changed because the target type ${typeof value} is invalid`);
72
+ }
73
+ }
74
+ else if (prop === null || value === null) {
75
+ // Unfortunately we cannot do type checks during runtime without excessive extra work and possibly
76
+ // third-party libraries, so skip them for null values until there is a better solution.
77
+ // FWIW, we would just need "typeof prop" but TS does not seem to be capable of providing this.
78
+ this[ownKey] = value;
79
+ }
80
+ else {
81
+ const propType = typeof prop;
82
+ if (propType === "boolean") {
83
+ if (typeof value === "boolean") {
84
+ this[ownKey] = value;
85
+ }
86
+ else if (typeof value === "number") {
87
+ // RRF used to report booleans as integers so convert them if necessary
88
+ this[ownKey] = Boolean(value);
89
+ }
90
+ else if (process.env.NODE_ENV !== "production") {
91
+ console.warn(`Incompatible bool target type ${typeof value} for property ${key}`);
92
+ }
93
+ }
94
+ else if (propType === "number") {
95
+ if (typeof value === "number") {
96
+ this[ownKey] = value;
97
+ }
98
+ else if (process.env.NODE_ENV !== "production") {
99
+ console.warn(`Incompatible number target type ${typeof value} for property ${key}`);
100
+ }
101
+ }
102
+ else if (propType === "bigint") {
103
+ if (typeof value === "number" || typeof value === "bigint") {
104
+ this[ownKey] = value;
105
+ }
106
+ else if (process.env.NODE_ENV !== "production") {
107
+ console.warn(`Incompatible bigint target type ${typeof value} for property ${key}`);
108
+ }
109
+ }
110
+ else if (propType === "string") {
111
+ if (typeof value === "string") {
112
+ this[ownKey] = value;
113
+ }
114
+ else if (process.env.NODE_ENV !== "production") {
115
+ console.warn(`Incompatible string target type ${typeof value} for property ${key}`);
116
+ }
117
+ }
118
+ else if (process.env.NODE_ENV !== "production") {
119
+ console.warn(`Incompatible type ${propType} for property ${key} (${typeof value})`);
120
+ }
121
+ }
122
+ }
123
+ }
124
+ return this;
125
+ }
126
+ /**
127
+ * Wrap a nullable model object property so that type checks can be performed
128
+ * @param key Property key of the derived class
129
+ * @param constructor Constructor for creating new elements
130
+ */
131
+ wrapModelProperty(key, constructor) {
132
+ let propertyValue = this[key];
133
+ Object.defineProperty(this, key, {
134
+ get() { return propertyValue; },
135
+ set(newValue) {
136
+ if (newValue === null) {
137
+ propertyValue = null;
138
+ }
139
+ else if (propertyValue !== null) {
140
+ const newModel = propertyValue.update(newValue);
141
+ if (propertyValue !== newModel) {
142
+ propertyValue = newModel;
143
+ }
144
+ }
145
+ else {
146
+ const newModel = new constructor();
147
+ propertyValue = newModel.update(newValue);
148
+ }
149
+ },
150
+ configurable: true,
151
+ enumerable: true
152
+ });
153
+ }
154
+ }
155
+ exports.default = ModelObject;
@@ -0,0 +1,49 @@
1
+ import ModelObject from "../ModelObject";
2
+ export declare class Accelerometer extends ModelObject {
3
+ points: number;
4
+ runs: number;
5
+ }
6
+ export declare enum BoardState {
7
+ unknown = "unknown",
8
+ flashing = "flashing",
9
+ flashFailed = "flashFailed",
10
+ resetting = "resetting",
11
+ running = "running"
12
+ }
13
+ export declare class ClosedLoop extends ModelObject {
14
+ points: number;
15
+ runs: number;
16
+ }
17
+ export declare class MinMaxCurrent extends ModelObject {
18
+ current: number;
19
+ min: number;
20
+ max: number;
21
+ }
22
+ export declare class DirectDisplay extends ModelObject {
23
+ pulsesPerClick: number;
24
+ spiFreq: number;
25
+ typeName: string;
26
+ }
27
+ export default class Board extends ModelObject {
28
+ constructor();
29
+ accelerometer: Accelerometer | null;
30
+ bootloaderFileName: string | null;
31
+ canAddress: number | null;
32
+ closedLoop: ClosedLoop | null;
33
+ directDisplay: DirectDisplay | null;
34
+ firmwareDate: string;
35
+ firmwareFileName: string;
36
+ firmwareVersion: string;
37
+ iapFileNameSBC: string | null;
38
+ iapFileNameSD: string | null;
39
+ maxHeaters: number;
40
+ maxMotors: number;
41
+ mcuTemp: MinMaxCurrent | null;
42
+ name: string;
43
+ shortName: string;
44
+ state: BoardState;
45
+ supportsDirectDisplay: boolean;
46
+ uniqueId: string | null;
47
+ v12: MinMaxCurrent | null;
48
+ vIn: MinMaxCurrent | null;
49
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DirectDisplay = exports.MinMaxCurrent = exports.ClosedLoop = exports.BoardState = exports.Accelerometer = void 0;
4
+ const ModelObject_1 = require("../ModelObject");
5
+ class Accelerometer extends ModelObject_1.default {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.points = 0;
9
+ this.runs = 0;
10
+ }
11
+ }
12
+ exports.Accelerometer = Accelerometer;
13
+ var BoardState;
14
+ (function (BoardState) {
15
+ BoardState["unknown"] = "unknown";
16
+ BoardState["flashing"] = "flashing";
17
+ BoardState["flashFailed"] = "flashFailed";
18
+ BoardState["resetting"] = "resetting";
19
+ BoardState["running"] = "running";
20
+ })(BoardState = exports.BoardState || (exports.BoardState = {}));
21
+ class ClosedLoop extends ModelObject_1.default {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.points = 0;
25
+ this.runs = 0;
26
+ }
27
+ }
28
+ exports.ClosedLoop = ClosedLoop;
29
+ class MinMaxCurrent extends ModelObject_1.default {
30
+ constructor() {
31
+ super(...arguments);
32
+ this.current = 0;
33
+ this.min = 0;
34
+ this.max = 0;
35
+ }
36
+ }
37
+ exports.MinMaxCurrent = MinMaxCurrent;
38
+ class DirectDisplay extends ModelObject_1.default {
39
+ constructor() {
40
+ super(...arguments);
41
+ this.pulsesPerClick = 0;
42
+ this.spiFreq = 0;
43
+ this.typeName = "";
44
+ }
45
+ }
46
+ exports.DirectDisplay = DirectDisplay;
47
+ class Board extends ModelObject_1.default {
48
+ constructor() {
49
+ super();
50
+ this.accelerometer = null;
51
+ this.bootloaderFileName = null;
52
+ this.canAddress = 0;
53
+ this.closedLoop = null;
54
+ this.directDisplay = null;
55
+ this.firmwareDate = "";
56
+ this.firmwareFileName = "";
57
+ this.firmwareVersion = "";
58
+ this.iapFileNameSBC = null;
59
+ this.iapFileNameSD = null;
60
+ this.maxHeaters = 0;
61
+ this.maxMotors = 0;
62
+ this.mcuTemp = null;
63
+ this.name = "";
64
+ this.shortName = "";
65
+ this.state = BoardState.unknown;
66
+ this.supportsDirectDisplay = false;
67
+ this.uniqueId = null;
68
+ this.v12 = null;
69
+ this.vIn = null;
70
+ this.wrapModelProperty("accelerometer", Accelerometer);
71
+ this.wrapModelProperty("closedLoop", ClosedLoop);
72
+ this.wrapModelProperty("directDisplay", DirectDisplay);
73
+ this.wrapModelProperty("mcuTemp", MinMaxCurrent);
74
+ this.wrapModelProperty("v12", MinMaxCurrent);
75
+ this.wrapModelProperty("vIn", MinMaxCurrent);
76
+ }
77
+ }
78
+ exports.default = Board;
@@ -0,0 +1,11 @@
1
+ import ModelObject from "../ModelObject";
2
+ export default class Directories extends ModelObject {
3
+ filaments: string;
4
+ firmware: string;
5
+ gCodes: string;
6
+ macros: string;
7
+ menu: string;
8
+ scans: string;
9
+ system: string;
10
+ web: string;
11
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ModelObject_1 = require("../ModelObject");
4
+ class Directories extends ModelObject_1.default {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.filaments = "0:/filaments";
8
+ this.firmware = "0:/firmware";
9
+ this.gCodes = "0:/gcodes";
10
+ this.macros = "0:/macros";
11
+ this.menu = "0:/menu";
12
+ this.scans = "0:/scans";
13
+ this.system = "0:/sys";
14
+ this.web = "0:/www";
15
+ }
16
+ }
17
+ exports.default = Directories;
@@ -0,0 +1,17 @@
1
+ import ModelObject from "../ModelObject";
2
+ export declare class FanThermostaticControl extends ModelObject {
3
+ heaters: Array<number>;
4
+ highTemperature: number | null;
5
+ lowTemperature: number | null;
6
+ }
7
+ export default class Fan extends ModelObject {
8
+ actualValue: number;
9
+ blip: number;
10
+ frequency: number;
11
+ max: number;
12
+ min: number;
13
+ name: string;
14
+ requestedValue: number;
15
+ rpm: number;
16
+ readonly thermostatic: FanThermostaticControl;
17
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FanThermostaticControl = void 0;
4
+ const ModelObject_1 = require("../ModelObject");
5
+ class FanThermostaticControl extends ModelObject_1.default {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.heaters = new Array();
9
+ this.highTemperature = null;
10
+ this.lowTemperature = null;
11
+ }
12
+ }
13
+ exports.FanThermostaticControl = FanThermostaticControl;
14
+ class Fan extends ModelObject_1.default {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.actualValue = 0;
18
+ this.blip = 0.1;
19
+ this.frequency = 250;
20
+ this.max = 1;
21
+ this.min = 0;
22
+ this.name = "";
23
+ this.requestedValue = 0;
24
+ this.rpm = -1;
25
+ this.thermostatic = new FanThermostaticControl();
26
+ }
27
+ }
28
+ exports.default = Fan;
@@ -0,0 +1,24 @@
1
+ import ModelCollection from "../ModelCollection";
2
+ import HeaterModel from "./HeaterModel";
3
+ import ModelObject from "../ModelObject";
4
+ import HeaterMonitor from "./HeaterMonitor";
5
+ export declare enum HeaterState {
6
+ off = "off",
7
+ standby = "standby",
8
+ active = "active",
9
+ fault = "fault",
10
+ tuning = "tuning",
11
+ offline = "offline"
12
+ }
13
+ export default class Heater extends ModelObject {
14
+ active: number;
15
+ avgPwm: number;
16
+ current: number;
17
+ max: number;
18
+ min: number;
19
+ readonly model: HeaterModel;
20
+ readonly monitors: ModelCollection<HeaterMonitor>;
21
+ sensor: number;
22
+ standby: number;
23
+ state: HeaterState;
24
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeaterState = void 0;
4
+ const ModelCollection_1 = require("../ModelCollection");
5
+ const HeaterModel_1 = require("./HeaterModel");
6
+ const ModelObject_1 = require("../ModelObject");
7
+ const HeaterMonitor_1 = require("./HeaterMonitor");
8
+ var HeaterState;
9
+ (function (HeaterState) {
10
+ HeaterState["off"] = "off";
11
+ HeaterState["standby"] = "standby";
12
+ HeaterState["active"] = "active";
13
+ HeaterState["fault"] = "fault";
14
+ HeaterState["tuning"] = "tuning";
15
+ HeaterState["offline"] = "offline";
16
+ })(HeaterState = exports.HeaterState || (exports.HeaterState = {}));
17
+ class Heater extends ModelObject_1.default {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.active = 0;
21
+ this.avgPwm = 0;
22
+ this.current = -273.15;
23
+ this.max = 285;
24
+ this.min = -10;
25
+ this.model = new HeaterModel_1.default();
26
+ this.monitors = new ModelCollection_1.default(HeaterMonitor_1.default);
27
+ this.sensor = -1;
28
+ this.standby = 0;
29
+ this.state = HeaterState.off;
30
+ }
31
+ }
32
+ exports.default = Heater;
@@ -0,0 +1,20 @@
1
+ import ModelObject from "../ModelObject";
2
+ export declare class HeaterModelPID extends ModelObject {
3
+ d: number;
4
+ i: number;
5
+ overridden: boolean;
6
+ p: number;
7
+ used: boolean;
8
+ }
9
+ export default class HeaterModel extends ModelObject {
10
+ coolingExp: number;
11
+ coolingRate: number;
12
+ deadTime: number;
13
+ enabled: boolean;
14
+ fanCoolingRate: number;
15
+ heatingRate: number;
16
+ inverted: boolean;
17
+ maxPwm: number;
18
+ readonly pid: HeaterModelPID;
19
+ standardVoltage: number | null;
20
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeaterModelPID = void 0;
4
+ const ModelObject_1 = require("../ModelObject");
5
+ class HeaterModelPID extends ModelObject_1.default {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.d = 0;
9
+ this.i = 0;
10
+ this.overridden = false;
11
+ this.p = 0;
12
+ this.used = true;
13
+ }
14
+ }
15
+ exports.HeaterModelPID = HeaterModelPID;
16
+ class HeaterModel extends ModelObject_1.default {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.coolingExp = 1.35;
20
+ this.coolingRate = 0.56;
21
+ this.deadTime = 5.5;
22
+ this.enabled = false;
23
+ this.fanCoolingRate = 0.56;
24
+ this.heatingRate = 2.43;
25
+ this.inverted = false;
26
+ this.maxPwm = 1;
27
+ this.pid = new HeaterModelPID();
28
+ this.standardVoltage = null;
29
+ }
30
+ }
31
+ exports.default = HeaterModel;
@@ -0,0 +1,17 @@
1
+ import ModelObject from "../ModelObject";
2
+ export declare enum HeaterMonitorAction {
3
+ generateFault = 0,
4
+ permanentSwitchOff = 1,
5
+ temporarySwitchOff = 2,
6
+ shutDown = 3
7
+ }
8
+ export declare enum HeaterMonitorCondition {
9
+ disabled = "disabled",
10
+ tooHigh = "tooHigh",
11
+ tooLow = "tooLow"
12
+ }
13
+ export default class HeaterMonitor extends ModelObject {
14
+ action: HeaterMonitorAction;
15
+ condition: HeaterMonitorCondition;
16
+ limit: number;
17
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeaterMonitorCondition = exports.HeaterMonitorAction = void 0;
4
+ const ModelObject_1 = require("../ModelObject");
5
+ var HeaterMonitorAction;
6
+ (function (HeaterMonitorAction) {
7
+ HeaterMonitorAction[HeaterMonitorAction["generateFault"] = 0] = "generateFault";
8
+ HeaterMonitorAction[HeaterMonitorAction["permanentSwitchOff"] = 1] = "permanentSwitchOff";
9
+ HeaterMonitorAction[HeaterMonitorAction["temporarySwitchOff"] = 2] = "temporarySwitchOff";
10
+ HeaterMonitorAction[HeaterMonitorAction["shutDown"] = 3] = "shutDown";
11
+ })(HeaterMonitorAction = exports.HeaterMonitorAction || (exports.HeaterMonitorAction = {}));
12
+ var HeaterMonitorCondition;
13
+ (function (HeaterMonitorCondition) {
14
+ HeaterMonitorCondition["disabled"] = "disabled";
15
+ HeaterMonitorCondition["tooHigh"] = "tooHigh";
16
+ HeaterMonitorCondition["tooLow"] = "tooLow";
17
+ })(HeaterMonitorCondition = exports.HeaterMonitorCondition || (exports.HeaterMonitorCondition = {}));
18
+ class HeaterMonitor extends ModelObject_1.default {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.action = HeaterMonitorAction.generateFault;
22
+ this.condition = HeaterMonitorCondition.disabled;
23
+ this.limit = 2000;
24
+ }
25
+ }
26
+ exports.default = HeaterMonitor;
@@ -0,0 +1,10 @@
1
+ import ModelCollection from "../ModelCollection";
2
+ import Heater from "./Heater";
3
+ import ModelObject from "../ModelObject";
4
+ export default class Heat extends ModelObject {
5
+ bedHeaters: Array<number>;
6
+ chamberHeaters: Array<number>;
7
+ coldExtrudeTemperature: number;
8
+ coldRetractTemperature: number;
9
+ readonly heaters: ModelCollection<Heater>;
10
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ModelCollection_1 = require("../ModelCollection");
4
+ const Heater_1 = require("./Heater");
5
+ const ModelObject_1 = require("../ModelObject");
6
+ class Heat extends ModelObject_1.default {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.bedHeaters = new Array();
10
+ this.chamberHeaters = new Array();
11
+ this.coldExtrudeTemperature = 160;
12
+ this.coldRetractTemperature = 90;
13
+ this.heaters = new ModelCollection_1.default(Heater_1.default);
14
+ }
15
+ }
16
+ exports.default = Heat;
@@ -0,0 +1,18 @@
1
+ import ModelObject from "../ModelObject";
2
+ export declare enum HttpEndpointType {
3
+ GET = "GET",
4
+ POST = "POST",
5
+ PUT = "PUT",
6
+ PATCH = "PATCH",
7
+ TRACE = "TRACE",
8
+ DELETE = "DELETE",
9
+ OPTIONS = "OPTIONS",
10
+ WebSocket = "WebSocket"
11
+ }
12
+ export default class HttpEndpoint extends ModelObject {
13
+ endpointType: HttpEndpointType;
14
+ namespace: string;
15
+ path: string;
16
+ isUploadRequest: boolean;
17
+ unixSocket: string;
18
+ }