Merge pull request #4654 from dhalbert/6.2.x-merge-1
Port #4645 to main
This commit is contained in:
commit
80f05c76a8
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -498,7 +498,7 @@ jobs:
|
|||||||
id: idf-cache
|
id: idf-cache
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/.idf_tools
|
path: ${{ github.workspace }}/.idf_tools
|
||||||
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210415
|
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210422
|
||||||
- name: Clone IDF submodules
|
- name: Clone IDF submodules
|
||||||
run: |
|
run: |
|
||||||
(cd $IDF_PATH && git submodule update --init)
|
(cd $IDF_PATH && git submodule update --init)
|
||||||
|
@ -291,13 +291,14 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data,
|
|||||||
mp_raise_ValueError(translate("No TX pin"));
|
mp_raise_ValueError(translate("No TX pin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (len > 0) {
|
size_t left_to_write = len;
|
||||||
int count = uart_tx_chars(self->uart_num, (const char *)data, len);
|
while (left_to_write > 0) {
|
||||||
|
int count = uart_tx_chars(self->uart_num, (const char *)data, left_to_write);
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
*errcode = MP_EAGAIN;
|
*errcode = MP_EAGAIN;
|
||||||
return MP_STREAM_ERROR;
|
return MP_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
len -= count;
|
left_to_write -= count;
|
||||||
data += count;
|
data += count;
|
||||||
RUN_BACKGROUND_TASKS;
|
RUN_BACKGROUND_TASKS;
|
||||||
}
|
}
|
||||||
|
@ -191,12 +191,13 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data,
|
|||||||
mp_raise_ValueError(translate("No TX pin"));
|
mp_raise_ValueError(translate("No TX pin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (len > 0) {
|
size_t left_to_write = len;
|
||||||
while (uart_is_writable(self->uart) && len > 0) {
|
while (left_to_write > 0) {
|
||||||
|
while (uart_is_writable(self->uart) && left_to_write > 0) {
|
||||||
// Write and advance.
|
// Write and advance.
|
||||||
uart_get_hw(self->uart)->dr = *data++;
|
uart_get_hw(self->uart)->dr = *data++;
|
||||||
// Decrease how many chars left to write.
|
// Decrease how many chars left to write.
|
||||||
len--;
|
left_to_write--;
|
||||||
}
|
}
|
||||||
RUN_BACKGROUND_TASKS;
|
RUN_BACKGROUND_TASKS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user