Skip to content

Commit

Permalink
fix: fix the problem of losing Bluetooth status connection command (#582
Browse files Browse the repository at this point in the history
)

* fix the problem of losing Bluetooth status connection command
  • Loading branch information
guowei0105 authored Oct 21, 2024
1 parent f9bf552 commit 566884c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: 'https://releases.nixos.org/nix/nix-2.23.3/install'
name: "Run style check"
- run: nix-shell --run "poetry install"
- run: nix-shell --run "poetry run make style_check"
Expand All @@ -26,6 +27,7 @@ jobs:
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: 'https://releases.nixos.org/nix/nix-2.23.3/install'
name: "Run defs check"
- run: nix-shell --run "poetry install"
- run: nix-shell --run "poetry run make defs_check"
Expand All @@ -41,6 +43,7 @@ jobs:
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: 'https://releases.nixos.org/nix/nix-2.23.3/install'
name: "Run gen check"
- run: nix-shell --run "poetry install"
- run: nix-shell --run "poetry run make gen_check"
Expand Down
3 changes: 2 additions & 1 deletion core/embed/trezorhal/usart.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ void ble_usart_init(void) {
if (HAL_UART_Init(huart) != HAL_OK) {
ensure(secfalse, "uart init failed");
}

HAL_UARTEx_EnableFifoMode(huart);
HAL_UARTEx_SetRxFifoThreshold(huart, UART_RXFIFO_THRESHOLD_1_8);
NVIC_SetPriority(UART4_IRQn, IRQ_PRI_UART);
HAL_NVIC_EnableIRQ(UART4_IRQn);

Expand Down
2 changes: 2 additions & 0 deletions core/src/apps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,10 @@ async def handle_CancelAuthorization(

def set_homescreen() -> None:
import lvgl as lv # type: ignore[Import "lvgl" could not be resolved]
from trezor import uart

ble_name = storage.device.get_ble_name()
uart.get_ble_con_status()
if storage.device.is_initialized():
dev_state = get_state()
device_name = storage.device.get_label()
Expand Down
5 changes: 5 additions & 0 deletions core/src/trezor/uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,8 @@ def get_ble_hash() -> bytes:

def is_ble_opened() -> bool:
return BLE_ENABLED if BLE_ENABLED is not None else True


def get_ble_con_status() -> None:
"""Get ble con status."""
BLE_CTRL.ctrl(0x81, 0x07)

0 comments on commit 566884c

Please sign in to comment.