diff --git a/applications/bt/bt_service/bt.c b/applications/bt/bt_service/bt.c index 75392caf..0015c08c 100755 --- a/applications/bt/bt_service/bt.c +++ b/applications/bt/bt_service/bt.c @@ -199,13 +199,18 @@ static bool bt_on_gap_event_callback(GapEvent event, void* context) { furi_check(osMessageQueuePut(bt->message_queue, &message, 0, osWaitForever) == osOK); if(bt->profile == BtProfileSerial) { // Open RPC session - FURI_LOG_I(TAG, "Open RPC connection"); bt->rpc_session = rpc_session_open(bt->rpc); - rpc_session_set_send_bytes_callback(bt->rpc_session, bt_rpc_send_bytes_callback); - rpc_session_set_buffer_is_empty_callback( - bt->rpc_session, furi_hal_bt_serial_notify_buffer_is_empty); - rpc_session_set_context(bt->rpc_session, bt); - furi_hal_bt_serial_set_event_callback(RPC_BUFFER_SIZE, bt_serial_event_callback, bt); + if(bt->rpc_session) { + FURI_LOG_I(TAG, "Open RPC connection"); + rpc_session_set_send_bytes_callback(bt->rpc_session, bt_rpc_send_bytes_callback); + rpc_session_set_buffer_is_empty_callback( + bt->rpc_session, furi_hal_bt_serial_notify_buffer_is_empty); + rpc_session_set_context(bt->rpc_session, bt); + furi_hal_bt_serial_set_event_callback( + RPC_BUFFER_SIZE, bt_serial_event_callback, bt); + } else { + FURI_LOG_W(TAG, "RPC is busy, failed to open new session"); + } } // Update battery level PowerInfo info; diff --git a/firmware/targets/f6/furi_hal/furi_hal_bt.c b/firmware/targets/f6/furi_hal/furi_hal_bt.c index 9d0c36fc..1bd244a9 100755 --- a/firmware/targets/f6/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f6/furi_hal/furi_hal_bt.c @@ -47,7 +47,7 @@ FuriHalBtProfileConfig profile_config[FuriHalBtProfileNumber] = { .conn_int_min = 0x08, .conn_int_max = 0x18, .slave_latency = 0, - .supervisor_timeout = 50, + .supervisor_timeout = 0, }, }, }, diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index 9d0c36fc..1bd244a9 100755 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -47,7 +47,7 @@ FuriHalBtProfileConfig profile_config[FuriHalBtProfileNumber] = { .conn_int_min = 0x08, .conn_int_max = 0x18, .slave_latency = 0, - .supervisor_timeout = 50, + .supervisor_timeout = 0, }, }, }, diff --git a/lib/drivers/bq27220.c b/lib/drivers/bq27220.c index bcdf4535..a0401af7 100644 --- a/lib/drivers/bq27220.c +++ b/lib/drivers/bq27220.c @@ -44,7 +44,7 @@ bool bq27220_set_parameter_u16(FuriHalI2cBusHandle* handle, uint16_t address, ui delay_us(10000); - uint8_t checksum = bq27220_get_checksum(&buffer[1], 4); + uint8_t checksum = bq27220_get_checksum(buffer, 4); buffer[0] = checksum; buffer[1] = 6; ret = furi_hal_i2c_write_mem(