motion-master-client 0.0.360 → 0.0.362

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-master-client",
3
- "version": "0.0.360",
3
+ "version": "0.0.362",
4
4
  "type": "commonjs",
5
5
  "description": "A library and CLI program used for communicating with Motion Master.",
6
6
  "dependencies": {
package/src/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './lib/bits';
1
2
  export * from './lib/cia402';
2
3
  export * from './lib/circulo';
3
4
  export * from './lib/config-file';
@@ -14,6 +15,7 @@ export * from './lib/firmware';
14
15
  export * from './lib/hardware-description';
15
16
  export * from './lib/homing';
16
17
  export * from './lib/integro-encoder-calibration';
18
+ export * from './lib/integro';
17
19
  export * from './lib/integro-variant';
18
20
  export * from './lib/is-online';
19
21
  export * from './lib/limited-range-system-identification';
package/src/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib/bits"), exports);
4
5
  tslib_1.__exportStar(require("./lib/cia402"), exports);
5
6
  tslib_1.__exportStar(require("./lib/circulo"), exports);
6
7
  tslib_1.__exportStar(require("./lib/config-file"), exports);
@@ -17,6 +18,7 @@ tslib_1.__exportStar(require("./lib/firmware"), exports);
17
18
  tslib_1.__exportStar(require("./lib/hardware-description"), exports);
18
19
  tslib_1.__exportStar(require("./lib/homing"), exports);
19
20
  tslib_1.__exportStar(require("./lib/integro-encoder-calibration"), exports);
21
+ tslib_1.__exportStar(require("./lib/integro"), exports);
20
22
  tslib_1.__exportStar(require("./lib/integro-variant"), exports);
21
23
  tslib_1.__exportStar(require("./lib/is-online"), exports);
22
24
  tslib_1.__exportStar(require("./lib/limited-range-system-identification"), exports);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/motion-master-client/src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,wDAA8B;AAC9B,4DAAkC;AAClC,gEAAsC;AACtC,uDAA6B;AAC7B,iEAAuC;AACvC,gEAAsC;AACtC,wDAA8B;AAC9B,8DAAoC;AACpC,yDAA+B;AAC/B,yDAA+B;AAC/B,sDAA4B;AAC5B,yDAA+B;AAC/B,qEAA2C;AAC3C,uDAA6B;AAC7B,4EAAkD;AAClD,gEAAsC;AACtC,0DAAgC;AAChC,oFAA0D;AAC1D,uDAA6B;AAC7B,kEAAwC;AACxC,iEAAuC;AACvC,gEAAsC;AACtC,qEAA2C;AAC3C,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,qEAA2C;AAC3C,uDAA6B;AAC7B,0DAAgC;AAChC,wDAA8B;AAC9B,2DAAiC;AACjC,0DAAgC;AAChC,oDAA0B;AAC1B,wDAA8B;AAC9B,wEAA8C;AAC9C,oDAA0B;AAC1B,uDAA6B;AAC7B,oDAA0B;AAC1B,gEAAsC;AACtC,sDAA4B;AAC5B,sDAA4B;AAC5B,8DAAoC;AACpC,qDAA2B;AAC3B,kFAAwD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/motion-master-client/src/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,uDAA6B;AAC7B,wDAA8B;AAC9B,4DAAkC;AAClC,gEAAsC;AACtC,uDAA6B;AAC7B,iEAAuC;AACvC,gEAAsC;AACtC,wDAA8B;AAC9B,8DAAoC;AACpC,yDAA+B;AAC/B,yDAA+B;AAC/B,sDAA4B;AAC5B,yDAA+B;AAC/B,qEAA2C;AAC3C,uDAA6B;AAC7B,4EAAkD;AAClD,wDAA8B;AAC9B,gEAAsC;AACtC,0DAAgC;AAChC,oFAA0D;AAC1D,uDAA6B;AAC7B,kEAAwC;AACxC,iEAAuC;AACvC,gEAAsC;AACtC,qEAA2C;AAC3C,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,qEAA2C;AAC3C,uDAA6B;AAC7B,0DAAgC;AAChC,wDAA8B;AAC9B,2DAAiC;AACjC,0DAAgC;AAChC,oDAA0B;AAC1B,wDAA8B;AAC9B,wEAA8C;AAC9C,oDAA0B;AAC1B,uDAA6B;AAC7B,oDAA0B;AAC1B,gEAAsC;AACtC,sDAA4B;AAC5B,sDAA4B;AAC5B,8DAAoC;AACpC,qDAA2B;AAC3B,kFAAwD"}
@@ -0,0 +1,130 @@
1
+ export declare const statuswordBitNames: string[];
2
+ export declare const controlwordBitNames: string[];
3
+ export declare const supportedDriveModesBitNames: string[];
4
+ /**
5
+ * An array of status bit names for the Circulo feedback encoder, ordered according to the specific
6
+ * register sequence required by the firmware. Each entry corresponds to a bit in the encoder's status
7
+ * registers, with the name and description of the error if available, or 'r = reserved' if not defined.
8
+ * The array is padded with 'r = reserved' entries to ensure a total length of 32 bits.
9
+ *
10
+ * The bit names are constructed by iterating over the registers in the order specified by `registerOrder`
11
+ * ([1, 2, 0]), and for each register, iterating through its bits. If a bit has an associated error with a
12
+ * name and description in `circuloEncoderRegisterErrors`, it is included in the format `${error.name} = ${error.description}`.
13
+ * Otherwise, 'r = reserved' is used.
14
+ *
15
+ * @remarks
16
+ * - The ordering of registers and bits is critical to match the firmware's expected bit order.
17
+ * - The source of error names and descriptions is the `circuloEncoderRegisterErrors` mapping.
18
+ * - The final array always contains exactly 32 entries.
19
+ */
20
+ export declare const circuloFeedbackEncoderStatusBitNames: string[];
21
+ export declare const safetyStatuswordBitsV1Array: string[];
22
+ export declare const safetyStatuswordBitsV2Array: string[];
23
+ export declare const digitalInputsBitNames: string[];
24
+ export declare const digitalOutputsBitNames: string[];
25
+ /**
26
+ * Creates an array of {@link BitsViewEntry} objects describing the Safety Statusword
27
+ * object (0x6621) byte-wise bit fields.
28
+ *
29
+ * Each entry represents one byte (8 bits) of the Safety Statusword and contains:
30
+ * - CANopen object index (0x6621)
31
+ * - Subindex corresponding to the byte position (1-based)
32
+ * - Bit size (8)
33
+ * - Bit names for that byte
34
+ * - Optional SMM Launchwave version information
35
+ * - A generated label in the format:
36
+ * "Safety Statusword Byte X" or
37
+ * "Safety Statusword V<version> Byte X"
38
+ *
39
+ * If `parameterStructureVersion` is provided, it is converted to the corresponding
40
+ * Launchwave version using `smmParameterStructureVersionToLaunchwaveVersion()`.
41
+ * The resulting version is included in the returned entries and in the generated labels.
42
+ *
43
+ * If `parameterStructureVersion` is not provided, the entries are generated
44
+ * for non-SMM devices and no Launchwave version is associated with them.
45
+ *
46
+ * @param parameterStructureVersion - Optional SMM parameter structure version.
47
+ * If provided, version-specific bit names and labels are generated.
48
+ *
49
+ * @returns Array of {@link BitsViewEntry} objects representing the Safety Statusword bytes.
50
+ */
51
+ export declare function createSafetyStatuswordBitsViewEntries(parameterStructureVersion?: number): BitsViewEntry[];
52
+ /**
53
+ * Collection of {@link BitsViewEntry} definitions describing commonly used
54
+ * parameter bit fields for the motion master client.
55
+ *
56
+ * Each entry specifies:
57
+ * - CANopen object index and subindex
58
+ * - Bit size (in bits)
59
+ * - Associated bit name array
60
+ * - Human-readable label used in the UI
61
+ *
62
+ * The collection includes:
63
+ * - Encoder feedback status objects
64
+ * - Safety module input diagnostics
65
+ * - CiA 402 Controlword (0x6040) and Statusword (0x6041)
66
+ * - Digital inputs and outputs (0x60FD, 0x60FE)
67
+ * - Supported drive modes (0x6502)
68
+ * - Safety Statusword (0x6621) entries
69
+ *
70
+ * Safety Statusword entries are generated dynamically using
71
+ * {@link createSafetyStatuswordBitsViewEntries}:
72
+ * - `undefined` → Non-SMM devices
73
+ * - `0x0041` → SMM Launchwave V1
74
+ * - `0x0203` → SMM Launchwave V2
75
+ *
76
+ * This array is intended to serve as the central registry of bit-field
77
+ * definitions used for parameter bit visualization.
78
+ */
79
+ export declare const parameterBitsViewEntries: BitsViewEntry[];
80
+ /**
81
+ * Describes a bit-field view definition for a specific CANopen object entry.
82
+ *
83
+ * A {@link BitsViewEntry} defines how a parameter should be interpreted and
84
+ * visualized as individual bits in the UI.
85
+ *
86
+ * Properties:
87
+ * - `index` — CANopen object index (e.g. 0x6040).
88
+ * - `subindex` — CANopen object subindex.
89
+ * - `size` — Bit width of the value (e.g. 1, 8, 16, 32).
90
+ * - `names` — Array of bit names. The array length should correspond to `size`,
91
+ * where each element represents the label of a bit position.
92
+ * - `label` — Human-readable label used for display in the UI.
93
+ * - `smmLwVersion` — Optional SMM Launchwave version. If defined, the entry
94
+ * applies only to that specific SMM version.
95
+ */
96
+ export interface BitsViewEntry {
97
+ index: number;
98
+ subindex: number;
99
+ size: number;
100
+ names: string[];
101
+ label: string;
102
+ smmLwVersion?: number;
103
+ }
104
+ /**
105
+ * Finds a `BitsViewEntry` from the parameter bits view registry based on
106
+ * a given CANopen object index and subindex, optionally filtering by
107
+ * a specific parameter structure version.
108
+ *
109
+ * This function supports both standard (non-SMM) and SMM parameters:
110
+ * - For non-SMM lookups (no `parameterStructureVersion` provided), it returns
111
+ * entries without a SMM LW version.
112
+ * - For SMM lookups (`parameterStructureVersion` provided), it maps the
113
+ * structure version to a SMM LW version and returns the entry matching
114
+ * that version.
115
+ *
116
+ * @param index - The CANopen object index of the parameter.
117
+ * @param subindex - The CANopen object subindex of the parameter.
118
+ * @param parameterStructureVersion - Optional version of the parameter structure
119
+ * used to select the correct SMM LW entry.
120
+ *
121
+ * @returns The matching `BitsViewEntry` if found; otherwise, `undefined`.
122
+ */
123
+ export declare function findBitsViewEntry(index: number, subindex: number, parameterStructureVersion?: number): BitsViewEntry | undefined;
124
+ /**
125
+ * Converts a SMM parameter structure version to the corresponding Launchwave version.
126
+ *
127
+ * @param version - The SMM parameter structure version as a number.
128
+ * @returns The Launchwave version: returns 1 if the version is less than 0x0203, otherwise returns 2.
129
+ */
130
+ export declare function smmParameterStructureVersionToLaunchwaveVersion(version: number): number;
@@ -0,0 +1,454 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.smmParameterStructureVersionToLaunchwaveVersion = exports.findBitsViewEntry = exports.parameterBitsViewEntries = exports.createSafetyStatuswordBitsViewEntries = exports.digitalOutputsBitNames = exports.digitalInputsBitNames = exports.safetyStatuswordBitsV2Array = exports.safetyStatuswordBitsV1Array = exports.circuloFeedbackEncoderStatusBitNames = exports.supportedDriveModesBitNames = exports.controlwordBitNames = exports.statuswordBitNames = void 0;
4
+ const encoder_1 = require("./encoder");
5
+ const smm_1 = require("./smm");
6
+ exports.statuswordBitNames = [
7
+ 'rtso = ready to switch on',
8
+ 'so = switched on',
9
+ 'oe = operation enabled',
10
+ 'f = fault',
11
+ 've = voltage enabled',
12
+ 'qs = quick stop',
13
+ 'sod = switch on disabled',
14
+ 'w = warning',
15
+ 'ms = manufacturer-specific',
16
+ 'rm = remote',
17
+ 'tr = target reached',
18
+ 'ila = internal limit active',
19
+ 'oms = operation-mode-specific',
20
+ 'oms = operation-mode-specific',
21
+ 'ms = manufacturer-specific',
22
+ 'ms = manufacturer-specific',
23
+ ];
24
+ exports.controlwordBitNames = [
25
+ 'so = switch on',
26
+ 'ev = enable voltage',
27
+ 'qs = quick stop',
28
+ 'eo = enable operation',
29
+ 'oms = operation mode specific',
30
+ 'oms = operation mode specific',
31
+ 'oms = operation mode specific',
32
+ 'fr = fault reset',
33
+ 'h = halt',
34
+ 'oms = operation mode specific',
35
+ 'r = reserved',
36
+ 'ms = manufacturer-specific',
37
+ 'ms = manufacturer-specific',
38
+ 'ms = manufacturer-specific',
39
+ 'ms = manufacturer-specific',
40
+ 'ms = manufacturer-specific',
41
+ ];
42
+ exports.supportedDriveModesBitNames = [
43
+ 'pp = profile position mode',
44
+ 'vl = velocity mode',
45
+ 'pv = profile velocity mode',
46
+ 'tq = torque mode',
47
+ 'r = reserved',
48
+ 'hm = homing mode',
49
+ 'ip = interpolated position mode',
50
+ 'csp = cyclic synchronous position mode',
51
+ 'csv = cyclic synchronous velocity mode',
52
+ 'cst = cyclic synchronous torque mode',
53
+ 'r = reserved',
54
+ 'r = reserved',
55
+ 'r = reserved',
56
+ 'r = reserved',
57
+ 'r = reserved',
58
+ 'r = reserved',
59
+ 'ms = manufacturer-specific',
60
+ 'ms = manufacturer-specific',
61
+ 'ms = manufacturer-specific',
62
+ 'ms = manufacturer-specific',
63
+ 'ms = manufacturer-specific',
64
+ 'ms = manufacturer-specific',
65
+ 'ms = manufacturer-specific',
66
+ 'ms = manufacturer-specific',
67
+ 'ms = manufacturer-specific',
68
+ 'ms = manufacturer-specific',
69
+ 'ms = manufacturer-specific',
70
+ 'ms = manufacturer-specific',
71
+ 'ms = manufacturer-specific',
72
+ 'ms = manufacturer-specific',
73
+ ];
74
+ /**
75
+ * An array of status bit names for the Circulo feedback encoder, ordered according to the specific
76
+ * register sequence required by the firmware. Each entry corresponds to a bit in the encoder's status
77
+ * registers, with the name and description of the error if available, or 'r = reserved' if not defined.
78
+ * The array is padded with 'r = reserved' entries to ensure a total length of 32 bits.
79
+ *
80
+ * The bit names are constructed by iterating over the registers in the order specified by `registerOrder`
81
+ * ([1, 2, 0]), and for each register, iterating through its bits. If a bit has an associated error with a
82
+ * name and description in `circuloEncoderRegisterErrors`, it is included in the format `${error.name} = ${error.description}`.
83
+ * Otherwise, 'r = reserved' is used.
84
+ *
85
+ * @remarks
86
+ * - The ordering of registers and bits is critical to match the firmware's expected bit order.
87
+ * - The source of error names and descriptions is the `circuloEncoderRegisterErrors` mapping.
88
+ * - The final array always contains exactly 32 entries.
89
+ */
90
+ exports.circuloFeedbackEncoderStatusBitNames = (() => {
91
+ const result = [];
92
+ // Due to the specific ordering in the firmware,
93
+ // the registers have to be ordered in a specific way
94
+ // to get the correct bit order in the final array.
95
+ const registerOrder = [1, 2, 0];
96
+ for (const registerIndex of registerOrder) {
97
+ const statusMap = encoder_1.circuloEncoderRegisterErrors[registerIndex];
98
+ for (let bit = 1; bit <= 0x80; bit <<= 1) {
99
+ const error = statusMap[bit];
100
+ if (error && error.name) {
101
+ result.push(`${error.name} = ${error.description}`);
102
+ }
103
+ else {
104
+ result.push('r = reserved');
105
+ }
106
+ }
107
+ }
108
+ // Push 'r = reserved' until there are 32 bits in total
109
+ while (result.length < 32) {
110
+ result.push('r = reserved');
111
+ }
112
+ return result;
113
+ })();
114
+ exports.safetyStatuswordBitsV1Array = [
115
+ 'ain_valid = analog input valid',
116
+ 'ain_diag = analog input diagnostic',
117
+ 'safe_out2 = safe output 2',
118
+ 'safe_out1 = safe output 1',
119
+ 'safe_in4 = safe input 4',
120
+ 'safe_in3 = safe input 3',
121
+ 'safe_in2 = safe input 2',
122
+ 'safe_in1 = safe input 1',
123
+ 'u = unused',
124
+ 'u = unused',
125
+ 'u = unused',
126
+ 'safe_speed = Safe speed valid',
127
+ 'safe_pos = Safe position valid',
128
+ 'temp_warn = Temperature warning',
129
+ 'SBC = SBC command (state)',
130
+ 'restart_ack = Restart acknowledge required',
131
+ 'SLS4 = SLS Instance 4 state',
132
+ 'SLS3 = SLS Instance 3 state',
133
+ 'SLS2 = SLS Instance 2 state',
134
+ 'SLS1 = SLS Instance 1 state',
135
+ 'u = unused',
136
+ 'u = unused',
137
+ 'SS2 = SS2 state',
138
+ 'SS1 = SS1 state',
139
+ 'error = Error active',
140
+ 'r = reserved',
141
+ 'r = reserved',
142
+ 'r = reserved',
143
+ 'SOS = SOS state',
144
+ 'r = reserved',
145
+ 'r = reserved',
146
+ 'STO = STO state', // 0
147
+ ];
148
+ exports.safetyStatuswordBitsV2Array = [
149
+ 'ain_valid = analog input valid',
150
+ 'ain_diag = analog input diagnostic',
151
+ 'safe_out2 = safe output 2',
152
+ 'safe_out1 = safe output 1',
153
+ 'safe_in4 = safe input 4',
154
+ 'safe_in3 = safe input 3',
155
+ 'safe_in2 = safe input 2',
156
+ 'safe_in1 = safe input 1',
157
+ 'SLT = SLT state',
158
+ 'safe_torque_sign = Safe torque sign valid',
159
+ 'safe_torque = Safe torque valid',
160
+ 'safe_speed = Safe speed valid',
161
+ 'safe_pos = Safe position valid',
162
+ 'temp_warn = Temperature warning',
163
+ 'SBC = SBC command (state)',
164
+ 'restart_ack = Restart acknowledge required',
165
+ 'SLS4 = SLS Instance 4 state',
166
+ 'SLS3 = SLS Instance 3 state',
167
+ 'SLS2 = SLS Instance 2 state',
168
+ 'SLS1 = SLS Instance 1 state',
169
+ 'u = unused',
170
+ 'u = unused',
171
+ 'SS2 = SS2 state',
172
+ 'SS1 = SS1 state',
173
+ 'error = Error active',
174
+ 'r = reserved',
175
+ 'r = reserved',
176
+ 'r = reserved',
177
+ 'SOS = SOS state',
178
+ 'r = reserved',
179
+ 'r = reserved',
180
+ 'STO = STO state', // 0
181
+ ];
182
+ exports.digitalInputsBitNames = [
183
+ 'SNLSS = Shows Negative Limit Switch Status (1=Active, 0=Inactive)',
184
+ 'SPLSS = Shows Positive Limit Switch Status (1=Active, 0=Inactive)',
185
+ 'SHSS = Shows Home Switch Status (1=Active, 0=Inactive)',
186
+ 'SILS = Shows Interlock Status (1=Drive cannot be enabled, 0=Drive can be enabled)',
187
+ 'r = reserved',
188
+ 'r = reserved',
189
+ 'r = reserved',
190
+ 'r = reserved',
191
+ 'r = reserved',
192
+ 'r = reserved',
193
+ 'r = reserved',
194
+ 'r = reserved',
195
+ 'r = reserved',
196
+ 'r = reserved',
197
+ 'r = reserved',
198
+ 'r = reserved',
199
+ 'DI1 = Digital input 1',
200
+ 'DI2 = Digital input 2',
201
+ 'DI3 = Digital input 3',
202
+ 'DI4 = Digital input 4',
203
+ 'DI5 = Digital input 5',
204
+ 'DI6 = Digital input 6',
205
+ 'DI7 = Digital input 7',
206
+ 'DI8 = Digital input 8',
207
+ 'DI9 = Digital input 9',
208
+ 'DI10 = Digital input 10',
209
+ 'DI11 = Digital input 11',
210
+ 'DI12 = Digital input 12',
211
+ 'DI13 = Digital input 13',
212
+ 'DI14 = Digital input 14',
213
+ 'DI15 = Digital input 15',
214
+ 'DI16 = Digital input 16',
215
+ ];
216
+ exports.digitalOutputsBitNames = [
217
+ 'mo_brake = Manual Brake Operation (0=Engage, 1=Disengage)',
218
+ 'r = reserved',
219
+ 'r = reserved',
220
+ 'r = reserved',
221
+ 'r = reserved',
222
+ 'r = reserved',
223
+ 'r = reserved',
224
+ 'r = reserved',
225
+ 'r = reserved',
226
+ 'r = reserved',
227
+ 'r = reserved',
228
+ 'r = reserved',
229
+ 'r = reserved',
230
+ 'r = reserved',
231
+ 'r = reserved',
232
+ 'r = reserved',
233
+ 'DO1 = Digital output 1',
234
+ 'DO2 = Digital output 2',
235
+ 'DO3 = Digital output 3',
236
+ 'DO4 = Digital output 4',
237
+ 'DO5 = Digital output 5',
238
+ 'DO6 = Digital output 6',
239
+ 'DO7 = Digital output 7',
240
+ 'DO8 = Digital output 8',
241
+ 'DO9 = Digital output 9',
242
+ 'DO10 = Digital output 10',
243
+ 'DO11 = Digital output 11',
244
+ 'DO12 = Digital output 12',
245
+ 'DO13 = Digital output 13',
246
+ 'DO14 = Digital output 14',
247
+ 'DO15 = Digital output 15',
248
+ 'DO16 = Digital output 16',
249
+ ];
250
+ /**
251
+ * Creates an array of {@link BitsViewEntry} objects describing the Safety Statusword
252
+ * object (0x6621) byte-wise bit fields.
253
+ *
254
+ * Each entry represents one byte (8 bits) of the Safety Statusword and contains:
255
+ * - CANopen object index (0x6621)
256
+ * - Subindex corresponding to the byte position (1-based)
257
+ * - Bit size (8)
258
+ * - Bit names for that byte
259
+ * - Optional SMM Launchwave version information
260
+ * - A generated label in the format:
261
+ * "Safety Statusword Byte X" or
262
+ * "Safety Statusword V<version> Byte X"
263
+ *
264
+ * If `parameterStructureVersion` is provided, it is converted to the corresponding
265
+ * Launchwave version using `smmParameterStructureVersionToLaunchwaveVersion()`.
266
+ * The resulting version is included in the returned entries and in the generated labels.
267
+ *
268
+ * If `parameterStructureVersion` is not provided, the entries are generated
269
+ * for non-SMM devices and no Launchwave version is associated with them.
270
+ *
271
+ * @param parameterStructureVersion - Optional SMM parameter structure version.
272
+ * If provided, version-specific bit names and labels are generated.
273
+ *
274
+ * @returns Array of {@link BitsViewEntry} objects representing the Safety Statusword bytes.
275
+ */
276
+ function createSafetyStatuswordBitsViewEntries(parameterStructureVersion) {
277
+ const bytes = (0, smm_1.getSafetyStatuswordBitNames)(parameterStructureVersion);
278
+ let smmLwVersion = undefined;
279
+ let labelPrefix = 'Safety Statusword';
280
+ if (parameterStructureVersion) {
281
+ smmLwVersion = smmParameterStructureVersionToLaunchwaveVersion(parameterStructureVersion);
282
+ labelPrefix = `Safety Statusword V${smmLwVersion}`;
283
+ }
284
+ return bytes.map((names, i) => ({
285
+ index: 0x6621,
286
+ subindex: i + 1,
287
+ size: 8,
288
+ names,
289
+ smmLwVersion,
290
+ label: labelPrefix + ` Byte ${i + 1}`,
291
+ }));
292
+ }
293
+ exports.createSafetyStatuswordBitsViewEntries = createSafetyStatuswordBitsViewEntries;
294
+ /**
295
+ * Collection of {@link BitsViewEntry} definitions describing commonly used
296
+ * parameter bit fields for the motion master client.
297
+ *
298
+ * Each entry specifies:
299
+ * - CANopen object index and subindex
300
+ * - Bit size (in bits)
301
+ * - Associated bit name array
302
+ * - Human-readable label used in the UI
303
+ *
304
+ * The collection includes:
305
+ * - Encoder feedback status objects
306
+ * - Safety module input diagnostics
307
+ * - CiA 402 Controlword (0x6040) and Statusword (0x6041)
308
+ * - Digital inputs and outputs (0x60FD, 0x60FE)
309
+ * - Supported drive modes (0x6502)
310
+ * - Safety Statusword (0x6621) entries
311
+ *
312
+ * Safety Statusword entries are generated dynamically using
313
+ * {@link createSafetyStatuswordBitsViewEntries}:
314
+ * - `undefined` → Non-SMM devices
315
+ * - `0x0041` → SMM Launchwave V1
316
+ * - `0x0203` → SMM Launchwave V2
317
+ *
318
+ * This array is intended to serve as the central registry of bit-field
319
+ * definitions used for parameter bit visualization.
320
+ */
321
+ exports.parameterBitsViewEntries = [
322
+ {
323
+ index: 0x2111,
324
+ subindex: 0x04,
325
+ size: 32,
326
+ names: exports.circuloFeedbackEncoderStatusBitNames,
327
+ label: 'Encoder 1 feedback - Encoder status',
328
+ },
329
+ {
330
+ index: 0x2113,
331
+ subindex: 0x04,
332
+ size: 32,
333
+ names: exports.circuloFeedbackEncoderStatusBitNames,
334
+ label: 'Encoder 2 feedback - Encoder status',
335
+ },
336
+ {
337
+ index: 0x2611,
338
+ subindex: 0x01,
339
+ size: 1,
340
+ names: ['I1 - Input 1'],
341
+ label: 'Safety Module input diagnostics: Input 1',
342
+ },
343
+ {
344
+ index: 0x2611,
345
+ subindex: 0x02,
346
+ size: 1,
347
+ names: ['I2 - Input 2'],
348
+ label: 'Safety Module input diagnostics: Input 2',
349
+ },
350
+ {
351
+ index: 0x6040,
352
+ subindex: 0x00,
353
+ size: 16,
354
+ names: exports.controlwordBitNames,
355
+ label: 'Controlword',
356
+ },
357
+ {
358
+ index: 0x6041,
359
+ subindex: 0x00,
360
+ size: 16,
361
+ names: exports.statuswordBitNames,
362
+ label: 'Statusword',
363
+ },
364
+ {
365
+ index: 0x60fd,
366
+ subindex: 0x00,
367
+ size: 32,
368
+ names: exports.digitalInputsBitNames,
369
+ label: 'Digital Inputs',
370
+ },
371
+ {
372
+ index: 0x60fe,
373
+ subindex: 0x01,
374
+ size: 32,
375
+ names: exports.digitalOutputsBitNames,
376
+ label: 'Digital Outputs - Physical outputs',
377
+ },
378
+ {
379
+ index: 0x60fe,
380
+ subindex: 0x02,
381
+ size: 32,
382
+ names: exports.digitalOutputsBitNames,
383
+ label: 'Digital Outputs - Bit mask',
384
+ },
385
+ {
386
+ index: 0x6502,
387
+ subindex: 0x00,
388
+ size: 32,
389
+ names: exports.supportedDriveModesBitNames,
390
+ label: 'Supported drive modes',
391
+ },
392
+ // Safety statusword entries, generated from the bit name arrays
393
+ ...createSafetyStatuswordBitsViewEntries(0x0041),
394
+ ...createSafetyStatuswordBitsViewEntries(0x0203),
395
+ // NOTE: The non-SMM version of the safety statusword entries is intentionally added at the end of the array to
396
+ // ensure that when looking up entries with a specific SMM version, the versioned entries are found first.
397
+ // This allows for correct fallback behavior where if a version-specific entry is not found,
398
+ // the non-versioned entry can still be returned.
399
+ // This is useful fo UI where parameter structure version is always provided,
400
+ // even for non-SMM devices but can be any value.
401
+ ...createSafetyStatuswordBitsViewEntries(undefined),
402
+ ];
403
+ /**
404
+ * Finds a `BitsViewEntry` from the parameter bits view registry based on
405
+ * a given CANopen object index and subindex, optionally filtering by
406
+ * a specific parameter structure version.
407
+ *
408
+ * This function supports both standard (non-SMM) and SMM parameters:
409
+ * - For non-SMM lookups (no `parameterStructureVersion` provided), it returns
410
+ * entries without a SMM LW version.
411
+ * - For SMM lookups (`parameterStructureVersion` provided), it maps the
412
+ * structure version to a SMM LW version and returns the entry matching
413
+ * that version.
414
+ *
415
+ * @param index - The CANopen object index of the parameter.
416
+ * @param subindex - The CANopen object subindex of the parameter.
417
+ * @param parameterStructureVersion - Optional version of the parameter structure
418
+ * used to select the correct SMM LW entry.
419
+ *
420
+ * @returns The matching `BitsViewEntry` if found; otherwise, `undefined`.
421
+ */
422
+ function findBitsViewEntry(index, subindex, parameterStructureVersion) {
423
+ const requestedSmmLwVersion = parameterStructureVersion !== undefined
424
+ ? smmParameterStructureVersionToLaunchwaveVersion(parameterStructureVersion)
425
+ : undefined;
426
+ return exports.parameterBitsViewEntries.find((entry) => {
427
+ // Must match index and subindex
428
+ if (entry.index !== index || entry.subindex !== subindex) {
429
+ return false;
430
+ }
431
+ // Non-SMM: match only non-SMM entries
432
+ if (requestedSmmLwVersion === undefined) {
433
+ return entry.smmLwVersion === undefined;
434
+ }
435
+ // special case when parameter structure version is provided but the entry does not have SMM LW version defined
436
+ if (entry.smmLwVersion === undefined && requestedSmmLwVersion !== undefined) {
437
+ return true;
438
+ }
439
+ // SMM: match only entries with the same Launchwave version
440
+ return entry.smmLwVersion === requestedSmmLwVersion;
441
+ });
442
+ }
443
+ exports.findBitsViewEntry = findBitsViewEntry;
444
+ /**
445
+ * Converts a SMM parameter structure version to the corresponding Launchwave version.
446
+ *
447
+ * @param version - The SMM parameter structure version as a number.
448
+ * @returns The Launchwave version: returns 1 if the version is less than 0x0203, otherwise returns 2.
449
+ */
450
+ function smmParameterStructureVersionToLaunchwaveVersion(version) {
451
+ return version < 0x0203 ? 1 : 2;
452
+ }
453
+ exports.smmParameterStructureVersionToLaunchwaveVersion = smmParameterStructureVersionToLaunchwaveVersion;
454
+ //# sourceMappingURL=bits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bits.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/bits.ts"],"names":[],"mappings":";;;AAAA,uCAAyD;AACzD,+BAAoD;AAEvC,QAAA,kBAAkB,GAAG;IAChC,2BAA2B;IAC3B,kBAAkB;IAClB,wBAAwB;IACxB,WAAW;IACX,sBAAsB;IACtB,iBAAiB;IACjB,0BAA0B;IAC1B,aAAa;IACb,4BAA4B;IAC5B,aAAa;IACb,qBAAqB;IACrB,6BAA6B;IAC7B,+BAA+B;IAC/B,+BAA+B;IAC/B,4BAA4B;IAC5B,4BAA4B;CAC7B,CAAC;AAEW,QAAA,mBAAmB,GAAG;IACjC,gBAAgB;IAChB,qBAAqB;IACrB,iBAAiB;IACjB,uBAAuB;IACvB,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,kBAAkB;IAClB,UAAU;IACV,+BAA+B;IAC/B,cAAc;IACd,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;CAC7B,CAAC;AAEW,QAAA,2BAA2B,GAAG;IACzC,4BAA4B;IAC5B,oBAAoB;IACpB,4BAA4B;IAC5B,kBAAkB;IAClB,cAAc;IACd,kBAAkB;IAClB,iCAAiC;IACjC,wCAAwC;IACxC,wCAAwC;IACxC,sCAAsC;IACtC,cAAc;IACd,cAAc;IACd,cAAc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AO,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClC,CAAC;AAFD,0GAEC"}
@@ -1,4 +1,3 @@
1
- export declare const statuswordBits: string[];
2
1
  /**
3
2
  * CIA402 refers to the CANopen application profile for drives and motion control.
4
3
  * It defines various states that a CiA402-compliant device, such as a motor drive, can be in.
@@ -68,7 +67,6 @@ export declare enum Cia402State {
68
67
  export declare const cia402StateMap: Map<number, Cia402State>;
69
68
  export declare function getCia402State(value: number): Cia402State;
70
69
  export declare function isInternalLimitActive(statusword: number): boolean;
71
- export declare const controlwordBits: string[];
72
70
  /**
73
71
  * In the CiA402 standard for drives and motion control, the controlword is a key component
74
72
  * used to command and control the operation of a CiA402-compliant device, such as a motor drive.
@@ -191,4 +189,3 @@ export declare const modesOfOperationOptions: {
191
189
  'Cyclic synchronous velocity mode': ModesOfOperation;
192
190
  'Cyclic synchronous torque mode': ModesOfOperation;
193
191
  };
194
- export declare const supportedDriveModesBits: string[];