Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add missing cast to SoftwareSerial::peek() when returning buffered value #4669

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
agdl merged 2 commits into arduino:master from sandeepmistry:software-serial-peek-cast
Mar 31, 2016

Conversation

Copy link
Contributor

@sandeepmistry sandeepmistry commented Mar 9, 2016

Resolves #2858.

Prior to this, read and peek would return different values if the byte value was greater than 127.

For example, if the buffered byte was 180, read would return 180, but peek would return -76.

@sandeepmistry sandeepmistry added Library: SoftwareSerial The SoftwareSerial Arduino library feature request A request to make an enhancement (not a bug fix) labels Mar 9, 2016
Copy link
Collaborator

I wonder if it would not be better to change the buffer to an uint8_t instead, removing the need for these casts. I don't see any reason for the buffer to use char, as it does now (even more because char is ambiguous in signedness, if is must be signed it should at least use signed char or int8_t).

Copy link
Contributor Author

Yes, I agree. It can be changed to unsigned char (this is what HardwareSerial uses) or uint8_t. This will also slightly clean up the read method.

I'll work on this, and then update the PR.

Copy link
Contributor Author

@matthijskooijman I've pushed the changes, if things look good, I will go ahead and squash the commits.

@agdl agdl merged commit a7ca976 into arduino:master Mar 31, 2016
@sandeepmistry sandeepmistry deleted the software-serial-peek-cast branch July 18, 2016 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
feature request A request to make an enhancement (not a bug fix) Library: SoftwareSerial The SoftwareSerial Arduino library
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /