Skip to content

Commit

Permalink
Merge pull request #556 from jacobeva/rnode-multi-fix
Browse files Browse the repository at this point in the history
Fix interface values not being set on RNodeSubInterface instances
  • Loading branch information
markqvist authored Oct 5, 2024
2 parents ef798e0 + 9a97195 commit e6c1dc0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
10 changes: 8 additions & 2 deletions RNS/Interfaces/RNodeMultiInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def __init__(self, owner, name, port, subint_config, id_interval = None, id_call
if (not self.validcfg):
raise ValueError("The configuration for "+str(self)+" contains errors, interface is offline")

def start(self):
try:
self.open_port()

Expand Down Expand Up @@ -324,8 +325,8 @@ def configure_device(self):
lt_alock=subint[9]
)

interface.OUT = self.OUT
interface.IN = self.IN
interface.OUT = subint[10]
interface.IN = True

interface.announce_rate_target = self.announce_rate_target
interface.mode = self.mode
Expand Down Expand Up @@ -1007,6 +1008,11 @@ def __init__(self, owner, name, parent_interface, index, interface_type, frequen
self.parent_interface = parent_interface
self.announce_rate_target = None

self.mode = None
self.announce_cap = None
self.bitrate = None
self.ifac_size = None

# add this interface to the subinterfaces array
self.parent_interface.subinterfaces[index] = self

Expand Down
16 changes: 11 additions & 5 deletions RNS/Reticulum.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ def __apply_config(self):
enabled_count += 1

# Create an array with a row for each subinterface
subint_config = [[0 for x in range(10)] for y in range(enabled_count)]
subint_config = [[0 for x in range(11)] for y in range(enabled_count)]
subint_index = 0

for subinterface in c:
Expand Down Expand Up @@ -1020,6 +1020,11 @@ def __apply_config(self):
subint_config[subint_index][8] = st_alock
lt_alock = float(subinterface_config["airtime_limit_long"]) if "airtime_limit_long" in subinterface_config else None
subint_config[subint_index][9] = lt_alock

if "outgoing" in subinterface_config and subinterface_config.as_bool("outgoing") == False:
subint_config[subint_index][10] = False
else:
subint_config[subint_index][10] = True
subint_index += 1

# if no subinterfaces are defined
Expand All @@ -1045,10 +1050,8 @@ def __apply_config(self):
id_callsign = id_callsign
)

if "outgoing" in c and c.as_bool("outgoing") == False:
interface.OUT = False
else:
interface.OUT = True
interface.IN = False
interface.OUT = False

interface.mode = interface_mode

Expand Down Expand Up @@ -1099,6 +1102,9 @@ def __apply_config(self):

RNS.Transport.interfaces.append(interface)

if isinstance(interface, RNS.Interfaces.RNodeMultiInterface.RNodeMultiInterface):
interface.start()

else:
RNS.log("Skipping disabled interface \""+name+"\"", RNS.LOG_DEBUG)

Expand Down

0 comments on commit e6c1dc0

Please sign in to comment.