-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Conversation
✅ Build completed.
Please test this code using one of the following:
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-521-linux32.tar.xz
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-521-linux64.tar.xz
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-521-windows.zip
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-521-macosx.zip
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-521-linuxarm.tar.xz
i️ The linuxarm
build is still experimental and may not be always available.
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
).
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.
05573af
to
98699df
Compare
@matthijskooijman I've pushed the changes, if things look good, I will go ahead and squash the commits.
✅ Build completed.
Please test this code using one of the following:
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-523-linux32.tar.xz
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-523-linux64.tar.xz
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-523-windows.zip
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-523-macosx.zip
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-4669-BUILD-523-linuxarm.tar.xz
i️ The linuxarm
build is still experimental and may not be always available.
Resolves #2858.
Prior to this,
read
andpeek
would return different values if the byte value was greater than 127.For example, if the buffered byte was
180
,read
would return180
, butpeek
would return-76
.