mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 23:18:35 -07:00
Fix FileCompat, Small fixes
This commit is contained in:
@@ -29,7 +29,11 @@ bool findmy_state_load(FindMyState* out_state) {
|
|||||||
if(!flipper_format_read_uint32(file, "transmit_power", &tmp, 1)) break;
|
if(!flipper_format_read_uint32(file, "transmit_power", &tmp, 1)) break;
|
||||||
state.transmit_power = tmp;
|
state.transmit_power = tmp;
|
||||||
|
|
||||||
if(!flipper_format_read_bool(file, "show_mac", &state.show_mac, 1)) break;
|
if(!flipper_format_read_bool(file, "show_mac", &state.show_mac, 1)) {
|
||||||
|
// Support migrating from old config
|
||||||
|
state.show_mac = false;
|
||||||
|
flipper_format_rewind(file);
|
||||||
|
}
|
||||||
|
|
||||||
if(!flipper_format_read_uint32(file, "tag_type", &tmp, 1)) {
|
if(!flipper_format_read_uint32(file, "tag_type", &tmp, 1)) {
|
||||||
// Support migrating from old config
|
// Support migrating from old config
|
||||||
@@ -104,7 +108,6 @@ void findmy_state_apply(FindMyState* state) {
|
|||||||
furi_check(
|
furi_check(
|
||||||
furi_hal_bt_extra_beacon_set_data(state->data, findmy_state_data_size(state->tag_type)));
|
furi_hal_bt_extra_beacon_set_data(state->data, findmy_state_data_size(state->tag_type)));
|
||||||
|
|
||||||
|
|
||||||
if(state->beacon_active) {
|
if(state->beacon_active) {
|
||||||
furi_check(furi_hal_bt_extra_beacon_start());
|
furi_check(furi_hal_bt_extra_beacon_start());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ enum VarItemListIndex {
|
|||||||
VarItemListIndexAbout,
|
VarItemListIndexAbout,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void findmy_scene_config_broadcast_interval_changed(VariableItem* item) {
|
void findmy_scene_config_broadcast_interval_changed(VariableItem* item) {
|
||||||
FindMy* app = variable_item_get_context(item);
|
FindMy* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
@@ -33,7 +32,7 @@ void findmy_scene_config_show_mac(VariableItem* item) {
|
|||||||
FindMy* app = variable_item_get_context(item);
|
FindMy* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
findmy_toggle_show_mac(app, index);
|
findmy_toggle_show_mac(app, index);
|
||||||
if (app->state.show_mac == true) {
|
if(app->state.show_mac == true) {
|
||||||
variable_item_set_current_value_text(item, "Yes");
|
variable_item_set_current_value_text(item, "Yes");
|
||||||
} else {
|
} else {
|
||||||
variable_item_set_current_value_text(item, "No");
|
variable_item_set_current_value_text(item, "No");
|
||||||
@@ -75,11 +74,7 @@ void findmy_scene_config_on_enter(void* context) {
|
|||||||
|
|
||||||
item = variable_item_list_add(var_item_list, "Show MAC", 2, findmy_scene_config_show_mac, app);
|
item = variable_item_list_add(var_item_list, "Show MAC", 2, findmy_scene_config_show_mac, app);
|
||||||
variable_item_set_current_value_index(item, app->state.show_mac);
|
variable_item_set_current_value_index(item, app->state.show_mac);
|
||||||
if(app->state.show_mac == true)
|
variable_item_set_current_value_text(item, app->state.show_mac ? "Yes" : "No");
|
||||||
variable_item_set_current_value_text(item, "Yes");
|
|
||||||
else
|
|
||||||
variable_item_set_current_value_text(item, "No");
|
|
||||||
|
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list,
|
var_item_list,
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ static void findmy_main_draw_callback(Canvas* canvas, void* _model) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(model->show_mac == false) {
|
if(model->show_mac == false) {
|
||||||
canvas_set_font(canvas, FontPrimary);
|
canvas_set_font(canvas, FontPrimary);
|
||||||
canvas_draw_str(canvas, 4, 31, network_text);
|
canvas_draw_str(canvas, 4, 31, network_text);
|
||||||
@@ -132,10 +131,7 @@ FindMyMain* findmy_main_alloc(FindMy* app) {
|
|||||||
model->active = app->state.beacon_active;
|
model->active = app->state.beacon_active;
|
||||||
model->interval = app->state.broadcast_interval;
|
model->interval = app->state.broadcast_interval;
|
||||||
model->show_mac = app->state.show_mac;
|
model->show_mac = app->state.show_mac;
|
||||||
memcpy(
|
memcpy(model->mac, app->state.mac, sizeof(model->mac));
|
||||||
model->mac,
|
|
||||||
app->state.mac,
|
|
||||||
sizeof(model->mac));
|
|
||||||
model->type = app->state.tag_type;
|
model->type = app->state.tag_type;
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
@@ -184,7 +180,7 @@ void findmy_main_update_mac(FindMyMain* findmy_main, uint8_t* mac) {
|
|||||||
memcpy(model->mac, mac, sizeof(model->mac));
|
memcpy(model->mac, mac, sizeof(model->mac));
|
||||||
furi_hal_bt_reverse_mac_addr(model->mac);
|
furi_hal_bt_reverse_mac_addr(model->mac);
|
||||||
},
|
},
|
||||||
false);
|
true);
|
||||||
}
|
}
|
||||||
void findmy_main_update_interval(FindMyMain* findmy_main, uint8_t interval) {
|
void findmy_main_update_interval(FindMyMain* findmy_main, uint8_t interval) {
|
||||||
furi_assert(findmy_main);
|
furi_assert(findmy_main);
|
||||||
|
|||||||
Reference in New Issue
Block a user