motion-master-client 0.0.245 → 0.0.247

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 (104) hide show
  1. package/README.md +24 -18
  2. package/package.json +1 -1
  3. package/src/api.js +21 -5
  4. package/src/api.js.map +1 -1
  5. package/src/cli.js +47 -19
  6. package/src/cli.js.map +1 -1
  7. package/src/lib/cia402.js +11 -36
  8. package/src/lib/cia402.js.map +1 -1
  9. package/src/lib/config-file.js +4 -2
  10. package/src/lib/config-file.js.map +1 -1
  11. package/src/lib/data-monitoring.d.ts +4 -4
  12. package/src/lib/data-monitoring.js +8 -6
  13. package/src/lib/data-monitoring.js.map +1 -1
  14. package/src/lib/device-parameter.d.ts +5 -5
  15. package/src/lib/device-parameter.js +10 -44
  16. package/src/lib/device-parameter.js.map +1 -1
  17. package/src/lib/device.d.ts +4 -4
  18. package/src/lib/device.js +9 -7
  19. package/src/lib/device.js.map +1 -1
  20. package/src/lib/encoder.js +4 -1
  21. package/src/lib/encoder.js.map +1 -1
  22. package/src/lib/error-report.d.ts +4 -4
  23. package/src/lib/error-report.js +0 -1
  24. package/src/lib/error-report.js.map +1 -1
  25. package/src/lib/ethercat.js +119 -33
  26. package/src/lib/ethercat.js.map +1 -1
  27. package/src/lib/ethernet.d.ts +3 -3
  28. package/src/lib/ethernet.js +5 -5
  29. package/src/lib/ethernet.js.map +1 -1
  30. package/src/lib/fetch.d.ts +1 -1
  31. package/src/lib/fetch.js +7 -7
  32. package/src/lib/fetch.js.map +1 -1
  33. package/src/lib/firmware.js +3 -1
  34. package/src/lib/firmware.js.map +1 -1
  35. package/src/lib/homing.d.ts +1 -1
  36. package/src/lib/homing.js.map +1 -1
  37. package/src/lib/integro-encoder-calibration.js +11 -4
  38. package/src/lib/integro-encoder-calibration.js.map +1 -1
  39. package/src/lib/integro-variant.js.map +1 -1
  40. package/src/lib/is-online.js +2 -2
  41. package/src/lib/is-online.js.map +1 -1
  42. package/src/lib/logger.js +1 -1
  43. package/src/lib/mmcidb.js.map +1 -1
  44. package/src/lib/monitoring-config.d.ts +1 -1
  45. package/src/lib/monitoring-entry.d.ts +3 -3
  46. package/src/lib/motion-composer.d.ts +4 -4
  47. package/src/lib/motion-composer.js +3 -2
  48. package/src/lib/motion-composer.js.map +1 -1
  49. package/src/lib/motion-master-client.d.ts +10 -10
  50. package/src/lib/motion-master-client.js +15 -10
  51. package/src/lib/motion-master-client.js.map +1 -1
  52. package/src/lib/motion-master-pub-sub-client.d.ts +4 -4
  53. package/src/lib/motion-master-pub-sub-client.js +2 -2
  54. package/src/lib/motion-master-pub-sub-client.js.map +1 -1
  55. package/src/lib/motion-master-pub-sub-socket.d.ts +2 -2
  56. package/src/lib/motion-master-pub-sub-web-socket.d.ts +3 -3
  57. package/src/lib/motion-master-pub-sub-web-socket.js.map +1 -1
  58. package/src/lib/motion-master-pub-sub-worker-socket.d.ts +3 -3
  59. package/src/lib/motion-master-pub-sub-worker-socket.js +1 -1
  60. package/src/lib/motion-master-pub-sub-worker-socket.js.map +1 -1
  61. package/src/lib/motion-master-req-res-client.d.ts +291 -15
  62. package/src/lib/motion-master-req-res-client.js +491 -57
  63. package/src/lib/motion-master-req-res-client.js.map +1 -1
  64. package/src/lib/motion-master-req-res-socket.d.ts +2 -2
  65. package/src/lib/motion-master-req-res-web-socket.d.ts +3 -3
  66. package/src/lib/motion-master-req-res-web-socket.js +2 -2
  67. package/src/lib/motion-master-req-res-web-socket.js.map +1 -1
  68. package/src/lib/motion-master-req-res-worker-socket.d.ts +3 -3
  69. package/src/lib/motion-master-req-res-worker-socket.js.map +1 -1
  70. package/src/lib/online.d.ts +1 -1
  71. package/src/lib/online.js +3 -2
  72. package/src/lib/online.js.map +1 -1
  73. package/src/lib/operators.js.map +1 -1
  74. package/src/lib/options.js +5 -5
  75. package/src/lib/options.js.map +1 -1
  76. package/src/lib/os-command.d.ts +82 -22
  77. package/src/lib/os-command.js +95 -55
  78. package/src/lib/os-command.js.map +1 -1
  79. package/src/lib/parameter.d.ts +1 -1
  80. package/src/lib/parameter.js +6 -4
  81. package/src/lib/parameter.js.map +1 -1
  82. package/src/lib/product-id-range.js +5 -5
  83. package/src/lib/product-id-range.js.map +1 -1
  84. package/src/lib/product.js +256 -34
  85. package/src/lib/product.js.map +1 -1
  86. package/src/lib/request-status-resolver.d.ts +1 -1
  87. package/src/lib/request-status-resolver.js +8 -6
  88. package/src/lib/request-status-resolver.js.map +1 -1
  89. package/src/lib/sii.js +4 -11
  90. package/src/lib/sii.js.map +1 -1
  91. package/src/lib/smm-od-v1.json +1836 -0
  92. package/src/lib/smm.d.ts +63 -0
  93. package/src/lib/smm.js +177 -0
  94. package/src/lib/smm.js.map +1 -0
  95. package/src/lib/types.d.ts +8 -8
  96. package/src/lib/types.js +0 -4
  97. package/src/lib/types.js.map +1 -1
  98. package/src/lib/units.js +11 -23
  99. package/src/lib/units.js.map +1 -1
  100. package/src/lib/util.d.ts +3 -2
  101. package/src/lib/util.js +23 -11
  102. package/src/lib/util.js.map +1 -1
  103. package/src/lib/web-socket-connection-close-codes.js +2 -2
  104. package/src/lib/web-socket-connection-close-codes.js.map +1 -1
@@ -1,4 +1,5 @@
1
- import { RequestStatus } from "./types";
1
+ import { RequestStatus } from './types';
2
+ import { DataType } from 'python-struct';
2
3
  /**
3
4
  * Type guard to determine if the provided value is a OS Command Response object.
4
5
  */
@@ -40,7 +41,7 @@ export interface OsCommandResponse {
40
41
  /**
41
42
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
42
43
  */
43
- fsBuffer?: Uint8Array | null;
44
+ fsBuffer?: Uint8Array | number[] | null | undefined;
44
45
  /**
45
46
  * Reported progress during the OS command execution.
46
47
  *
@@ -108,7 +109,8 @@ export declare enum SmmAcyclicHandlerSubcommandId {
108
109
  TRANSMIT_SOFTWARE = 11,
109
110
  FINALIZE_SOFTWARE_UPDATE = 12,
110
111
  READ_SMM_PARAMETER = 13,
111
- IO_FAILURE_ACKNOWLEDGE = 14
112
+ IO_FAILURE_ACKNOWLEDGE = 14,
113
+ TRIGGER_RESTART = 15
112
114
  }
113
115
  export declare const osCommandErrorCode: {
114
116
  [key: number]: string;
@@ -373,10 +375,14 @@ export interface TorqueConstantMeasurementOsCommandResponse extends OsCommandRes
373
375
  torqueConstant: number;
374
376
  }
375
377
  export declare function createSmmAcyclicHandlerOsCommand(subcommandId: SmmAcyclicHandlerSubcommandId): Uint8Array;
376
- export declare function createSmmAcyclicHandlerReadSmmParameterOsCommand(index: number, subindex: number): Uint8Array;
378
+ export declare function createSmmAcyclicHandlerReadSmmParameterOsCommand(index: number, subindex?: number): Uint8Array;
379
+ export declare function createSmmAcyclicHandlerConfigureSoftwareUpdateOsCommand(fileSize: number): Uint8Array;
377
380
  export interface SmmAcyclicHandlerOsCommandResponse extends OsCommandResponse {
378
381
  parameterValueUpdated?: boolean;
379
382
  }
383
+ export interface SmmAcyclicHandlerLoadParametersForVerificationOsCommandResponse extends OsCommandResponse {
384
+ values: DataType[];
385
+ }
380
386
  export declare function createSkippedCyclesCounterOsCommand(firmwareService?: number): Uint8Array;
381
387
  export interface SkippedCyclesCounterOsCommandResponse extends OsCommandResponse {
382
388
  skippedCycles: number;
@@ -483,7 +489,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
483
489
  /**
484
490
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
485
491
  */
486
- fsBuffer?: Uint8Array | null | undefined;
492
+ fsBuffer?: Uint8Array | number[] | null | undefined;
487
493
  /**
488
494
  * Reported progress during the OS command execution.
489
495
  *
@@ -537,7 +543,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
537
543
  /**
538
544
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
539
545
  */
540
- fsBuffer?: Uint8Array | null | undefined;
546
+ fsBuffer?: Uint8Array | number[] | null | undefined;
541
547
  /**
542
548
  * Reported progress during the OS command execution.
543
549
  *
@@ -591,7 +597,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
591
597
  /**
592
598
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
593
599
  */
594
- fsBuffer?: Uint8Array | null | undefined;
600
+ fsBuffer?: Uint8Array | number[] | null | undefined;
595
601
  /**
596
602
  * Reported progress during the OS command execution.
597
603
  *
@@ -645,7 +651,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
645
651
  /**
646
652
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
647
653
  */
648
- fsBuffer?: Uint8Array | null | undefined;
654
+ fsBuffer?: Uint8Array | number[] | null | undefined;
649
655
  /**
650
656
  * Reported progress during the OS command execution.
651
657
  *
@@ -699,7 +705,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
699
705
  /**
700
706
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
701
707
  */
702
- fsBuffer?: Uint8Array | null | undefined;
708
+ fsBuffer?: Uint8Array | number[] | null | undefined;
703
709
  /**
704
710
  * Reported progress during the OS command execution.
705
711
  *
@@ -753,7 +759,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
753
759
  /**
754
760
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
755
761
  */
756
- fsBuffer?: Uint8Array | null | undefined;
762
+ fsBuffer?: Uint8Array | number[] | null | undefined;
757
763
  /**
758
764
  * Reported progress during the OS command execution.
759
765
  *
@@ -807,7 +813,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
807
813
  /**
808
814
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
809
815
  */
810
- fsBuffer?: Uint8Array | null | undefined;
816
+ fsBuffer?: Uint8Array | number[] | null | undefined;
811
817
  /**
812
818
  * Reported progress during the OS command execution.
813
819
  *
@@ -861,7 +867,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
861
867
  /**
862
868
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
863
869
  */
864
- fsBuffer?: Uint8Array | null | undefined;
870
+ fsBuffer?: Uint8Array | number[] | null | undefined;
865
871
  /**
866
872
  * Reported progress during the OS command execution.
867
873
  *
@@ -915,7 +921,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
915
921
  /**
916
922
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
917
923
  */
918
- fsBuffer?: Uint8Array | null | undefined;
924
+ fsBuffer?: Uint8Array | number[] | null | undefined;
919
925
  /**
920
926
  * Reported progress during the OS command execution.
921
927
  *
@@ -969,7 +975,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
969
975
  /**
970
976
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
971
977
  */
972
- fsBuffer?: Uint8Array | null | undefined;
978
+ fsBuffer?: Uint8Array | number[] | null | undefined;
973
979
  /**
974
980
  * Reported progress during the OS command execution.
975
981
  *
@@ -1023,7 +1029,61 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
1023
1029
  /**
1024
1030
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
1025
1031
  */
1026
- fsBuffer?: Uint8Array | null | undefined;
1032
+ fsBuffer?: Uint8Array | number[] | null | undefined;
1033
+ /**
1034
+ * Reported progress during the OS command execution.
1035
+ *
1036
+ * The progress can be in the range from 0 to 100 and is computed from the command status.
1037
+ * A status value between 100 and 200 indicates that the command is executing with a percentage (100 = 0%, 200 = 100%).
1038
+ */
1039
+ progress?: number | undefined;
1040
+ /**
1041
+ * Status of the request.
1042
+ */
1043
+ request: RequestStatus;
1044
+ /**
1045
+ * Raw response as sent by the device.
1046
+ */
1047
+ response: Uint8Array;
1048
+ } | {
1049
+ values: DataType[];
1050
+ /**
1051
+ * The command that was sent to the device through the 0x1023:01 OS Command.
1052
+ */
1053
+ command?: Uint8Array | undefined;
1054
+ /**
1055
+ * Array of numbers representing the received data.
1056
+ *
1057
+ * The length of data depends on the response type.
1058
+ * If the response number is 3 (Command completed with error and with response),
1059
+ * the length can be up to 5 numbers; otherwise, it can be up to 6 numbers.
1060
+ */
1061
+ data?: number[] | undefined;
1062
+ /**
1063
+ * The error code is only set when the response number is 3 (Command completed with error and with response).
1064
+ *
1065
+ * The meaning of the error code can be general or command specific.
1066
+ * General error codes start at 254 and go downwards:
1067
+ * - 254: Unsupported command
1068
+ * - 253: Command timeout
1069
+ * - 252: Command aborted
1070
+ * - 251: Command not allowed
1071
+ * OS command specific error codes start at 0 and go upwards.
1072
+ */
1073
+ errorCode?: number | undefined;
1074
+ /**
1075
+ * The error name is derived from the OS command number and error code number.
1076
+ */
1077
+ errorName?: string | undefined;
1078
+ /**
1079
+ * The error description is derived from the OS command number and error code number.
1080
+ * The purpose of the error description is to provide more information about the error than the name can.
1081
+ */
1082
+ errorDescription?: string | undefined;
1083
+ /**
1084
+ * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
1085
+ */
1086
+ fsBuffer?: Uint8Array | number[] | null | undefined;
1027
1087
  /**
1028
1088
  * Reported progress during the OS command execution.
1029
1089
  *
@@ -1077,7 +1137,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
1077
1137
  /**
1078
1138
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
1079
1139
  */
1080
- fsBuffer?: Uint8Array | null | undefined;
1140
+ fsBuffer?: Uint8Array | number[] | null | undefined;
1081
1141
  /**
1082
1142
  * Reported progress during the OS command execution.
1083
1143
  *
@@ -1131,7 +1191,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
1131
1191
  /**
1132
1192
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
1133
1193
  */
1134
- fsBuffer?: Uint8Array | null | undefined;
1194
+ fsBuffer?: Uint8Array | number[] | null | undefined;
1135
1195
  /**
1136
1196
  * Reported progress during the OS command execution.
1137
1197
  *
@@ -1185,7 +1245,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
1185
1245
  /**
1186
1246
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
1187
1247
  */
1188
- fsBuffer?: Uint8Array | null | undefined;
1248
+ fsBuffer?: Uint8Array | number[] | null | undefined;
1189
1249
  /**
1190
1250
  * Reported progress during the OS command execution.
1191
1251
  *
@@ -1239,7 +1299,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
1239
1299
  /**
1240
1300
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
1241
1301
  */
1242
- fsBuffer?: Uint8Array | null | undefined;
1302
+ fsBuffer?: Uint8Array | number[] | null | undefined;
1243
1303
  /**
1244
1304
  * Reported progress during the OS command execution.
1245
1305
  *
@@ -1294,7 +1354,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
1294
1354
  /**
1295
1355
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
1296
1356
  */
1297
- fsBuffer?: Uint8Array | null | undefined;
1357
+ fsBuffer?: Uint8Array | number[] | null | undefined;
1298
1358
  /**
1299
1359
  * Reported progress during the OS command execution.
1300
1360
  *
@@ -1348,7 +1408,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
1348
1408
  /**
1349
1409
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
1350
1410
  */
1351
- fsBuffer?: Uint8Array | null | undefined;
1411
+ fsBuffer?: Uint8Array | number[] | null | undefined;
1352
1412
  /**
1353
1413
  * Reported progress during the OS command execution.
1354
1414
  *
@@ -1402,7 +1462,7 @@ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction<imp
1402
1462
  /**
1403
1463
  * Stores the content of the fs-buffer file if accessed during the execution of the OS command.
1404
1464
  */
1405
- fsBuffer?: Uint8Array | null | undefined;
1465
+ fsBuffer?: Uint8Array | number[] | null | undefined;
1406
1466
  /**
1407
1467
  * Reported progress during the OS command execution.
1408
1468
  *
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapOsCommandResponse = exports.kublerEncoderSubcommands = exports.smmAcyclicHandlerSubcommands = exports.osCommands = exports.kublerEncoderRegisterValueMeaning = exports.kublerEncoderRegisterCommunicationWriteOsCommandErrors = exports.kublerEncoderRegisterCommunicationReadOsCommandErrors = exports.createKublerEncoderRegisterCommunicationOsCommand = exports.createUseInternalEncoderVelocityOsCommand = exports.kublerEncoderCommandOsCommandErrors = exports.createKublerEncoderCommandWriteFirmwareOsCommand = exports.createKublerEncoderCommandCheckFirmwareUpdateSizeOsCommand = exports.createKublerEncoderOsCommand = exports.KublerEncoderSubcommandId = exports.triggerErrorTypes = exports.createTriggerErrorOsCommand = exports.systemIdentificationParameters = exports.createSystemIdentificationOsCommand = exports.createIgnoreBissStatusBitsOsCommand = exports.createSkippedCyclesCounterOsCommand = exports.createSmmAcyclicHandlerReadSmmParameterOsCommand = exports.createSmmAcyclicHandlerOsCommand = exports.createTorqueConstantMeasurementOsCommand = exports.createPhaseInductanceMeasurementOsCommand = exports.createPhaseResistanceMeasurementOsCommand = exports.createPolePairDetectionOsCommand = exports.openPhaseDetectionErrors = exports.createOpenPhaseDetectionOsCommand = exports.createCommutationOffsetMeasurementOsCommand = exports.createMotorPhaseOrderDetectionOsCommand = exports.hrdStreamingOsCommandErrors = exports.createHrdStreamingOsCommand = exports.HrdStreamingOsCommandDataIndex = exports.HrdStreamingOsCommandAction = exports.openLoopFieldModeParameters = exports.createOpenLoopFieldModeOsCommand = exports.createIcMuCalibrationModeOsCommand = exports.createEncoderRegisterCommunicationOsCommand = exports.createOsCommandTypedArray = exports.osCommandErrorCode = exports.SmmAcyclicHandlerSubcommandId = exports.OsCommandId = exports.OsCommandMode = exports.parseOsCommandResponse = exports.isOsCommandResponse = void 0;
3
+ exports.mapOsCommandResponse = exports.kublerEncoderSubcommands = exports.smmAcyclicHandlerSubcommands = exports.osCommands = exports.kublerEncoderRegisterValueMeaning = exports.kublerEncoderRegisterCommunicationWriteOsCommandErrors = exports.kublerEncoderRegisterCommunicationReadOsCommandErrors = exports.createKublerEncoderRegisterCommunicationOsCommand = exports.createUseInternalEncoderVelocityOsCommand = exports.kublerEncoderCommandOsCommandErrors = exports.createKublerEncoderCommandWriteFirmwareOsCommand = exports.createKublerEncoderCommandCheckFirmwareUpdateSizeOsCommand = exports.createKublerEncoderOsCommand = exports.KublerEncoderSubcommandId = exports.triggerErrorTypes = exports.createTriggerErrorOsCommand = exports.systemIdentificationParameters = exports.createSystemIdentificationOsCommand = exports.createIgnoreBissStatusBitsOsCommand = exports.createSkippedCyclesCounterOsCommand = exports.createSmmAcyclicHandlerConfigureSoftwareUpdateOsCommand = exports.createSmmAcyclicHandlerReadSmmParameterOsCommand = exports.createSmmAcyclicHandlerOsCommand = exports.createTorqueConstantMeasurementOsCommand = exports.createPhaseInductanceMeasurementOsCommand = exports.createPhaseResistanceMeasurementOsCommand = exports.createPolePairDetectionOsCommand = exports.openPhaseDetectionErrors = exports.createOpenPhaseDetectionOsCommand = exports.createCommutationOffsetMeasurementOsCommand = exports.createMotorPhaseOrderDetectionOsCommand = exports.hrdStreamingOsCommandErrors = exports.createHrdStreamingOsCommand = exports.HrdStreamingOsCommandDataIndex = exports.HrdStreamingOsCommandAction = exports.openLoopFieldModeParameters = exports.createOpenLoopFieldModeOsCommand = exports.createIcMuCalibrationModeOsCommand = exports.createEncoderRegisterCommunicationOsCommand = exports.createOsCommandTypedArray = exports.osCommandErrorCode = exports.SmmAcyclicHandlerSubcommandId = exports.OsCommandId = exports.OsCommandMode = exports.parseOsCommandResponse = exports.isOsCommandResponse = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
+ const smm_1 = require("./smm");
5
6
  /**
6
7
  * Type guard to determine if the provided value is a OS Command Response object.
7
8
  */
@@ -9,7 +10,6 @@ function isOsCommandResponse(value) {
9
10
  return (value === null || value === void 0 ? void 0 : value.command) instanceof Uint8Array;
10
11
  }
11
12
  exports.isOsCommandResponse = isOsCommandResponse;
12
- ;
13
13
  function parseOsCommandResponse(response, command) {
14
14
  const status = response.at(0);
15
15
  if (status === undefined) {
@@ -61,7 +61,6 @@ var OsCommandMode;
61
61
  OsCommandMode[OsCommandMode["EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY"] = 0] = "EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY";
62
62
  OsCommandMode[OsCommandMode["ABORT_THE_CURRENT_COMMAND_AND_ALL_COMMANDS_IN_THE_BUFFER"] = 3] = "ABORT_THE_CURRENT_COMMAND_AND_ALL_COMMANDS_IN_THE_BUFFER";
63
63
  })(OsCommandMode = exports.OsCommandMode || (exports.OsCommandMode = {}));
64
- ;
65
64
  var OsCommandId;
66
65
  (function (OsCommandId) {
67
66
  OsCommandId[OsCommandId["CUSTOM_OS_COMMAND"] = -1] = "CUSTOM_OS_COMMAND";
@@ -85,7 +84,6 @@ var OsCommandId;
85
84
  OsCommandId[OsCommandId["USE_INTERNAL_ENCODER_VELOCITY"] = 18] = "USE_INTERNAL_ENCODER_VELOCITY";
86
85
  OsCommandId[OsCommandId["KUBLER_ENCODER_REGISTER_COMMUNICATION"] = 19] = "KUBLER_ENCODER_REGISTER_COMMUNICATION";
87
86
  })(OsCommandId = exports.OsCommandId || (exports.OsCommandId = {}));
88
- ;
89
87
  var SmmAcyclicHandlerSubcommandId;
90
88
  (function (SmmAcyclicHandlerSubcommandId) {
91
89
  SmmAcyclicHandlerSubcommandId[SmmAcyclicHandlerSubcommandId["PARAMETER_DOWNLOAD_LOGIN"] = 1] = "PARAMETER_DOWNLOAD_LOGIN";
@@ -102,8 +100,8 @@ var SmmAcyclicHandlerSubcommandId;
102
100
  SmmAcyclicHandlerSubcommandId[SmmAcyclicHandlerSubcommandId["FINALIZE_SOFTWARE_UPDATE"] = 12] = "FINALIZE_SOFTWARE_UPDATE";
103
101
  SmmAcyclicHandlerSubcommandId[SmmAcyclicHandlerSubcommandId["READ_SMM_PARAMETER"] = 13] = "READ_SMM_PARAMETER";
104
102
  SmmAcyclicHandlerSubcommandId[SmmAcyclicHandlerSubcommandId["IO_FAILURE_ACKNOWLEDGE"] = 14] = "IO_FAILURE_ACKNOWLEDGE";
103
+ SmmAcyclicHandlerSubcommandId[SmmAcyclicHandlerSubcommandId["TRIGGER_RESTART"] = 15] = "TRIGGER_RESTART";
105
104
  })(SmmAcyclicHandlerSubcommandId = exports.SmmAcyclicHandlerSubcommandId || (exports.SmmAcyclicHandlerSubcommandId = {}));
106
- ;
107
105
  exports.osCommandErrorCode = {
108
106
  251: 'Command not allowed',
109
107
  252: 'Command aborted',
@@ -140,11 +138,16 @@ exports.createOsCommandTypedArray = createOsCommandTypedArray;
140
138
  */
141
139
  function createEncoderRegisterCommunicationOsCommand(encoderOrdinal = 1, slaveAddress = 0, rw = 0, registerAddress = 0, registerWriteValue = 0) {
142
140
  const byte2 = (slaveAddress << 1) | rw;
143
- const elements = [OsCommandId.ENCODER_REGISTER_COMMUNICATION, encoderOrdinal, byte2, registerAddress, registerWriteValue];
141
+ const elements = [
142
+ OsCommandId.ENCODER_REGISTER_COMMUNICATION,
143
+ encoderOrdinal,
144
+ byte2,
145
+ registerAddress,
146
+ registerWriteValue,
147
+ ];
144
148
  return createOsCommandTypedArray(elements);
145
149
  }
146
150
  exports.createEncoderRegisterCommunicationOsCommand = createEncoderRegisterCommunicationOsCommand;
147
- ;
148
151
  /**
149
152
  * OS command 1: iC-MU calibration mode
150
153
  *
@@ -219,12 +222,11 @@ function createIcMuCalibrationModeOsCommand(encoderOrdinal = 1, modeEnable = 0)
219
222
  return createOsCommandTypedArray(elements);
220
223
  }
221
224
  exports.createIcMuCalibrationModeOsCommand = createIcMuCalibrationModeOsCommand;
222
- ;
223
225
  function createOpenLoopFieldModeOsCommand(parameterIndex = 0, parameterValue = 0) {
224
- let msb = (parameterValue >> 24) & 0xFF;
225
- let msb1 = (parameterValue >> 16) & 0xFF;
226
- let msb2 = (parameterValue >> 8) & 0xFF;
227
- let lsb = parameterValue & 0xFF;
226
+ let msb = (parameterValue >> 24) & 0xff;
227
+ let msb1 = (parameterValue >> 16) & 0xff;
228
+ let msb2 = (parameterValue >> 8) & 0xff;
229
+ let lsb = parameterValue & 0xff;
228
230
  const elements = [OsCommandId.OPEN_LOOP_FIELD_MODE, parameterIndex, msb, msb1, msb2, lsb];
229
231
  return createOsCommandTypedArray(elements);
230
232
  }
@@ -238,7 +240,6 @@ exports.openLoopFieldModeParameters = [
238
240
  { parameterIndex: 5, parameterName: 'Ending length [per thousand rated current]' },
239
241
  { parameterIndex: 6, parameterName: 'Increasing length rate [per thousand rated current / s]' },
240
242
  ];
241
- ;
242
243
  /**
243
244
  * Enum for selecting the action to perform in HRD streaming.
244
245
  */
@@ -255,7 +256,6 @@ var HrdStreamingOsCommandAction;
255
256
  */
256
257
  HrdStreamingOsCommandAction[HrdStreamingOsCommandAction["START_STREAM"] = 1] = "START_STREAM";
257
258
  })(HrdStreamingOsCommandAction = exports.HrdStreamingOsCommandAction || (exports.HrdStreamingOsCommandAction = {}));
258
- ;
259
259
  /**
260
260
  * Enum for selecting the data to stream.
261
261
  *
@@ -276,10 +276,9 @@ var HrdStreamingOsCommandDataIndex;
276
276
  */
277
277
  HrdStreamingOsCommandDataIndex[HrdStreamingOsCommandDataIndex["SYSTEM_IDENTIFICATION_DATA"] = 1] = "SYSTEM_IDENTIFICATION_DATA";
278
278
  })(HrdStreamingOsCommandDataIndex = exports.HrdStreamingOsCommandDataIndex || (exports.HrdStreamingOsCommandDataIndex = {}));
279
- ;
280
279
  function createHrdStreamingOsCommand(action = 0, dataIndex = 0, duration = 10000) {
281
- let msb = (duration >> 8) & 0xFF;
282
- let lsb = duration & 0xFF;
280
+ let msb = (duration >> 8) & 0xff;
281
+ let lsb = duration & 0xff;
283
282
  const elements = [OsCommandId.HRD_STREAMING, action, dataIndex, msb, lsb];
284
283
  return createOsCommandTypedArray(elements);
285
284
  }
@@ -330,7 +329,6 @@ function createMotorPhaseOrderDetectionOsCommand() {
330
329
  return createOsCommandTypedArray(elements);
331
330
  }
332
331
  exports.createMotorPhaseOrderDetectionOsCommand = createMotorPhaseOrderDetectionOsCommand;
333
- ;
334
332
  /**
335
333
  * Command 5: Commutation offset measurement
336
334
  *
@@ -357,7 +355,6 @@ function createCommutationOffsetMeasurementOsCommand() {
357
355
  return createOsCommandTypedArray(elements);
358
356
  }
359
357
  exports.createCommutationOffsetMeasurementOsCommand = createCommutationOffsetMeasurementOsCommand;
360
- ;
361
358
  /**
362
359
  * Command 6: Open phase detection
363
360
  *
@@ -375,7 +372,6 @@ function createOpenPhaseDetectionOsCommand() {
375
372
  return createOsCommandTypedArray(elements);
376
373
  }
377
374
  exports.createOpenPhaseDetectionOsCommand = createOpenPhaseDetectionOsCommand;
378
- ;
379
375
  exports.openPhaseDetectionErrors = {
380
376
  0: {
381
377
  errorName: 'Open terminal A',
@@ -429,7 +425,6 @@ function createPolePairDetectionOsCommand() {
429
425
  return createOsCommandTypedArray(elements);
430
426
  }
431
427
  exports.createPolePairDetectionOsCommand = createPolePairDetectionOsCommand;
432
- ;
433
428
  /**
434
429
  * Command 8: Phase resistance measurement
435
430
  *
@@ -445,7 +440,6 @@ function createPhaseResistanceMeasurementOsCommand() {
445
440
  return createOsCommandTypedArray(elements);
446
441
  }
447
442
  exports.createPhaseResistanceMeasurementOsCommand = createPhaseResistanceMeasurementOsCommand;
448
- ;
449
443
  /**
450
444
  * Command 9: Phase inductance measurement
451
445
  *
@@ -461,7 +455,6 @@ function createPhaseInductanceMeasurementOsCommand() {
461
455
  return createOsCommandTypedArray(elements);
462
456
  }
463
457
  exports.createPhaseInductanceMeasurementOsCommand = createPhaseInductanceMeasurementOsCommand;
464
- ;
465
458
  function createTorqueConstantMeasurementOsCommand() {
466
459
  const elements = [OsCommandId.TORQUE_CONSTANT_MEASUREMENT];
467
460
  return createOsCommandTypedArray(elements);
@@ -472,13 +465,36 @@ function createSmmAcyclicHandlerOsCommand(subcommandId) {
472
465
  return createOsCommandTypedArray(elements);
473
466
  }
474
467
  exports.createSmmAcyclicHandlerOsCommand = createSmmAcyclicHandlerOsCommand;
475
- function createSmmAcyclicHandlerReadSmmParameterOsCommand(index, subindex) {
476
- let indexMsb = (index >> 8) & 0xFF;
477
- let indexLsb = index & 0xFF;
478
- const elements = [OsCommandId.SMM_ACYCLIC_HANDLER, SmmAcyclicHandlerSubcommandId.READ_SMM_PARAMETER, indexLsb, indexMsb, subindex];
468
+ function createSmmAcyclicHandlerReadSmmParameterOsCommand(index, subindex = 0) {
469
+ let indexMsb = (index >> 8) & 0xff;
470
+ let indexLsb = index & 0xff;
471
+ const subindexByte = subindex & 0xff;
472
+ const elements = [
473
+ OsCommandId.SMM_ACYCLIC_HANDLER,
474
+ SmmAcyclicHandlerSubcommandId.READ_SMM_PARAMETER,
475
+ indexLsb,
476
+ indexMsb,
477
+ subindexByte,
478
+ ];
479
479
  return createOsCommandTypedArray(elements);
480
480
  }
481
481
  exports.createSmmAcyclicHandlerReadSmmParameterOsCommand = createSmmAcyclicHandlerReadSmmParameterOsCommand;
482
+ function createSmmAcyclicHandlerConfigureSoftwareUpdateOsCommand(fileSize) {
483
+ const b2 = (fileSize >> 0) & 0xff;
484
+ const b3 = (fileSize >> 8) & 0xff;
485
+ const b4 = (fileSize >> 16) & 0xff;
486
+ const b5 = (fileSize >> 24) & 0xff;
487
+ const elements = [
488
+ OsCommandId.SMM_ACYCLIC_HANDLER,
489
+ SmmAcyclicHandlerSubcommandId.CONFIGURE_SOFTWARE_UPDATE,
490
+ b2,
491
+ b3,
492
+ b4,
493
+ b5,
494
+ ];
495
+ return createOsCommandTypedArray(elements);
496
+ }
497
+ exports.createSmmAcyclicHandlerConfigureSoftwareUpdateOsCommand = createSmmAcyclicHandlerConfigureSoftwareUpdateOsCommand;
482
498
  function createSkippedCyclesCounterOsCommand(firmwareService = 0) {
483
499
  const elements = [OsCommandId.SKIPPED_CYCLED_COUNTER, firmwareService];
484
500
  return createOsCommandTypedArray(elements);
@@ -491,10 +507,10 @@ function createIgnoreBissStatusBitsOsCommand(trigger = 1, encoderOrdinal = 1) {
491
507
  }
492
508
  exports.createIgnoreBissStatusBitsOsCommand = createIgnoreBissStatusBitsOsCommand;
493
509
  function createSystemIdentificationOsCommand(parameterIndex = 0, parameterValue = 0) {
494
- let msb = (parameterValue >> 24) & 0xFF;
495
- let msb1 = (parameterValue >> 16) & 0xFF;
496
- let msb2 = (parameterValue >> 8) & 0xFF;
497
- let lsb = parameterValue & 0xFF;
510
+ let msb = (parameterValue >> 24) & 0xff;
511
+ let msb1 = (parameterValue >> 16) & 0xff;
512
+ let msb2 = (parameterValue >> 8) & 0xff;
513
+ let lsb = parameterValue & 0xff;
498
514
  const elements = [OsCommandId.SYSTEM_IDENTIFICATION, parameterIndex, msb, msb1, msb2, lsb];
499
515
  return createOsCommandTypedArray(elements);
500
516
  }
@@ -528,26 +544,32 @@ var KublerEncoderSubcommandId;
528
544
  KublerEncoderSubcommandId[KublerEncoderSubcommandId["EXIT_BOOTLOADER_MODE"] = 6] = "EXIT_BOOTLOADER_MODE";
529
545
  KublerEncoderSubcommandId[KublerEncoderSubcommandId["READ_CORRECTION_TABLE"] = 7] = "READ_CORRECTION_TABLE";
530
546
  })(KublerEncoderSubcommandId = exports.KublerEncoderSubcommandId || (exports.KublerEncoderSubcommandId = {}));
531
- ;
532
547
  function createKublerEncoderOsCommand(subcommandId) {
533
548
  const elements = [OsCommandId.KUBLER_ENCODER_COMMAND, subcommandId];
534
549
  return createOsCommandTypedArray(elements);
535
550
  }
536
551
  exports.createKublerEncoderOsCommand = createKublerEncoderOsCommand;
537
552
  function createKublerEncoderCommandCheckFirmwareUpdateSizeOsCommand(firmwareSize) {
538
- let lsb = firmwareSize & 0xFF;
539
- let lsb1 = (firmwareSize >> 8) & 0xFF;
540
- let lsb2 = (firmwareSize >> 16) & 0xFF;
541
- let msb = (firmwareSize >> 24) & 0xFF;
542
- const elements = [OsCommandId.KUBLER_ENCODER_COMMAND, KublerEncoderSubcommandId.CHECK_FIRMWARE_UPDATE_SIZE, lsb, lsb1, lsb2, msb];
553
+ let lsb = firmwareSize & 0xff;
554
+ let lsb1 = (firmwareSize >> 8) & 0xff;
555
+ let lsb2 = (firmwareSize >> 16) & 0xff;
556
+ let msb = (firmwareSize >> 24) & 0xff;
557
+ const elements = [
558
+ OsCommandId.KUBLER_ENCODER_COMMAND,
559
+ KublerEncoderSubcommandId.CHECK_FIRMWARE_UPDATE_SIZE,
560
+ lsb,
561
+ lsb1,
562
+ lsb2,
563
+ msb,
564
+ ];
543
565
  return createOsCommandTypedArray(elements);
544
566
  }
545
567
  exports.createKublerEncoderCommandCheckFirmwareUpdateSizeOsCommand = createKublerEncoderCommandCheckFirmwareUpdateSizeOsCommand;
546
568
  function createKublerEncoderCommandWriteFirmwareOsCommand(firmwareSize) {
547
- let lsb = firmwareSize & 0xFF;
548
- let lsb1 = (firmwareSize >> 8) & 0xFF;
549
- let lsb2 = (firmwareSize >> 16) & 0xFF;
550
- let msb = (firmwareSize >> 24) & 0xFF;
569
+ let lsb = firmwareSize & 0xff;
570
+ let lsb1 = (firmwareSize >> 8) & 0xff;
571
+ let lsb2 = (firmwareSize >> 16) & 0xff;
572
+ let msb = (firmwareSize >> 24) & 0xff;
551
573
  const elements = [OsCommandId.KUBLER_ENCODER_COMMAND, KublerEncoderSubcommandId.WRITE_FIRMWARE, lsb, lsb1, lsb2, msb];
552
574
  return createOsCommandTypedArray(elements);
553
575
  }
@@ -571,7 +593,7 @@ exports.kublerEncoderCommandOsCommandErrors = {
571
593
  },
572
594
  4: {
573
595
  errorName: 'Timeout',
574
- errorDescription: 'The encoder didn\'t respond to the request after 10 ms.',
596
+ errorDescription: "The encoder didn't respond to the request after 10 ms.",
575
597
  },
576
598
  5: {
577
599
  errorName: 'Command not acknowledged',
@@ -592,11 +614,20 @@ function createUseInternalEncoderVelocityOsCommand(trigger = 0) {
592
614
  }
593
615
  exports.createUseInternalEncoderVelocityOsCommand = createUseInternalEncoderVelocityOsCommand;
594
616
  function createKublerEncoderRegisterCommunicationOsCommand(rw = 0, registerAddress = 0, registerLength = 0, registerWriteValue = 0) {
595
- let msb = (registerWriteValue >> 24) & 0xFF;
596
- let msb1 = (registerWriteValue >> 16) & 0xFF;
597
- let msb2 = (registerWriteValue >> 8) & 0xFF;
598
- let lsb = registerWriteValue & 0xFF;
599
- const elements = [OsCommandId.KUBLER_ENCODER_REGISTER_COMMUNICATION, rw, registerAddress, registerLength, lsb, msb2, msb1, msb];
617
+ let msb = (registerWriteValue >> 24) & 0xff;
618
+ let msb1 = (registerWriteValue >> 16) & 0xff;
619
+ let msb2 = (registerWriteValue >> 8) & 0xff;
620
+ let lsb = registerWriteValue & 0xff;
621
+ const elements = [
622
+ OsCommandId.KUBLER_ENCODER_REGISTER_COMMUNICATION,
623
+ rw,
624
+ registerAddress,
625
+ registerLength,
626
+ lsb,
627
+ msb2,
628
+ msb1,
629
+ msb,
630
+ ];
600
631
  return createOsCommandTypedArray(elements);
601
632
  }
602
633
  exports.createKublerEncoderRegisterCommunicationOsCommand = createKublerEncoderRegisterCommunicationOsCommand;
@@ -634,7 +665,7 @@ exports.kublerEncoderRegisterValueMeaning = {
634
665
  25: 'POA auto-calibration reached good results but is still running at the moment.',
635
666
  17: 'POA auto-calibration reached good results and is finished, obtained values are saved automatically.',
636
667
  9: 'POA auto-calibration did not reach good results yet and is still running.',
637
- }
668
+ },
638
669
  };
639
670
  exports.osCommands = [
640
671
  { id: OsCommandId.CUSTOM_OS_COMMAND, name: 'Custom OS command' },
@@ -712,7 +743,7 @@ function mapOsCommandResponse() {
712
743
  return Object.assign(Object.assign({}, response), { hrdStreamingComplete: true });
713
744
  }
714
745
  if (response.request === 'failed') {
715
- if (typeof (response.errorCode) === 'number' && response.errorCode <= 250) {
746
+ if (typeof response.errorCode === 'number' && response.errorCode <= 250) {
716
747
  const { errorName, errorDescription } = exports.hrdStreamingOsCommandErrors[response.errorCode];
717
748
  return Object.assign(Object.assign({}, response), { hrdStreamingComplete: false, errorName, errorDescription });
718
749
  }
@@ -736,7 +767,7 @@ function mapOsCommandResponse() {
736
767
  return Object.assign(Object.assign({}, response), { phaseOpened: false });
737
768
  }
738
769
  if (response.request === 'failed') {
739
- if (typeof (response.errorCode) === 'number' && response.errorCode <= 250) {
770
+ if (typeof response.errorCode === 'number' && response.errorCode <= 250) {
740
771
  const { errorName, errorDescription } = exports.openPhaseDetectionErrors[response.errorCode];
741
772
  return Object.assign(Object.assign({}, response), { phaseOpened: true, errorName, errorDescription });
742
773
  }
@@ -748,7 +779,7 @@ function mapOsCommandResponse() {
748
779
  return Object.assign(Object.assign({}, response), { numberOfPolePairs: response.data[0] });
749
780
  }
750
781
  if (response.request === 'failed') {
751
- if (typeof (response.errorCode) === 'number' && response.errorCode === 0) {
782
+ if (typeof response.errorCode === 'number' && response.errorCode === 0) {
752
783
  return Object.assign(Object.assign({}, response), { errorName: 'Current amplitude error', errorDescription: 'The drive is not able to increase the amplitude of motor phase currents to the required value. This problem can occur due to limited Vdc or high motor phase impedances.' });
753
784
  }
754
785
  }
@@ -760,7 +791,7 @@ function mapOsCommandResponse() {
760
791
  return Object.assign(Object.assign({}, response), { phaseResistance });
761
792
  }
762
793
  if (response.request === 'failed') {
763
- if (typeof (response.errorCode) === 'number' && response.errorCode === 0) {
794
+ if (typeof response.errorCode === 'number' && response.errorCode === 0) {
764
795
  return Object.assign(Object.assign({}, response), { errorName: 'Current amplitude error', errorDescription: 'Unable to increase the current amplitude.' });
765
796
  }
766
797
  }
@@ -772,7 +803,7 @@ function mapOsCommandResponse() {
772
803
  return Object.assign(Object.assign({}, response), { phaseInductance });
773
804
  }
774
805
  if (response.request === 'failed') {
775
- if (typeof (response.errorCode) === 'number' && response.errorCode === 0) {
806
+ if (typeof response.errorCode === 'number' && response.errorCode === 0) {
776
807
  return Object.assign(Object.assign({}, response), { errorName: 'Current amplitude error', errorDescription: 'Unable to increase the current amplitude.' });
777
808
  }
778
809
  }
@@ -784,6 +815,15 @@ function mapOsCommandResponse() {
784
815
  return Object.assign(Object.assign({}, response), { torqueConstant });
785
816
  }
786
817
  }
818
+ if (osCommandId === OsCommandId.SMM_ACYCLIC_HANDLER) {
819
+ if (response.command[1] === SmmAcyclicHandlerSubcommandId.LOAD_PARAMETERS_FOR_VERIFICATION) {
820
+ if (response.request === 'succeeded' && response.fsBuffer) {
821
+ const bytes = Uint8Array.from(response.fsBuffer).map((byte) => byte ^ 0xff);
822
+ const values = (0, smm_1.unpackSmmParameterValues)(bytes);
823
+ return Object.assign(Object.assign({}, response), { values });
824
+ }
825
+ }
826
+ }
787
827
  if (osCommandId === OsCommandId.SKIPPED_CYCLED_COUNTER) {
788
828
  if (response.request === 'succeeded' && response.data) {
789
829
  const [b0, b1, b2, b3] = response.data;
@@ -813,7 +853,7 @@ function mapOsCommandResponse() {
813
853
  return Object.assign(Object.assign({}, response), { numberOfBytesWritten, responseInFoeBuffer });
814
854
  }
815
855
  if (response.request === 'failed') {
816
- if (typeof (response.errorCode) === 'number' && response.errorCode <= 250) {
856
+ if (typeof response.errorCode === 'number' && response.errorCode <= 250) {
817
857
  const { errorName, errorDescription } = exports.kublerEncoderCommandOsCommandErrors[response.errorCode];
818
858
  return Object.assign(Object.assign({}, response), { errorName, errorDescription });
819
859
  }
@@ -831,7 +871,7 @@ function mapOsCommandResponse() {
831
871
  return Object.assign(Object.assign({}, response), { kublerRegisterValue });
832
872
  }
833
873
  if (response.request === 'failed') {
834
- if (typeof (response.errorCode) === 'number' && response.errorCode <= 250) {
874
+ if (typeof response.errorCode === 'number' && response.errorCode <= 250) {
835
875
  const { errorName, errorDescription } = exports.kublerEncoderRegisterCommunicationReadOsCommandErrors[response.errorCode];
836
876
  return Object.assign(Object.assign({}, response), { errorName, errorDescription });
837
877
  }