ppannuto / python-saleae

Python library to control a Saleae Logic Analyzer
Apache License 2.0
125 stars 54 forks source link

set_active_channels: ','.join() channel lists before _finish() #23

Closed mauzybwy closed 8 years ago

mauzybwy commented 8 years ago

See: Issue #22

_finish() joins the built list before sending to Logic via _cmd() 'set_active_channels' calls _build() on a list object, and therefore fails the join.

I have fixed this issue by joining the channel list before passing to _build. Seems to work fine for me now.

ppannuto commented 8 years ago

Looks like there are some whitespace issues with your PR:

https://travis-ci.org/ppannuto/python-saleae/jobs/151665617#L330

Also, I don't think this change is correct / necessary. The _build function accumulates a list of things which the _finish function will eventually ', '.join. Before your change:

>>> s.set_active_channels([0,1,2,3], [0])
DEBUG:saleae.saleae:Send >SET_ACTIVE_CHANNELS, digital_channels, 0, 1, 2, 3, analog_channels, 0<

After your change:

>>> s.set_active_channels([0,1,2,3], [0])
DEBUG:saleae.saleae:Send >SET_ACTIVE_CHANNELS, digital_channels, 0,1,2,3, analog_channels, 0<

Note that this function is only supported by Logic 16, Logic 8(2nd gen), Logic Pro 8, and Logic Pro 16. If you just start up an instance of Logic with no Saleae attached, the virtual Saleae it creates doesn't support this function and the command will be NAK'd.

Feel free to re-open this PR if I missed something and you've fixed the whitespace issues.