@tsplc/build 0.2.4 → 0.2.5
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 +3 -3
- package/python/build.py +7 -2
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"url": "git+https://github.com/livingforjesus/tsplc.git",
|
|
16
16
|
"directory": "packages/build"
|
|
17
17
|
},
|
|
18
|
-
"version": "0.2.
|
|
18
|
+
"version": "0.2.5",
|
|
19
19
|
"type": "module",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"zod": "4.3.6",
|
|
46
|
-
"@tsplc/config": "0.2.
|
|
47
|
-
"@tsplc/typegen": "0.2.
|
|
46
|
+
"@tsplc/config": "0.2.5",
|
|
47
|
+
"@tsplc/typegen": "0.2.5"
|
|
48
48
|
},
|
|
49
49
|
"bin": {
|
|
50
50
|
"tsplc-build": "./dist/cli.js"
|
package/python/build.py
CHANGED
|
@@ -342,7 +342,8 @@ EDS_CONVERTER = "1ce4a9c1-37d3-496c-9e80-cd99ad3807ee"
|
|
|
342
342
|
ETHERNET = ("Ethernet", 110, "0000 0002", "4.2.0.0")
|
|
343
343
|
SCANNER = ("EtherNet_IP_Scanner", 100, "0000 100B", "4.9.0.0")
|
|
344
344
|
# Ethernet adapter interface settings and EtherNet/IP adapter parameter IDs.
|
|
345
|
-
|
|
345
|
+
# The interface name is a STRING (10) and a WSTRING (12); the device editor and runtime read the WSTRING.
|
|
346
|
+
ETHERNET_PARAMETERS = (("address", 0), ("subnet", 1), ("gateway", 2), ("interface", 10), ("interface", 12))
|
|
346
347
|
TARGET_ADDRESS = 256
|
|
347
348
|
CONNECTION_SETTINGS = 268435457
|
|
348
349
|
MODBUS_CLIENT = ("Modbus_TCP_Client", 88, "0000 0003", "4.6.0.0")
|
|
@@ -385,6 +386,10 @@ def set_parameter(parameter, value):
|
|
|
385
386
|
raise RuntimeError("{0} reads back {1}, not {2}".format(parameter.visible_name, parameter.value, value))
|
|
386
387
|
|
|
387
388
|
|
|
389
|
+
def string_literal(parameter, text):
|
|
390
|
+
return ('"{0}"' if parameter.type_string == "WSTRING" else "'{0}'").format(text)
|
|
391
|
+
|
|
392
|
+
|
|
388
393
|
def ip_array(address, hexadecimal=False):
|
|
389
394
|
octets = [int(octet) for octet in address.split(".")]
|
|
390
395
|
return "[" + ",".join("16#{0:02X}".format(octet) if hexadecimal else str(octet) for octet in octets) + "]"
|
|
@@ -548,7 +553,7 @@ def configure_device_tree(engine, project, tree, root, progress):
|
|
|
548
553
|
for key, identifier in ETHERNET_PARAMETERS:
|
|
549
554
|
value = tree.get("ethernet", {}).get(key)
|
|
550
555
|
if value is not None:
|
|
551
|
-
set_parameter(parameters[identifier],
|
|
556
|
+
set_parameter(parameters[identifier], string_literal(parameters[identifier], value) if key == "interface" else ip_array(value))
|
|
552
557
|
scanner = child_device(engine, ethernet, SCANNER)
|
|
553
558
|
pinned = {}
|
|
554
559
|
for device in tree["devices"]:
|