Stop also board iterators on close

This commit is contained in:
Fabio Manganiello 2020-01-05 13:02:41 +01:00
parent f0a77c12a4
commit 084b5ba807

View file

@ -99,8 +99,8 @@ class ArduinoPlugin(GpioSensorPlugin):
for pin, f in (conv_functions or {}).items() for pin, f in (conv_functions or {}).items()
} }
self._boards: Dict[str, Arduino] = {} self._boards = {}
self._board_iterators: Dict[str, util.Iterator] = {} self._board_iterators = {}
@staticmethod @staticmethod
def _get_board_type(board_type: Optional[str] = None) -> Type: def _get_board_type(board_type: Optional[str] = None) -> Type:
@ -376,7 +376,14 @@ class ArduinoPlugin(GpioSensorPlugin):
@action @action
def close(self): def close(self):
for it in self._board_iterators.values():
it.stop()
for board in self._boards.values(): for board in self._boards.values():
board.exit() board.exit()
self._board_iterators = {}
self._boards = {}
# vim:sw=4:ts=4:et: # vim:sw=4:ts=4:et: