mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-08 23:08:10 -07:00
FuriHal,BleGlue: prevent sleep while HCI command executed, proper bt api rpc locking. Fixes random system lockups. (#3107)
This commit is contained in:
@@ -181,9 +181,11 @@ static void ble_app_hci_event_handler(void* pPayload) {
|
||||
|
||||
static void ble_app_hci_status_not_handler(HCI_TL_CmdStatus_t status) {
|
||||
if(status == HCI_TL_CmdBusy) {
|
||||
furi_hal_power_insomnia_enter();
|
||||
furi_mutex_acquire(ble_app->hci_mtx, FuriWaitForever);
|
||||
} else if(status == HCI_TL_CmdAvailable) {
|
||||
furi_mutex_release(ble_app->hci_mtx);
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <hsem_map.h>
|
||||
|
||||
#include <furi_hal_version.h>
|
||||
#include <furi_hal_power.h>
|
||||
#include <furi_hal_bt_hid.h>
|
||||
#include <furi_hal_bt_serial.h>
|
||||
#include <furi_hal_bus.c>
|
||||
@@ -269,6 +270,7 @@ bool furi_hal_bt_start_app(FuriHalBtProfile profile, GapEventCallback event_cb,
|
||||
}
|
||||
|
||||
void furi_hal_bt_reinit() {
|
||||
furi_hal_power_insomnia_enter();
|
||||
FURI_LOG_I(TAG, "Disconnect and stop advertising");
|
||||
furi_hal_bt_stop_advertising();
|
||||
|
||||
@@ -298,6 +300,7 @@ void furi_hal_bt_reinit() {
|
||||
furi_hal_bt_init();
|
||||
|
||||
furi_hal_bt_start_radio_stack();
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
bool furi_hal_bt_change_app(FuriHalBtProfile profile, GapEventCallback event_cb, void* context) {
|
||||
|
||||
Reference in New Issue
Block a user