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

Commit 94e7274

Browse filesBrowse files
committed
Refactor for fewer indirect calls.
1 parent 56d2ebe commit 94e7274
Copy full SHA for 94e7274

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed

‎cores/esp32/HardwareSerial.cpp

Copy file name to clipboardExpand all lines: cores/esp32/HardwareSerial.cpp
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ int HardwareSerial::read(void)
137137
// the buffer is NOT null terminated.
138138
size_t HardwareSerial::read(uint8_t *buffer, size_t size)
139139
{
140+
size_t avail = available();
141+
if (size < avail) {
142+
avail = size;
143+
}
140144
size_t count = 0;
141-
while(count < size) {
142-
int c = read();
143-
if(c < 0) {
144-
break;
145-
}
146-
*buffer++ = (char) c;
145+
while(count < avail) {
146+
*buffer++ = uartRead(_uart);
147147
count++;
148148
}
149149
return count;

0 commit comments

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