Skip to content

Commit

Permalink
Emit the message BleRadioEnableToggle to DisplayApp only if the enabl…
Browse files Browse the repository at this point in the history
…e state of the radio has actually changed. (#2037)

This fixes an issue where the BLE connected logo would disappear when opening and closing the BLE setting (without changing it) while InfiniTime was already connected to a companion app.

Co-authored-by: JustScott <[email protected]>
  • Loading branch information
JF002 and JustScott authored Mar 15, 2024
1 parent 7dbb8f5 commit 4ca2112
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/displayapp/screens/settings/SettingBluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ namespace {

SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
: app {app},
settings {settingsController},
checkboxList(
0,
1,
"Bluetooth",
Symbols::bluetooth,
settingsController.GetBleRadioEnabled() ? 0 : 1,
[&settings = settingsController](uint32_t index) {
[this](uint32_t index) {
const bool priorMode = settings.GetBleRadioEnabled();
const bool newMode = options[index].radioEnabled;
if (newMode != priorMode) {
settings.SetBleRadioEnabled(newMode);
this->app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
}
},
CreateOptionArray()) {
}

SettingBluetooth::~SettingBluetooth() {
lv_obj_clean(lv_scr_act());
// Pushing the message in the OnValueChanged function causes a freeze?
app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
}
1 change: 1 addition & 0 deletions src/displayapp/screens/settings/SettingBluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Pinetime {

private:
DisplayApp* app;
Pinetime::Controllers::Settings& settings;
CheckboxList checkboxList;
};
}
Expand Down

0 comments on commit 4ca2112

Please sign in to comment.