Skip to content
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

Add interlocking of send taskPerformer and SerialPortEventListener #22

Merged
merged 1 commit into from
Dec 1, 2015
Merged

Add interlocking of send taskPerformer and SerialPortEventListener #22

merged 1 commit into from
Dec 1, 2015

Conversation

devsaurus
Copy link
Contributor

Recent upgrade of NodeMCU firmware to SDK 1.4.0 in dev branch changed the timing of the interactive command line interpreter. This triggered race conditions in ESPlorer's code which led to instabilities in "Send to ESP" eg.
Specifically, I found the assumption "timer.isRunning() is immediately true once timer.start() is issued" to be wrong sometimes. It happens from time to time that PortExtraReader.serialEvent() is called again but the timer did not yet start. As a result, it will increment j another time without correct handshaking with ActionListener. This randomly generates the case that one line is skipped and the next line is sent twice.

This PR attempts to resolve such races between the ActionListener and the SerialPortEventListener by introducing the boolean flag sendPending. It ensures that the SerialPortEventListener will not advance before the current line has been sent.

4refr0nt added a commit that referenced this pull request Dec 1, 2015
Add interlocking of send taskPerformer and SerialPortEventListener
@4refr0nt 4refr0nt merged commit 5f1d461 into 4refr0nt:master Dec 1, 2015
@devsaurus devsaurus deleted the send_interlock branch December 1, 2015 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants