wheeler-microfluidics / dmf-control-board-firmware

Firmware for an Arduino-based DMF control board and a Python module for communicating with it over a serial connection.
http://microfluidics.utoronto.ca/trac/dropbot/wiki/ControlBoard
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

Try connecting to **any** serial port, but try recognized Mega2560 USB VID:PID ports first #5

Closed cfobel closed 7 years ago

cfobel commented 7 years ago

Original problem

Trying to connect to serial ports that do not correspond to a control board may cause unexpected behaviour to devices on the port.

Current solution

In the serial_ports function, only include serial ports that match recognized Mega2560 USB VID:PID ports.

New problem

Some users might be using Arduino/Genuino clones that might not be in the recognized USB VID:PID list, but are still compatible with the control board firmware.

Proposed solution

Rather than only including serial ports that match recognized Mega2560 USB VID:PID ports, consider all ports when trying to connect, but try to connect in the following order:

  1. Serial ports that match recognized Mega2560 USB VID:PID
  2. Serial ports that match recognized Arduino USB vendor ID (i.e., VID=2341)
  3. Remaining ports (perhaps with option to disable?)

Hopefully, cases 1 and 2 improve connecting speed when a control board device is actually connected.

Case 3 will add support for unrecognized (but compatible) clones. However, since case 3 may still lead to the Original problem from above, we might want to add an optional argument to the serial_ports function to specify whether or not to include devices matching 3.

Try connecting to any serial port, but try recoginized Mega2560 USB VID:PID ports first