From 084b5ba807fa987f07f83d5ea507b9517cd3ac1a Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 5 Jan 2020 13:02:41 +0100 Subject: [PATCH] Stop also board iterators on `close` --- platypush/plugins/arduino.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/platypush/plugins/arduino.py b/platypush/plugins/arduino.py index 8de22b171..a48070dfc 100644 --- a/platypush/plugins/arduino.py +++ b/platypush/plugins/arduino.py @@ -99,8 +99,8 @@ class ArduinoPlugin(GpioSensorPlugin): for pin, f in (conv_functions or {}).items() } - self._boards: Dict[str, Arduino] = {} - self._board_iterators: Dict[str, util.Iterator] = {} + self._boards = {} + self._board_iterators = {} @staticmethod def _get_board_type(board_type: Optional[str] = None) -> Type: @@ -376,7 +376,14 @@ class ArduinoPlugin(GpioSensorPlugin): @action def close(self): + for it in self._board_iterators.values(): + it.stop() + for board in self._boards.values(): board.exit() + self._board_iterators = {} + self._boards = {} + + # vim:sw=4:ts=4:et: