Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pipyadc/pipyadc.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def stop(self):
def stop_close_all(self):
"""Close all open pigpio SPI handles and stop pigpio connection
"""
for handle in reversed(self.open_spi_handles):
for handle in reversed(list(self.open_spi_handles.values())):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assume that even before Python 3.6, the reversed() built-in-function would work without turning the dict.values() (or, rather dict.keys()) iterator into a list first.

Can you please check if the following works:
for handle in reversed(self.open_spi_handles.keys()):

logger.debug(f"Closing SPI handle: {handle}")
self.pi.spi_close(handle)
self.open_spi_handles.clear()
Expand Down