Fix FileCompat, Small fixes

This commit is contained in:
Matthew
2024-03-28 17:45:14 -04:00
parent a6b84847ac
commit 9f20389fc6
3 changed files with 9 additions and 15 deletions

View File

@@ -29,7 +29,11 @@ bool findmy_state_load(FindMyState* out_state) {
if(!flipper_format_read_uint32(file, "transmit_power", &tmp, 1)) break;
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)) {
// Support migrating from old config
@@ -104,7 +108,6 @@ void findmy_state_apply(FindMyState* state) {
furi_check(
furi_hal_bt_extra_beacon_set_data(state->data, findmy_state_data_size(state->tag_type)));
if(state->beacon_active) {
furi_check(furi_hal_bt_extra_beacon_start());
}

View File

@@ -8,7 +8,6 @@ enum VarItemListIndex {
VarItemListIndexAbout,
};
void findmy_scene_config_broadcast_interval_changed(VariableItem* item) {
FindMy* app = variable_item_get_context(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);
uint8_t index = variable_item_get_current_value_index(item);
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");
} else {
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);
variable_item_set_current_value_index(item, app->state.show_mac);
if(app->state.show_mac == true)
variable_item_set_current_value_text(item, "Yes");
else
variable_item_set_current_value_text(item, "No");
variable_item_set_current_value_text(item, app->state.show_mac ? "Yes" : "No");
item = variable_item_list_add(
var_item_list,

View File

@@ -38,7 +38,6 @@ static void findmy_main_draw_callback(Canvas* canvas, void* _model) {
break;
}
if(model->show_mac == false) {
canvas_set_font(canvas, FontPrimary);
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->interval = app->state.broadcast_interval;
model->show_mac = app->state.show_mac;
memcpy(
model->mac,
app->state.mac,
sizeof(model->mac));
memcpy(model->mac, app->state.mac, sizeof(model->mac));
model->type = app->state.tag_type;
},
false);
@@ -184,7 +180,7 @@ void findmy_main_update_mac(FindMyMain* findmy_main, uint8_t* mac) {
memcpy(model->mac, mac, sizeof(model->mac));
furi_hal_bt_reverse_mac_addr(model->mac);
},
false);
true);
}
void findmy_main_update_interval(FindMyMain* findmy_main, uint8_t interval) {
furi_assert(findmy_main);