@@ -39,7 +39,7 @@ def read(self):
3939
4040class mavudpin_multi (mavutil .mavfile ):
4141 '''a UDP mavlink socket'''
42- def __init__ (self , device , baud = None , input = True , broadcast = False , source_system = 255 , use_native = mavutil .default_native ):
42+ def __init__ (self , device , baud = None , input = True , broadcast = False , source_system = 255 , source_component = 0 , use_native = mavutil .default_native ):
4343 self ._logger = logging .getLogger (__name__ )
4444 a = device .split (':' )
4545 if len (a ) != 2 :
@@ -59,7 +59,7 @@ def __init__(self, device, baud=None, input=True, broadcast=False, source_system
5959 self .broadcast = True
6060 mavutil .set_close_on_exec (self .port .fileno ())
6161 self .port .setblocking (False )
62- mavutil .mavfile .__init__ (self , self .port .fileno (), device , source_system = source_system , input = input , use_native = use_native )
62+ mavutil .mavfile .__init__ (self , self .port .fileno (), device , source_system = source_system , source_component = source_component , input = input , use_native = use_native )
6363
6464 def close (self ):
6565 self .port .close ()
@@ -121,20 +121,21 @@ def stop_threads(self):
121121 self .mavlink_thread_out .join ()
122122 self .mavlink_thread_out = None
123123
124- def __init__ (self , ip , baud = 115200 , target_system = 0 , source_system = 255 , use_native = False ):
124+ def __init__ (self , ip , baud = 115200 , target_system = 0 , source_system = 255 , source_component = 0 , use_native = False ):
125125 self ._logger = logging .getLogger (__name__ )
126126
127127 if ip .startswith ("udpin:" ):
128- self .master = mavudpin_multi (ip [6 :], input = True , baud = baud , source_system = source_system )
128+ self .master = mavudpin_multi (ip [6 :], input = True , baud = baud , source_system = source_system , source_component = source_component )
129129 else :
130- self .master = mavutil .mavlink_connection (ip , baud = baud , source_system = source_system )
130+ self .master = mavutil .mavlink_connection (ip , baud = baud , source_system = source_system , source_component = source_component )
131131
132132 # TODO get rid of "master" object as exposed,
133133 # keep it private, expose something smaller for dronekit
134134 self .out_queue = Queue ()
135135 self .master .mav = mavutil .mavlink .MAVLink (
136136 MAVWriter (self .out_queue ),
137137 srcSystem = self .master .source_system ,
138+ srcComponent = self .master .source_component ,
138139 use_native = use_native )
139140
140141 # Monkey-patch MAVLink object for fix_targets.
0 commit comments