Hantek6022API
Hantek6022API copied to clipboard
Fix behavior of library when multiple devices present.
Currently everything works OK if only one scope is present, however the setup() method has no way of discriminating devices by serial number, and we automatically select the first scope we find. This will not work well if we have multiple devices we want to utilize present at the same time.
Two changes need to occur: first setup needs to have an optional parameter to force the selection of a specific serial number for selecting the correct device again after code load, and the list of devices should be sorted by serial number so that a device ID can be chosen that doesn't change as devices move around on the bus (which unfortunately happens when code is loaded, as the device disappears and reappears as though it's been unplugged/replugged).