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

Appearance settings

Stream.find() functions don't find bytes as of 0x80 from HardwareSerial/SoftwareSerial #9452

Copy link
Copy link
Open
@baer61

Description

@baer61
Issue body actions

HardwareSerial/SoftwareSerial::read() return a byte where the functions are defined to return an int. The implicit conversion from "unsigned char/uint8_t" to int returns 0xFFAA (= -86) for the received byte 0xAA.
The function Stream::findMulti() then tests the integer returned by Stream::timedRead() with "c < 0" instead of "c == -1" to distinguish between a received byte and -1 for still nothing available on the stream.
Therefore the function Stream.find() comes back with -1 after timeout, although read() received the byte 0xAA.
It took a lot of time to find out the reason why I didn't found the start byte 0xAA on the stream from my MP3 module response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CoreRelated to the code for the standard Arduino APIRelated to the code for the standard Arduino APIPrint and Stream classThe Arduino core library's Print and Stream classesThe Arduino core library's Print and Stream classesType: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.