Skip to content

Commit db4e6d0

Browse files
BundesberReinhard Berlach
and
Reinhard Berlach
authored
fix for exception on multipe stop (#225)
Co-authored-by: Reinhard Berlach <r.berlach@mta-innovation.com>
1 parent bb6b528 commit db4e6d0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

canopen/nmt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,14 @@ def start_node_guarding(self, period):
178178
:param float period:
179179
Period (in seconds) at which the node guarding should be advertised to the slave node.
180180
"""
181+
if self._node_guarding_producer : self.stop_node_guarding()
181182
self._node_guarding_producer = self.network.send_periodic(0x700 + self.id, None, period, True)
182183

183184
def stop_node_guarding(self):
184185
"""Stops the node guarding mechanism."""
185186
if self._node_guarding_producer is not None:
186187
self._node_guarding_producer.stop()
188+
self._node_guarding_producer = None
187189

188190

189191
class NmtSlave(NmtBase):

0 commit comments

Comments
 (0)