Skip to content

espsoftwareserial 6.4.0 readBytes always returns -1 #128

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

Closed
dirkmueller opened this issue Dec 18, 2019 · 4 comments
Closed

espsoftwareserial 6.4.0 readBytes always returns -1 #128

dirkmueller opened this issue Dec 18, 2019 · 4 comments
Assignees
Labels

Comments

@dirkmueller
Copy link

dirkmueller commented Dec 18, 2019

with the change

0b9ac7c#diff-67183b415c133795f221633c3e752798L193-R196

The readBytes() method now always returns -1 in 9600-baud-8N1 serial mode, which breaks my application.

I suggest to do a change similar to this:

    if (m_parityBuffer && 0 != size) {
        uint32_t parityBits = size;
        while (m_parityOutPos >>= 1) ++parityBits;
        m_parityOutPos = (1 << (parityBits % 8));
        m_parityBuffer->pop_n(nullptr, parityBits / 8);
        return size;
    }
-   return -1;
+   return 0 != size ? size : -1;

alternatively returning size always might not be a bad situation either (would work for me), but it is a change in contract/behavior then.

@dok-net
Copy link
Collaborator

dok-net commented Dec 18, 2019

OMG - apparently a failure in my testing process. Fixing ASAP.

@dok-net
Copy link
Collaborator

dok-net commented Dec 18, 2019

@dirkmueller Please test for regressions and let me know. Thanks! Check the README for instructions on how to use non-release versions of EspSoftwareSerial with ESP8266.

@dirkmueller
Copy link
Author

dirkmueller commented Dec 18, 2019

thanks for the quick turnaround. Changes look good to me. I'll do a closer retesting later tonight.

@dirkmueller
Copy link
Author

current master seems to work all fine. please release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants