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

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

Open
Labels
Component: CoreRelated to the code for the standard Arduino API Print and Stream classThe Arduino core library's Print and Stream classes Type: Bug
@baer61

Description

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 API Print and Stream classThe Arduino core library's Print and Stream classes Type: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

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