Skip to content

Commit b460d6d

Browse files
committed
bricks/_common_stm32: Run pool hook on print if disconnected.
Fixes certain tight loops with f-strings locking up the hub when disconnected. Fixes pybricks/support#1668
1 parent 68a59ef commit b460d6d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
from `3.6.0b1` to `3.5.0` and back to `3.6.0b1` ([support#1846]).
1515
- Fixed controls stopping if `use_gyro` is called again with the same
1616
argument as already active ([support#1858]).
17+
- Fixed lockup and reboot with f-strings in tight loops ([support#1668]).
1718

1819
[support#1623]: https://github.com/pybricks/support/issues/1623
20+
[support#1668]: https://github.com/pybricks/support/issues/1668
1921
[support#1846]: https://github.com/pybricks/support/issues/1846
2022
[support#1858]: https://github.com/pybricks/support/issues/1858
2123

bricks/_common_stm32/mphalport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
138138
continue;
139139
}
140140

141+
MICROPY_EVENT_POLL_HOOK
142+
141143
if (err != PBIO_ERROR_AGAIN) {
142144
// Ignoring error for now. This means stdout lost if Bluetooth is
143145
// disconnected.
144146
return;
145147
}
146-
147-
MICROPY_EVENT_POLL_HOOK
148148
}
149149
}
150150

0 commit comments

Comments
 (0)