Skip to content

Commit e025802

Browse files
committed
upd findmyflipper
1 parent 5ab0b9e commit e025802

File tree

4 files changed

+28
-23
lines changed

4 files changed

+28
-23
lines changed

base_pack/find_my_flipper/application.fam

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ App(
1010
fap_category="Bluetooth",
1111
fap_author="@MatthewKuKanich",
1212
fap_weburl="https://github.com/MatthewKuKanich/FindMyFlipper",
13-
fap_version="3.0",
13+
fap_version="3.5",
1414
fap_description="BLE FindMy Location Beacon",
1515
)

base_pack/find_my_flipper/findmy_state.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,17 @@ bool findmy_state_load(FindMyState* out_state) {
2929
if(!flipper_format_read_uint32(file, "transmit_power", &tmp, 1)) break;
3030
state.transmit_power = tmp;
3131

32-
if(!flipper_format_read_bool(file, "show_mac", &state.show_mac, 1)) {
33-
// Support migrating from old config
34-
state.show_mac = false;
32+
if(!flipper_format_read_uint32(file, "tag_type", &tmp, 1)) {
33+
tmp = FindMyTypeApple;
3534
flipper_format_rewind(file);
3635
}
36+
state.tag_type = tmp;
3737

38-
if(!flipper_format_read_uint32(file, "tag_type", &tmp, 1)) {
38+
if(!flipper_format_read_bool(file, "show_mac", &state.show_mac, 1)) {
3939
// Support migrating from old config
40-
tmp = FindMyTypeApple;
40+
state.show_mac = false;
4141
flipper_format_rewind(file);
4242
}
43-
state.tag_type = tmp;
4443

4544
if(!flipper_format_read_hex(file, "mac", state.mac, sizeof(state.mac))) break;
4645

@@ -162,6 +161,7 @@ void findmy_state_save(FindMyState* state) {
162161
if(!flipper_format_write_uint32(file, "transmit_power", &tmp, 1)) break;
163162

164163
tmp = state->tag_type;
164+
FURI_LOG_E("tag_type at save", "%ld", tmp);
165165
if(!flipper_format_write_uint32(file, "tag_type", &tmp, 1)) break;
166166

167167
if(!flipper_format_write_bool(file, "show_mac", &state->show_mac, 1)) break;

base_pack/find_my_flipper/scenes/findmy_scene_config_import_result.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ void findmy_scene_config_import_result_on_enter(void* context) {
2929
popup_set_timeout(popup, 1500);
3030
popup_set_context(popup, app);
3131
popup_set_callback(popup, findmy_scene_config_import_result_callback);
32-
findmy_main_update_active(app->findmy_main, furi_hal_bt_extra_beacon_is_active());
33-
findmy_main_update_mac(app->findmy_main, app->state.mac);
34-
findmy_main_update_type(app->findmy_main, app->state.tag_type);
32+
3533
view_dispatcher_switch_to_view(app->view_dispatcher, FindMyViewPopup);
3634
}
3735

base_pack/find_my_flipper/scenes/findmy_scene_main.c

+20-13
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
11
#include "../findmy_i.h"
22

3-
void findmy_scene_main_callback(FindMyMainEvent event, void* context) {
3+
void findmy_scene_main_callback(FindMyMainEvent event, void *context)
4+
{
45
furi_assert(context);
5-
FindMy* app = context;
6+
FindMy *app = context;
67
view_dispatcher_send_custom_event(app->view_dispatcher, event);
78
}
89

9-
void findmy_scene_main_on_enter(void* context) {
10-
FindMy* app = context;
10+
void findmy_scene_main_on_enter(void *context)
11+
{
12+
FindMy *app = context;
1113

1214
findmy_main_set_callback(app->findmy_main, findmy_scene_main_callback, app);
13-
1415
view_dispatcher_switch_to_view(app->view_dispatcher, FindMyViewMain);
1516
}
1617

17-
bool findmy_scene_main_on_event(void* context, SceneManagerEvent event) {
18-
FindMy* app = context;
18+
bool findmy_scene_main_on_event(void *context, SceneManagerEvent event)
19+
{
20+
FindMy *app = context;
1921
bool consumed = false;
2022

21-
if(event.type == SceneManagerEventTypeCustom) {
23+
if (event.type == SceneManagerEventTypeCustom)
24+
{
2225
consumed = true;
23-
switch(event.event) {
26+
switch (event.event)
27+
{
2428
case FindMyMainEventToggle:
2529
findmy_toggle_beacon(app);
2630
break;
2731
case FindMyMainEventBackground:
2832
app->state.beacon_active = true;
2933
findmy_state_save(&app->state);
30-
if(!furi_hal_bt_extra_beacon_is_active()) {
34+
if (!furi_hal_bt_extra_beacon_is_active())
35+
{
3136
furi_check(furi_hal_bt_extra_beacon_start());
3237
}
3338
view_dispatcher_stop(app->view_dispatcher);
@@ -44,7 +49,8 @@ bool findmy_scene_main_on_event(void* context, SceneManagerEvent event) {
4449
case FindMyMainEventQuit:
4550
app->state.beacon_active = false;
4651
findmy_state_save(&app->state);
47-
if(furi_hal_bt_extra_beacon_is_active()) {
52+
if (furi_hal_bt_extra_beacon_is_active())
53+
{
4854
furi_check(furi_hal_bt_extra_beacon_stop());
4955
}
5056
break;
@@ -57,7 +63,8 @@ bool findmy_scene_main_on_event(void* context, SceneManagerEvent event) {
5763
return consumed;
5864
}
5965

60-
void findmy_scene_main_on_exit(void* context) {
61-
FindMy* app = context;
66+
void findmy_scene_main_on_exit(void *context)
67+
{
68+
FindMy *app = context;
6269
UNUSED(app);
6370
}

0 commit comments

Comments
 (0)