mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Fix slow redundant reads for SubGhz files
This commit is contained in:
@@ -139,16 +139,14 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
||||
}
|
||||
}
|
||||
|
||||
//Load latitute and longitude if present
|
||||
if(!flipper_format_read_float(fff_data_file, "Latitute", (float*)&temp_lat, 1)) {
|
||||
FURI_LOG_E(TAG, "Missing Latitude (optional)");
|
||||
//Load latitute and longitude if present, strict mode to avoid reading the whole file twice
|
||||
flipper_format_set_strict_mode(fff_data_file, true);
|
||||
if(!flipper_format_read_float(fff_data_file, "Latitute", (float*)&temp_lat, 1) ||
|
||||
!flipper_format_read_float(fff_data_file, "Longitude", (float*)&temp_lon, 1)) {
|
||||
FURI_LOG_W(TAG, "Missing Latitude and Longitude (optional)");
|
||||
flipper_format_rewind(fff_data_file);
|
||||
}
|
||||
flipper_format_rewind(fff_data_file);
|
||||
|
||||
if(!flipper_format_read_float(fff_data_file, "Longitude", (float*)&temp_lon, 1)) {
|
||||
FURI_LOG_E(TAG, "Missing Longitude (optional)");
|
||||
}
|
||||
flipper_format_rewind(fff_data_file);
|
||||
flipper_format_set_strict_mode(fff_data_file, false);
|
||||
|
||||
size_t preset_index =
|
||||
subghz_setting_get_inx_preset_by_name(setting, furi_string_get_cstr(temp_str));
|
||||
|
||||
Reference in New Issue
Block a user