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 testing of rs232.SerialData #164

Merged
merged 13 commits into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## [Unreleased]

- PR#164 (no sha yet)
Copy link
Member

Choose a reason for hiding this comment

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

I guess we should first clarify what the purpose of the changelog is. I'm mostly following http://keepachangelog.com/en/0.3.0/

I don't think we care about the PR or the SHA. Things like "...doesn't hide exceptions..." also seem like too much detail for how I think about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

- rs232.SerialData doesn't hide exceptions during opening of the port.
- Support added for testing of serial devices.

- PR#148 (a436f2a127af43b6655410321f820d7660a0fe51)
- Remove threading support from rs232.SerialData, it wasn't used.

## [0.5.1] - 2017-12-02
### Added
- First real release!
Expand All @@ -11,4 +18,4 @@
- Relies on separate repositories PEAS and PACE
- Automated testing with travis-ci.org
- Code coverage via codecov.io
- Basic install scripts
- Basic install scripts
18 changes: 7 additions & 11 deletions pocs/utils/rs232.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def __init__(self,
# Properties have been set to reasonable values, ready to open the port.
self.ser.open()

# TODO(jamessynge): Consider eliminating this sleep period, or making
# it an option in the configure file. For one thing, it slows down tests!
open_delay = max(0.0, float(open_delay))
self.logger.debug(
'Serial connection set up to %r, sleeping for %r seconds', self.name, open_delay)
Expand Down Expand Up @@ -159,16 +157,14 @@ def get_reading(self):
return info

def clear_buffer(self):
""" Clear Response Buffer """
# Not worrying here about bytes arriving between reading in_waiting
# and calling reset_input_buffer().
# Note that Wilfred reports that the Arduino input can seriously lag behind
# realtime (e.g. 10 seconds), and that clear_buffer may exist for that reason
# (i.e. toss out any buffered input, and then read the next full line...
# which likely requires tossing out a fragment of a line).
count = self.ser.in_waiting
"""Clear buffered data from connected port/device.

Note that Wilfred reports that the input from an Arduino can seriously lag behind
realtime (e.g. 10 seconds), and that clear_buffer may exist for that reason (i.e. toss
out any buffered input from a device, and then read the next full line, which likely
requires tossing out a fragment of a line).
"""
self.ser.reset_input_buffer()
# self.logger.debug('Cleared {} bytes from buffer'.format(count))

def __del__(self):
"""Close the serial device on delete.
Expand Down