Skip to content

Made write truly asynchronous, bypasses bug in pyserial which made it… #56

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

Merged
merged 1 commit into from
Sep 16, 2020

Conversation

wolfmanjm
Copy link
Contributor

@wolfmanjm wolfmanjm commented Jun 26, 2020

… blocking.

Also added a flush command which will clear the write buffer.

Addresses issue #53

@ulysse314
Copy link

Thanks for this patch, this was useful for my project. I would be happy to see this patch merged into pyserial-asyncio.

@Nable80
Copy link

Nable80 commented Aug 19, 2020

It took some time to understand why 2 almost identical branches were used:

        if self.get_write_buffer_size() == 0:
            self._write_buffer.append(data)
            self._ensure_writer()
        else:
            self._write_buffer.append(data)

I think it's natural to simplify (and clarify) this block to be something like this:

        prev_buffer_size = self.get_write_buffer_size()
        self._write_buffer.append(data)
        if prev_buffer_size == 0:
            self._ensure_writer()

Do you agree?

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.

4 participants