Skip to content

Commit

Permalink
Merge pull request #70 from JdeRobot/AbsorbedInThought-patch-2
Browse files Browse the repository at this point in the history
Fixed an issue with multiple instances of wires.
  • Loading branch information
muhammadtahasuhail committed Dec 22, 2020
2 parents 2af1986 + b12644e commit da0d7e2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ def build():
###################### Setting up communication between blocks ######################
loginfo("Setting up connections...")

wire_id = 0

for wire in wires:

src_block, src_port = wire['source']['block'], wire['source']['port']
tgt_block, tgt_port = wire['target']['block'], wire['target']['port']

wire_id = src_block+str(src_port)


# Connecting Paramters to Blocks
Expand All @@ -178,17 +180,16 @@ def build():

# Connecting Wires to Blocks
else:
wire_name = "wire_"+str(wire_id)
wire_id += 1
#wire_name = "wire_"+str(wire_id)

for block in blocks:
if tgt_block == block.id:
block.connect_input_wire(wire_name, tgt_port)
block.connect_input_wire(wire_id, tgt_port)
break

for block in blocks:
if src_block == block.id:
block.connect_output_wire(wire_name, src_port)
block.connect_output_wire(wire_id, src_port)
break
######################################################################################

Expand Down

0 comments on commit da0d7e2

Please sign in to comment.