-
Notifications
You must be signed in to change notification settings - Fork 133
Fixing timing issue with resetting Esplora #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- it appears that at least on a Mac some assumptions about Esplora are slightly different:
* there are two usb serial ports, not one (cu.xxx and tty.xxx)
* after sending 1200 baud to the COM port it takes no time for ports to get reset, so our checks
are not registering any disappearing ports in this case even at 10ms interval. Worked around
by switching this into a WARNING and allowing to continue after 2 seconds of trying, which leaves
another 6 seconds on Esplore, in the case when reset actually worked (for me 100% of the time).
|
Hopefully fixes #173 |
Fixing timing issue with resetting Esplora
|
looks good. The 2 com ports is indeed a possible problem I did not yet consider. |
|
In case you didn't know. As the commit has been merged the nightly build (starts around 3:00 CET) will pick it up and the new version will be available tomorrow. |
|
Great! Thanks so much. I'll pull that tomorrow then. |
|
build didn' work due to my bad. But it is now available. |
|
I was wondering – do you think this check (to wait for ports to disappear and then re-appear) is useful? Should the plugin just send the reset to COM and proceed to avrdude assuming all is good? After the patch it waits up to 2 seconds before proceeding, and it would only be useful if some platforms take a long time to reset the serial, and therefore it's worthwhile waiting for ports to go away and come back. But if this was added more as a safe guard, my vote is to remove it altogether, which would make uploading a lot faster. In the case where reset didn't work avrdude would print out a pretty descriptive message |
|
I'm tempted to say that is a good idea.
|
It appears that at least on my Mac some assumptions about Esplora are slightly different:
Serial.list()right after reset, and it was too late. Could be some OS-level blocking happening on the serial interface that's causing this.I worked around this case by switching the non-detection case of the
wait_for_com_Port_to_appear()function into a warning instead, and allowing us to continue after 2 seconds of unsuccessfully trying to detect port disappearance. 2 seconds should be plenty on even the slowest computers, but it leaves plenty of time for Esplora to start receiving the program (Esplora keeps bootloader open for input for 8 seconds after reset). So in my case, Eclipse just pauses for 2 seconds and then continues to the next step, and this simply works. I wish there was a way to detect the disappearance, but I think that as soon as we callSerial.list()after resetting the port, we are already missing the opportunity and the serial ports are back.An alternative could be to introduce environment variable that simply disables call to
wait_for_com_Port_to_appear()function even if the board is Esplora/Leonardo/etc. That, at least, gives users flexibility to configure this behavior.Additionally, please note that on my iMac Esplora (and every other Arduino board) provides not one, but two USB/serial ports
cu.xxxandtty.xxx. Some of the assumptions in thewait_for_com_Port_to_appearfunction seems to assume that only one serial port is added/removed by the board. I am referring to this check: