diff --git a/scripts/network.gd b/scripts/network.gd index b060e89c..4699c4f6 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -1,7 +1,7 @@ class_name Network extends Node - -const UDP_PROTO: = {'yau07tx': yau07.YaU07, 'json-capsrpb': capsrpb.CapsRpb} +const UDPTX_PROTO: = {'yau07tx': yau07.YaU07} +const UDPJSON_PROTO: = {'json-capsrpb': capsrpb.CapsRpb} const TCP_PROTO: = {'5p28': tcp5p28.TCP5P28} const SERIAL_PROTO: = {'uart': spt25.SPT25} const MODBUS_PROTO: = {'mbcs': sch3.Sch3} @@ -162,11 +162,18 @@ func _ready() -> void: units_udprx[unit_name] = new_unit dst_ports[unit_name] = st[2][0] - if proto in UDP_PROTO: - var new_unit = UDP_PROTO[proto].new(unit_name) + if proto in UDPTX_PROTO: + var new_unit = UDPTX_PROTO[proto].new(unit_name) units[unit_name] = new_unit units_udp[unit_name] = new_unit - dst_ports[unit_name] = st[2][1] if len(st[2]) > 1 else st[2][0] + dst_ports[unit_name] = st[2][0] + dst_addrs[unit_name] = st[1] + + if proto in UDPJSON_PROTO: + var new_unit = UDPJSON_PROTO[proto].new(unit_name) + units[unit_name] = new_unit + units_udp[unit_name] = new_unit + dst_ports[unit_name] = st[2][1] dst_addrs[unit_name] = st[1] if proto in TCP_PROTO: