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

Use separate thread to read packets from serial port #15

Closed
wants to merge 11 commits into from

Conversation

cortadocodes
Copy link
Member

@cortadocodes cortadocodes commented Dec 15, 2021

Summary

Separate serial port reading from packet parsing, processing, and persistence to avoid data loss due to serial port overflow.

Contents (#15)

Enhancements

  • Use serial.threading to bulk read packets from serial port in a separate thread

Refactoring

  • Rename PacketReader._parse_payload to PacketReader.parse_payload

Testing

  • Improve information packets test

@cortadocodes cortadocodes self-assigned this Dec 15, 2021
@cortadocodes cortadocodes force-pushed the fix/read-from-serial-port-in-separate-thread branch from 67662ae to 8be20a7 Compare December 15, 2021 16:33
@cortadocodes cortadocodes changed the title ENH: Read packets from serial port in a separate thread Use separate thread to read packets from serial port Dec 15, 2021
@cortadocodes cortadocodes requested review from time-trader and thclark and removed request for time-trader and thclark December 20, 2021 16:35
Copy link
Contributor

@thclark thclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Only one nitpick on the ReaderThread subclass

data_gateway/serial_protocol.py Show resolved Hide resolved
@@ -16,7 +16,7 @@

setup(
name="data_gateway",
version="0.8.0",
version="0.8.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi threading feels like a new feature 😂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess, I'm doing it to fix a bug though :P I think I'll probably change it to a minor version increase.

@cortadocodes
Copy link
Member Author

This PR has been superseded by #22 and #23

@cortadocodes cortadocodes deleted the fix/read-from-serial-port-in-separate-thread branch February 1, 2022 17:06
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

3 participants