motion-master-client 0.0.425 → 0.0.426
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 +1 -1
- package/src/api.js +5 -1
- package/src/api.js.map +1 -1
- package/src/lib/motion-master-client.d.ts +28 -1
- package/src/lib/motion-master-client.js +48 -3
- package/src/lib/motion-master-client.js.map +1 -1
- package/src/lib/motion-master-req-res-client.d.ts +15 -5
- package/src/lib/motion-master-req-res-client.js +24 -6
- package/src/lib/motion-master-req-res-client.js.map +1 -1
- package/src/lib/types.d.ts +17 -1
|
@@ -1207,16 +1207,26 @@ export declare class MotionMasterReqResClient {
|
|
|
1207
1207
|
* To indicate that the new set-point is valid and should be executed, you need to trigger a rising edge of the new set-point bit in the controlword.
|
|
1208
1208
|
* This rising edge serves as a signal to the device that a new set-point is being provided.
|
|
1209
1209
|
*
|
|
1210
|
-
* Once the device receives the rising edge of the new set-point bit, it
|
|
1211
|
-
* This indicates that the device has
|
|
1210
|
+
* Once the device receives the rising edge of the new set-point bit, it sets the set-point acknowledge bit in the statusword to 1.
|
|
1211
|
+
* This indicates that the device has taken the new set-point and executes it, for example by moving to the target position.
|
|
1212
1212
|
*
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1213
|
+
* The new set-point bit is written together with the change set immediately bit (5) and the relative bit (6).
|
|
1214
|
+
* The relative bit is set when `relative` is true and cleared otherwise. When it is set, the device adds the target position (0x607A)
|
|
1215
|
+
* to the position selected by the position option code (0x60F2) instead of using it as an absolute position.
|
|
1216
|
+
* The device reads the relative bit from firmware v5.6.0 on; older firmware treats every target as absolute.
|
|
1217
|
+
*
|
|
1218
|
+
* After the device acknowledges the set-point, the new set-point bit and the relative bit are cleared. The running set-point is not affected,
|
|
1219
|
+
* because the device reads both bits only at the rising edge of the new set-point bit. The device then clears the set-point acknowledge bit.
|
|
1220
|
+
* Clearing the relative bit keeps it from turning a later set-point into a relative one, including set-points applied by other software.
|
|
1215
1221
|
*
|
|
1216
1222
|
* It's important to note that the device won't wait for the previous set-point to finish before executing a new set-point.
|
|
1217
1223
|
* If you want to initiate a new set-point while the previous one is still being executed, you need to generate another rising edge of the new set-point bit in the controlword.
|
|
1224
|
+
*
|
|
1225
|
+
* @param deviceRef - Reference to the target device.
|
|
1226
|
+
* @param setPointAckTimeout - Time, in milliseconds, to wait for the set-point acknowledge bit to change (default: 2000).
|
|
1227
|
+
* @param relative - Whether the target position is relative (default: false).
|
|
1218
1228
|
*/
|
|
1219
|
-
applySetPoint(deviceRef: DeviceRef, setPointAckTimeout?: number): Promise<void>;
|
|
1229
|
+
applySetPoint(deviceRef: DeviceRef, setPointAckTimeout?: number, relative?: boolean): Promise<void>;
|
|
1220
1230
|
private waitForSetPointAcknowledge;
|
|
1221
1231
|
/**
|
|
1222
1232
|
* Release brake.
|
|
@@ -2343,16 +2343,26 @@ class MotionMasterReqResClient {
|
|
|
2343
2343
|
* To indicate that the new set-point is valid and should be executed, you need to trigger a rising edge of the new set-point bit in the controlword.
|
|
2344
2344
|
* This rising edge serves as a signal to the device that a new set-point is being provided.
|
|
2345
2345
|
*
|
|
2346
|
-
* Once the device receives the rising edge of the new set-point bit, it
|
|
2347
|
-
* This indicates that the device has
|
|
2346
|
+
* Once the device receives the rising edge of the new set-point bit, it sets the set-point acknowledge bit in the statusword to 1.
|
|
2347
|
+
* This indicates that the device has taken the new set-point and executes it, for example by moving to the target position.
|
|
2348
2348
|
*
|
|
2349
|
-
*
|
|
2350
|
-
*
|
|
2349
|
+
* The new set-point bit is written together with the change set immediately bit (5) and the relative bit (6).
|
|
2350
|
+
* The relative bit is set when `relative` is true and cleared otherwise. When it is set, the device adds the target position (0x607A)
|
|
2351
|
+
* to the position selected by the position option code (0x60F2) instead of using it as an absolute position.
|
|
2352
|
+
* The device reads the relative bit from firmware v5.6.0 on; older firmware treats every target as absolute.
|
|
2353
|
+
*
|
|
2354
|
+
* After the device acknowledges the set-point, the new set-point bit and the relative bit are cleared. The running set-point is not affected,
|
|
2355
|
+
* because the device reads both bits only at the rising edge of the new set-point bit. The device then clears the set-point acknowledge bit.
|
|
2356
|
+
* Clearing the relative bit keeps it from turning a later set-point into a relative one, including set-points applied by other software.
|
|
2351
2357
|
*
|
|
2352
2358
|
* It's important to note that the device won't wait for the previous set-point to finish before executing a new set-point.
|
|
2353
2359
|
* If you want to initiate a new set-point while the previous one is still being executed, you need to generate another rising edge of the new set-point bit in the controlword.
|
|
2360
|
+
*
|
|
2361
|
+
* @param deviceRef - Reference to the target device.
|
|
2362
|
+
* @param setPointAckTimeout - Time, in milliseconds, to wait for the set-point acknowledge bit to change (default: 2000).
|
|
2363
|
+
* @param relative - Whether the target position is relative (default: false).
|
|
2354
2364
|
*/
|
|
2355
|
-
applySetPoint(deviceRef, setPointAckTimeout = 2000) {
|
|
2365
|
+
applySetPoint(deviceRef, setPointAckTimeout = 2000, relative = false) {
|
|
2356
2366
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2357
2367
|
let controlword = yield this.upload(deviceRef, 0x6040, 0);
|
|
2358
2368
|
if ((controlword & 0x0010) > 0) {
|
|
@@ -2361,11 +2371,19 @@ class MotionMasterReqResClient {
|
|
|
2361
2371
|
// Wait for the device to drop set-point acknowledge so the next set produces a real rising edge.
|
|
2362
2372
|
yield this.waitForSetPointAcknowledge(deviceRef, false, setPointAckTimeout);
|
|
2363
2373
|
}
|
|
2364
|
-
|
|
2374
|
+
// Set the new set-point and change set immediately bits, and set or clear the relative bit.
|
|
2375
|
+
controlword = (controlword & 0xffbf) | 0x0010 | 0x0020 | (relative ? 0x0040 : 0);
|
|
2365
2376
|
yield this.download(deviceRef, 0x6040, 0, controlword);
|
|
2366
2377
|
// Wait for the device to acknowledge the new set-point. Until it does, the target reached bit
|
|
2367
2378
|
// (0x6041 bit 10) still reflects the previous set-point, so callers polling it would latch a stale value.
|
|
2368
2379
|
yield this.waitForSetPointAcknowledge(deviceRef, true, setPointAckTimeout);
|
|
2380
|
+
// Clear the new set-point and relative bits, so that the next set-point gets a real rising edge
|
|
2381
|
+
// and is not made relative by a leftover relative bit.
|
|
2382
|
+
controlword = controlword & 0xffaf;
|
|
2383
|
+
yield this.download(deviceRef, 0x6040, 0, controlword);
|
|
2384
|
+
// Wait for the device to see the cleared bit, so that a set-point applied right after this one
|
|
2385
|
+
// cannot land in the same cycle and lose its rising edge.
|
|
2386
|
+
yield this.waitForSetPointAcknowledge(deviceRef, false, setPointAckTimeout);
|
|
2369
2387
|
});
|
|
2370
2388
|
}
|
|
2371
2389
|
waitForSetPointAcknowledge(deviceRef, expected, timeoutMs) {
|