fritzing / fritzing-app

Fritzing desktop application
http://fritzing.org
Other
3.99k stars 827 forks source link

Update serial port list more often #1157

Open davidperrenoud opened 10 years ago

davidperrenoud commented 10 years ago

From bryant.m...@gmail.com on June 30, 2010 07:51:36

The serial port list should be updated more often then on program window creation. I'm thinking either add a fake serial port called "Refresh" or "Scan" to detect new ports (has the advantage of filling in the dropdown when there's no detected ports) or on program window focus auto-refreshing the list. Either way there should definitely be an empty serial port list placeholder item within the dropdown if there're no serial ports found.

Original issue: http://code.google.com/p/fritzing/issues/detail?id=1157

davidperrenoud commented 10 years ago

From andre.knoerig@gmail.com on July 01, 2010 02:57:42

Indeed it should be updated more often, because one is often plugging and unplugging devices in the process. The way Arduino does it is to update it whenever one opens the port list. So in our case, whenever one clicks on the drop-down to change the port, it could update the list. If there is no serial port (although this is very rare), the drop-down should therefore still be enabled, but show something like "- - -" or "None".

davidperrenoud commented 10 years ago

From irasc...@gmail.com on July 04, 2010 00:30:14

getting the serial port list may be slow, so updating at pull-down time may take too long (this needs testing, anyway)

if the user unplugs the current serial port, then current entry in the combobox is wrong.

Labels: -Type-Enhancement Type-Defect

davidperrenoud commented 10 years ago

From irasc...@gmail.com on July 04, 2010 00:49:40

What would be really nice is to have a callback set up whenever a serial port is added or removed. However, this is likely to be a cross-platform mess.

I'm currently leaning toward a timer task running every 30? seconds.

davidperrenoud commented 10 years ago

From irasc...@gmail.com on July 04, 2010 02:03:53

Tried the update-before-showing approach. At least under Windows 7, when plugging and unplugging the picaxe device, when the device is plugged in, the next time the popup or menu is clicked, the delay between the click and the menu popping up is some number of seconds long, and very noticeable.

Strangely, there's no such delay after unplugging the device, and in this case, and in the case where there's no change to the port, the popup delay is acceptable.

Could be a completely different story on the other platforms, though.

davidperrenoud commented 10 years ago

From irasc...@gmail.com on July 04, 2010 02:52:54

Status: PartlyDone

davidperrenoud commented 10 years ago

From bryant.m...@gmail.com on July 07, 2010 16:50:57

The serial port code for this project actually borrows from QextSerialPort as far as I can tell [ https://code.google.com/p/qextserialport/ ]. This library also provides a deviceDiscovered() and deviceRemoved() signal that should allow for dynamic updating of the UI based on serial device addition/removal.

These events only work on Windows and OS X, but would be rather convenient. I'm sure it would be easy to find code to find serial devices in Linux and add it to the library to support that.

davidperrenoud commented 10 years ago

From irasc...@gmail.com on July 07, 2010 21:56:33

Actually, it doesn't. I've tried to use QExtSerialPort (on a previous project as well), but on Windows it's very buggy.

That being said, we could consider rolling our our own version of those signals. The delay under linux isn't bad, so not having the signals isn't a problem.

davidperrenoud commented 10 years ago

From irasc...@gmail.com on July 10, 2010 08:21:27

QExtSerialPort seems to be under new management and the windows code looks a lot better. At some point, we could use this library for enumerating ports, rather than having our own code. r4351 : I have borrowed QExtSerialPort code for the windows enumeration, so there's now very little delay when getting the port list under windows.

The signalling doesn't seem strictly necessary, though it would be a nice feature if the port on the button bar updated if the currently selected serial port was no longer available.

Labels: -Type-Defect -Priority-Medium Type-Enhancement Priority-Low

failiz commented 1 year ago

In Windows and Fritzing 0.9.10, the ports are updated quickly when you press the combobox. The only issue is when the device is removed, the combobox stills reports the previous com port used. When you press the combobox, then, the removed port disappears.