ppannuto / python-saleae

Python library to control a Saleae Logic Analyzer
Apache License 2.0
124 stars 55 forks source link

is_analyzer_complete raising self.CommandNAKedError when using custom analyzer #65

Closed qbiinz closed 3 years ago

qbiinz commented 3 years ago

s = saleae.Saleae() index = s.get_analyzers()[0][1] s.set_capture_seconds(0.25) s.capture_start()

while not (s.is_analyzer_complete(index)): time.sleep(0.1)

Traceback (most recent call last): File "", line 1, in File "/Users/zach/Docmuents/developer/lib/python3.7/site-packages/saleae/saleae.py", line 1035, in is_analyzer_complete resp = self._finish() File "/Users/zach/Docmuents/developer/lib/python3.7/site-packages/saleae/saleae.py", line 224, in _finish ret = self._cmd(', '.join(self._to_send)) File "/Users/zach/Docmuents/developer/lib/python3.7/site-packages/saleae/saleae.py", line 257, in _cmd ret = self._recv(expect_nak=expect_nak) File "/Users/zach/Docmuents/developer/lib/python3.7/site-packages/saleae/saleae.py", line 248, in _recv raise self.CommandNAKedError saleae.saleae.Saleae.CommandNAKedError

ppannuto commented 3 years ago

From the Saleae documentation: https://github.com/saleae/SaleaeSocketApi/blob/master/Doc/Logic%20Socket%20API%20Users%20Guide.md#get-analyzers

This function will return a list of analyzers currently attached to the capture, along with indexes so you can access them later.

Note, the indices may not be sequential, and are unlikely to be so. It's also unlikely that they will start at zero, even if only one analyzer is present. Indices can change between captures. Be sure to always check analyzer indices when calling other analyzer specific APIs.

(Emphasis mine): You need to call get_analyzers after starting the capture; and may need to parse the returned list to make sure that it's the analyzer you want.


I'm going to close this as I don't think it's a bug in this python wrapper. Feel free to re-open if there is an issue related to the Python wrapper.