Skip to content

Commit aef060b

Browse files
Merge branch 'master' into gdb
2 parents bffd385 + dc03293 commit aef060b

File tree

14 files changed

+342
-147
lines changed

14 files changed

+342
-147
lines changed

.travis.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,58 +20,69 @@ stages:
2020
jobs:
2121
include:
2222
# Build stage. To save time, run all kinds of builds and tests in parallel.
23-
- name: "Host tests"
24-
stage: build
25-
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
26-
install: sudo apt-get install valgrind lcov
27-
2823
# TODO: since we can now call different script for each job,
2924
# split the do-it-all common.sh into separate scripts responsible
3025
# for different types of jobs below:
26+
- name: "Platformio (1)"
27+
stage: build
28+
script: $TRAVIS_BUILD_DIR/tests/common.sh
29+
env:
30+
- BUILD_TYPE=platformio_even
31+
- name: "Platformio (2)"
32+
stage: build
33+
script: $TRAVIS_BUILD_DIR/tests/common.sh
34+
env:
35+
- BUILD_TYPE=platformio_odd
3136
- name: "Build (1)"
37+
stage: build
3238
script: $TRAVIS_BUILD_DIR/tests/common.sh
3339
env:
3440
- BUILD_TYPE=build_even
3541
- name: "Build (2)"
42+
stage: build
3643
script: $TRAVIS_BUILD_DIR/tests/common.sh
3744
env:
3845
- BUILD_TYPE=build_odd
3946
- name: "Debug (1)"
47+
stage: build
4048
script: $TRAVIS_BUILD_DIR/tests/common.sh
4149
env:
4250
- BUILD_TYPE=debug_even
4351
- name: "Debug (2)"
52+
stage: build
4453
script: $TRAVIS_BUILD_DIR/tests/common.sh
4554
env:
4655
- BUILD_TYPE=debug_odd
4756
- name: "Build IPv6 (1)"
57+
stage: build
4858
script: $TRAVIS_BUILD_DIR/tests/common.sh
4959
env:
5060
- BUILD_TYPE=build6_even
5161
- name: "Build IPv6 (2)"
62+
stage: build
5263
script: $TRAVIS_BUILD_DIR/tests/common.sh
5364
env:
5465
- BUILD_TYPE=build6_odd
55-
- name: "Platformio (1)"
56-
script: $TRAVIS_BUILD_DIR/tests/common.sh
57-
env:
58-
- BUILD_TYPE=platformio_even
59-
- name: "Platformio (2)"
60-
script: $TRAVIS_BUILD_DIR/tests/common.sh
61-
env:
62-
- BUILD_TYPE=platformio_odd
66+
67+
- name: "Host tests"
68+
stage: build
69+
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
70+
install: sudo apt-get install valgrind lcov
6371

6472
- name: "Docs"
73+
stage: build
6574
script: $TRAVIS_BUILD_DIR/tests/ci/build_docs.sh
6675
install:
6776
- sudo apt-get install python3-pip
6877
- pip3 install --user -r doc/requirements.txt;
6978

7079
- name: "Style check"
80+
stage: build
7181
script: $TRAVIS_BUILD_DIR/tests/ci/style_check.sh
7282
install: tests/ci/install_astyle.sh
7383

7484
- name: "Boards"
85+
stage: build
7586
script: $TRAVIS_BUILD_DIR/tests/ci/build_boards.sh
7687

7788
# Deploy stage.

cores/esp8266/HardwareSerial.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <stdio.h>
2828
#include <string.h>
2929
#include <inttypes.h>
30+
#include <PolledTimeout.h>
3031
#include "Arduino.h"
3132
#include "HardwareSerial.h"
3233
#include "Esp.h"
@@ -132,6 +133,22 @@ unsigned long HardwareSerial::detectBaudrate(time_t timeoutMillis)
132133
return detectedBaudrate;
133134
}
134135

136+
size_t HardwareSerial::readBytes(char* buffer, size_t size)
137+
{
138+
size_t got = 0;
139+
140+
while (got < size)
141+
{
142+
esp8266::polledTimeout::oneShot timeOut(_timeout);
143+
size_t avail;
144+
while ((avail = available()) == 0 && !timeOut);
145+
if (avail == 0)
146+
break;
147+
got += read(buffer + got, std::min(size - got, avail));
148+
}
149+
return got;
150+
}
151+
135152
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
136153
HardwareSerial Serial(UART0);
137154
#endif

cores/esp8266/HardwareSerial.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,15 @@ class HardwareSerial: public Stream
132132
// return -1 when data is unvailable (arduino api)
133133
return uart_read_char(_uart);
134134
}
135-
size_t readBytes(char* buffer, size_t size) override
135+
// ::read(buffer, size): same as readBytes without timeout
136+
size_t read(char* buffer, size_t size)
136137
{
137138
return uart_read(_uart, buffer, size);
138139
}
140+
size_t readBytes(char* buffer, size_t size) override;
139141
size_t readBytes(uint8_t* buffer, size_t size) override
140142
{
141-
return uart_read(_uart, (char*)buffer, size);
143+
return readBytes((char*)buffer, size);
142144
}
143145
int availableForWrite(void)
144146
{

0 commit comments

Comments
 (0)