mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-07 19:01:54 -07:00
Fix BT settings inconsistency with lock menu
This commit is contained in:
@@ -16,9 +16,9 @@ BtSettingsApp* bt_settings_app_alloc() {
|
||||
BtSettingsApp* app = malloc(sizeof(BtSettingsApp));
|
||||
|
||||
// Load settings
|
||||
bt_settings_load(&app->settings);
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
app->bt = furi_record_open(RECORD_BT);
|
||||
bt_settings_load(&app->bt->bt_settings);
|
||||
|
||||
// View Dispatcher and Scene Manager
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
@@ -79,7 +79,7 @@ extern int32_t bt_settings_app(void* p) {
|
||||
UNUSED(p);
|
||||
BtSettingsApp* app = bt_settings_app_alloc();
|
||||
view_dispatcher_run(app->view_dispatcher);
|
||||
bt_settings_save(&app->settings);
|
||||
bt_settings_save(&app->bt->bt_settings);
|
||||
bt_settings_app_free(app);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <furi.h>
|
||||
#include <bt/bt_service/bt.h>
|
||||
#include <bt/bt_service/bt_i.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
@@ -24,7 +25,6 @@ enum BtSettingsCustomEvent {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
BtSettings settings;
|
||||
Bt* bt;
|
||||
Gui* gui;
|
||||
SceneManager* scene_manager;
|
||||
|
||||
@@ -46,7 +46,7 @@ void bt_settings_scene_start_on_enter(void* context) {
|
||||
BtSettingNum,
|
||||
bt_settings_scene_start_var_list_change_callback,
|
||||
app);
|
||||
if(app->settings.enabled) {
|
||||
if(app->bt->bt_settings.enabled) {
|
||||
variable_item_set_current_value_index(item, BtSettingOn);
|
||||
variable_item_set_current_value_text(item, bt_settings_text[BtSettingOn]);
|
||||
} else {
|
||||
@@ -71,10 +71,10 @@ bool bt_settings_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == BtSettingOn) {
|
||||
furi_hal_bt_start_advertising();
|
||||
app->settings.enabled = true;
|
||||
app->bt->bt_settings.enabled = true;
|
||||
consumed = true;
|
||||
} else if(event.event == BtSettingOff) {
|
||||
app->settings.enabled = false;
|
||||
app->bt->bt_settings.enabled = false;
|
||||
furi_hal_bt_stop_advertising();
|
||||
consumed = true;
|
||||
} else if(event.event == BtSettingsCustomEventForgetDevices) {
|
||||
|
||||
Reference in New Issue
Block a user