Skip to content

Commit 2bfcbde

Browse files
authored
Fix incorrect status when Bluetooth is turned off. (#121)
* Fix incorrect status when Bluetooth is turned off. * Always send Bluetooth switch command. * Update command for retrieving firmware version.
1 parent 1547410 commit 2bfcbde

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.github/workflows/build-static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
- name: "Populate vars"
1414
run: |
15-
FIRMWARE_VERSION=$(cat ./core/embed/firmware/version.h | grep "ONEKEY_VERSION " | awk -F "[\"\"]" '{print $2}')
15+
FIRMWARE_VERSION=$(cat ./core/embed/firmware/version.h | grep -E '#define ONEKEY_VERSION_(MAJOR|MINOR|PATCH)' | awk '{printf "%s.", $3}' | sed 's/\.$//')
1616
BUILD_DATE=$(date +"%Y%m%d")
1717
SHORT_HASH=$(git rev-parse --short HEAD)
1818
echo "FIRMWARE_VERSION=$FIRMWARE_VERSION" >> $GITHUB_ENV

core/src/trezor/uart.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ async def _deal_ble_status(value: bytes) -> None:
430430
if config.is_unlocked():
431431
device.set_ble_status(enable=True)
432432
elif res == _BLE_STATUS_CLOSED:
433+
utils.BLE_CONNECTED = False
433434
if not device.is_initialized():
434435
StatusBar.get_instance().show_ble(StatusBar.BLE_STATE_ENABLED)
435436
ctrl_ble(True)
@@ -543,9 +544,9 @@ def ctrl_ble(enable: bool) -> None:
543544
"""Request to open or close ble.
544545
@param enable: True to open, False to close
545546
"""
546-
if (not device.ble_enabled() or not device.is_initialized()) and enable:
547+
if enable:
547548
BLE_CTRL.ctrl(0x81, b"\x01")
548-
elif device.ble_enabled() and not enable:
549+
else:
549550
BLE_CTRL.ctrl(0x81, b"\x02")
550551

551552

0 commit comments

Comments
 (0)