Skip to content

Commit 4e3e6fe

Browse files
committed
Wait to start param thread for when the link is open.
It was started on setting up the crazyflie, and if the crazflie is never closed the thread will keep running. It makes more sense to start it when opening and stop it when closing
1 parent d582c8c commit 4e3e6fe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cflib/crazyflie/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __init__(self, link=None, ro_cache=None, rw_cache=None):
119119
self.extpos = Extpos(self)
120120
self.log = Log(self)
121121
self.console = Console(self)
122-
self.param = Param(self)
122+
self.param = None
123123
self.mem = Memory(self)
124124
self.platform = PlatformService(self)
125125
self.appchannel = Appchannel(self)
@@ -137,8 +137,6 @@ def __init__(self, link=None, ro_cache=None, rw_cache=None):
137137

138138
self.connected_ts = None
139139

140-
self.param.all_updated.add_callback(self._all_parameters_updated)
141-
142140
# Connect callbacks to logger
143141
self.disconnected.add_callback(
144142
lambda uri: logger.info('Callback->Disconnected from [%s]', uri))
@@ -244,6 +242,8 @@ def open_link(self, link_uri):
244242
self.connection_requested.call(link_uri)
245243
self.state = State.INITIALIZED
246244
self.link_uri = link_uri
245+
self.param = Param(self)
246+
self.param.all_updated.add_callback(self._all_parameters_updated)
247247
try:
248248
self.link = cflib.crtp.get_link_driver(
249249
link_uri, self.link_statistics.radio_link_statistics_callback, self._link_error_cb)

0 commit comments

Comments
 (0)