summaryrefslogtreecommitdiff
path: root/src/ui/ui_fsm.cpp
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-02-13 10:32:59 +1100
committerailurux <ailuruxx@gmail.com>2024-02-13 10:32:59 +1100
commit15f3da0f8ca9b85125ac557aa15c222e50fc8c8a (patch)
tree3f24a7429ed922781c22084c1dc0aeb319d96675 /src/ui/ui_fsm.cpp
parent26ae027d6721510e4b4a8107e95acc57efaaf2c6 (diff)
parentcb379f4bc3c51eacf80b786566ab3c2675191164 (diff)
downloadtangara-fw-15f3da0f8ca9b85125ac557aa15c222e50fc8c8a.tar.gz
Merge branch 'main' into scroll-sensitivity
Diffstat (limited to 'src/ui/ui_fsm.cpp')
-rw-r--r--src/ui/ui_fsm.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp
index da8d8999..24145ead 100644
--- a/src/ui/ui_fsm.cpp
+++ b/src/ui/ui_fsm.cpp
@@ -368,14 +368,20 @@ void UiState::react(const audio::VolumeLimitChanged& ev) {
void UiState::react(const system_fsm::BluetoothEvent& ev) {
auto bt = sServices->bluetooth();
+ auto dev = bt.ConnectedDevice();
switch (ev.event) {
case drivers::bluetooth::Event::kKnownDevicesChanged:
sBluetoothDevices.Update(bt.KnownDevices());
break;
case drivers::bluetooth::Event::kConnectionStateChanged:
sBluetoothConnected.Update(bt.IsConnected());
- if (bt.ConnectedDevice()) {
- sBluetoothPairedDevice.Update(bt.ConnectedDevice().value());
+ if (dev) {
+ sBluetoothPairedDevice.Update(drivers::bluetooth::Device{
+ .address = dev->mac,
+ .name = {dev->name.data(), dev->name.size()},
+ .class_of_device = 0,
+ .signal_strength = 0,
+ });
} else {
sBluetoothPairedDevice.Update(std::monostate{});
}
@@ -505,9 +511,6 @@ void Lua::entry() {
auto bt = sServices->bluetooth();
sBluetoothEnabled.Update(bt.IsEnabled());
sBluetoothConnected.Update(bt.IsConnected());
- if (bt.ConnectedDevice()) {
- sBluetoothPairedDevice.Update(bt.ConnectedDevice().value());
- }
sBluetoothDevices.Update(bt.KnownDevices());
sCurrentScreen.reset();