Skip to content

Commit

Permalink
pbio/sys/program_stop: Drop hack to stop Bluetooth.
Browse files Browse the repository at this point in the history
We have an old hack that shuts down the bluetooth process. When starting a new task after that in a cleanup routine such as added in 04fd2e7, the hub will never finish the task, which prevents the user program from stopping.

We have several proper fixes in place now, and we are about to merge some updates that will make all Bluetooth task objects static, so we should remove this hack.

Fixes pybricks/support#1438
  • Loading branch information
laurensvalk committed Feb 16, 2024
1 parent 2cdd212 commit 0945da5
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib/pbio/sys/program_stop.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ static bool stop_button_pressed;
*/
void pbsys_program_stop(bool force_stop) {
if (pbsys_status_test(PBIO_PYBRICKS_STATUS_USER_PROGRAM_RUNNING)) {
if (force_stop) {
// HACK: Bluetooth drivers have issues with pending tasks not being
// cancellable, so this should force them to be canceled and avoid
// undefined behavior due to use after free.
pbdrv_bluetooth_power_on(false);
}
pbsys_main_stop_program(force_stop);
}
}
Expand Down

0 comments on commit 0945da5

Please sign in to comment.