motion-master-client 0.0.392 → 0.0.394

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.
@@ -31,6 +31,7 @@ const encoder_1 = require("./encoder");
31
31
  const pdo_1 = require("./pdo");
32
32
  const integro_1 = require("./integro");
33
33
  const offset_detection_1 = require("./offset-detection");
34
+ const units_1 = require("./units");
34
35
  const { xmlToEsi } = require('ecatmod');
35
36
  /**
36
37
  * This class contains methods for making requests to Motion Master using the injected request/response socket.
@@ -4640,13 +4641,16 @@ class MotionMasterReqResClient {
4640
4641
  *
4641
4642
  * @param deviceRef - Reference to the target device.
4642
4643
  * @param stepIds - Optional list of step IDs to execute. If omitted or empty, all steps are executed.
4644
+ * @param brakeReleaseWaitMs - Time in milliseconds to wait after releasing the brake before proceeding
4645
+ * with each diagnostic step that requires an open brake. Increase this value if the brake does not
4646
+ * fully release within the default period (default: 150).
4643
4647
  * @returns An observable that emits the progress and final state of each offset detection step.
4644
4648
  *
4645
4649
  * @remarks
4646
4650
  * Each emission contains a cloned snapshot of all steps to allow safe external consumption
4647
4651
  * without mutation side effects.
4648
4652
  */
4649
- runOffsetDetection(deviceRef, stepIds = []) {
4653
+ runOffsetDetection(deviceRef, stepIds = [], brakeReleaseWaitMs = 150) {
4650
4654
  return new rxjs_1.Observable((subscriber) => {
4651
4655
  let isCancelled = false;
4652
4656
  // Brake-related state restored in finally block
@@ -4704,21 +4708,21 @@ class MotionMasterReqResClient {
4704
4708
  },
4705
4709
  polePairDetection: {
4706
4710
  execute: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
4707
- yield this.releaseBrake(deviceRef);
4711
+ yield this.releaseBrake(deviceRef, brakeReleaseWaitMs);
4708
4712
  return yield (0, rxjs_1.lastValueFrom)(this.runPolePairDetectionOsCommand(deviceRef));
4709
4713
  }),
4710
4714
  valueKey: 'numberOfPolePairs',
4711
4715
  },
4712
4716
  motorPhaseOrderDetection: {
4713
4717
  execute: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
4714
- yield this.releaseBrake(deviceRef);
4718
+ yield this.releaseBrake(deviceRef, brakeReleaseWaitMs);
4715
4719
  return yield (0, rxjs_1.lastValueFrom)(this.runMotorPhaseOrderDetectionOsCommand(deviceRef));
4716
4720
  }),
4717
4721
  valueKey: 'motorPhaseOrder',
4718
4722
  },
4719
4723
  commutationOffsetMeasurement: {
4720
4724
  execute: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
4721
- measurementMethod === 2 ? yield this.engageBrake(deviceRef) : yield this.releaseBrake(deviceRef);
4725
+ measurementMethod === 2 ? yield this.engageBrake(deviceRef) : yield this.releaseBrake(deviceRef, brakeReleaseWaitMs);
4722
4726
  return yield (0, rxjs_1.lastValueFrom)(this.runCommutationOffsetMeasurementOsCommand(deviceRef));
4723
4727
  }),
4724
4728
  valueKey: 'commutationAngleOffset',
@@ -4819,6 +4823,28 @@ class MotionMasterReqResClient {
4819
4823
  };
4820
4824
  });
4821
4825
  }
4826
+ /**
4827
+ * Returns the display unit string for a device parameter, adjusted for the device's current
4828
+ * SI unit velocity setting (0x60A9) and feed constant configuration (0x6092:01).
4829
+ *
4830
+ * The feed constant is considered enabled when 0x6092:01 is a positive value other than 0xFFFFFFFF.
4831
+ * When enabled, velocity and position units are expressed in feed units (e.g. `mm/min`) instead of
4832
+ * the raw SI unit (e.g. `rpm`). Parameters not affected by these settings are returned unchanged.
4833
+ *
4834
+ * @param deviceRef - Reference to the device to read configuration from.
4835
+ * @param index - Object dictionary index of the parameter.
4836
+ * @param subindex - Object dictionary subindex of the parameter.
4837
+ * @param unit - Base unit string as stored in the parameter metadata (e.g. `"Inc"`, `"rpm"`).
4838
+ * @returns The formatted unit string for display purposes.
4839
+ */
4840
+ getDeviceParameterFormattedUnitDisplay(deviceRef, index, subindex, unit) {
4841
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
4842
+ const siUnitVelocityValue = (yield this.upload(deviceRef, 0x60a9, 0));
4843
+ const feedConstantFeed = (yield this.upload(deviceRef, 0x6092, 1));
4844
+ const feedConstantEnabled = feedConstantFeed !== 0xffffffff && feedConstantFeed > 0;
4845
+ return (0, units_1.getParameterFormattedUnitDisplay)(index, subindex, unit, siUnitVelocityValue, feedConstantEnabled);
4846
+ });
4847
+ }
4822
4848
  }
4823
4849
  exports.MotionMasterReqResClient = MotionMasterReqResClient;
4824
4850
  /**