mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
change: add defines to disable load saved preset value and binary RAW
add: icon for BinRAW mode in Read screen
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#define SUBGHZ_LAST_SETTING_FIELD_HOPPING_ENABLE "Hopping"
|
||||
#define SUBGHZ_LAST_SETTING_FIELD_IGNORE_FILTER "IgnoreFilter"
|
||||
#define SUBGHZ_LAST_SETTING_FIELD_FILTER "Filter"
|
||||
#define SUBGHZ_LAST_SETTING_FIELD_SOUND "Sound"
|
||||
#define SUBGHZ_LAST_SETTING_FIELD_RSSI_THRESHOLD "RSSI"
|
||||
|
||||
SubGhzLastSettings* subghz_last_settings_alloc(void) {
|
||||
@@ -52,7 +51,6 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
bool temp_enable_hopping = false;
|
||||
uint32_t temp_ignore_filter = 0;
|
||||
uint32_t temp_filter = 0;
|
||||
uint32_t temp_sound = 0;
|
||||
float temp_rssi = 0;
|
||||
uint32_t temp_preset = 0;
|
||||
|
||||
@@ -106,8 +104,6 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
1);
|
||||
rssi_was_read = flipper_format_read_float(
|
||||
fff_data_file, SUBGHZ_LAST_SETTING_FIELD_RSSI_THRESHOLD, (float*)&temp_rssi, 1);
|
||||
flipper_format_read_uint32(
|
||||
fff_data_file, SUBGHZ_LAST_SETTING_FIELD_SOUND, (uint32_t*)&temp_sound, 1);
|
||||
ignore_filter_was_read = flipper_format_read_uint32(
|
||||
fff_data_file,
|
||||
SUBGHZ_LAST_SETTING_FIELD_IGNORE_FILTER,
|
||||
@@ -115,7 +111,6 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
1);
|
||||
filter_was_read = flipper_format_read_uint32(
|
||||
fff_data_file, SUBGHZ_LAST_SETTING_FIELD_FILTER, (uint32_t*)&temp_filter, 1);
|
||||
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Error open file %s", SUBGHZ_LAST_SETTINGS_PATH);
|
||||
}
|
||||
@@ -135,7 +130,6 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
instance->ignore_filter = 0x00;
|
||||
// See bin_raw_value in applications/main/subghz/scenes/subghz_scene_receiver_config.c
|
||||
instance->filter = SubGhzProtocolFlag_Decodable;
|
||||
instance->sound = 0;
|
||||
instance->rssi = SUBGHZ_RAW_THRESHOLD_MIN;
|
||||
} else {
|
||||
instance->frequency = temp_frequency;
|
||||
@@ -173,8 +167,17 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
instance->rssi = rssi_was_read ? temp_rssi : SUBGHZ_RAW_THRESHOLD_MIN;
|
||||
instance->enable_hopping = temp_enable_hopping;
|
||||
instance->ignore_filter = ignore_filter_was_read ? temp_ignore_filter : 0x00;
|
||||
#if SUBGHZ_LAST_SETTING_SAVE_BIN_RAW
|
||||
instance->filter = filter_was_read ? temp_filter : SubGhzProtocolFlag_Decodable;
|
||||
instance->sound = temp_sound;
|
||||
#else
|
||||
if(filter_was_read) {
|
||||
instance->filter = temp_filter != SubGhzProtocolFlag_Decodable ?
|
||||
SubGhzProtocolFlag_Decodable :
|
||||
temp_filter;
|
||||
} else {
|
||||
instance->filter = SubGhzProtocolFlag_Decodable;
|
||||
}
|
||||
#endif
|
||||
// Set globally in furi hal
|
||||
furi_hal_subghz_set_ext_power_amp(instance->external_module_power_amp);
|
||||
}
|
||||
@@ -187,6 +190,9 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
|
||||
bool subghz_last_settings_save(SubGhzLastSettings* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
#if SUBGHZ_LAST_SETTING_SAVE_BIN_RAW != true
|
||||
instance->filter = SubGhzProtocolFlag_Decodable;
|
||||
#endif
|
||||
bool saved = false;
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
@@ -261,10 +267,6 @@ bool subghz_last_settings_save(SubGhzLastSettings* instance) {
|
||||
file, SUBGHZ_LAST_SETTING_FIELD_RSSI_THRESHOLD, &instance->rssi, 1)) {
|
||||
break;
|
||||
}
|
||||
if(!flipper_format_insert_or_update_uint32(
|
||||
file, SUBGHZ_LAST_SETTING_FIELD_SOUND, &instance->sound, 1)) {
|
||||
break;
|
||||
}
|
||||
if(!flipper_format_insert_or_update_uint32(
|
||||
file, SUBGHZ_LAST_SETTING_FIELD_IGNORE_FILTER, &instance->ignore_filter, 1)) {
|
||||
break;
|
||||
@@ -306,7 +308,7 @@ void subghz_last_settings_log(SubGhzLastSettings* instance) {
|
||||
TAG,
|
||||
"Frequency: %03ld.%02ld, FeedbackLevel: %ld, FATrigger: %.2f, External: %s, ExtPower: %s, TimestampNames: %s, ExtPowerAmp: %s,\n"
|
||||
"Hopping: %s,\nPreset: %ld, RSSI: %.2f, "
|
||||
"Starline: %s, Cars: %s, Magellan: %s, BinRAW: %s, Sound: %ld",
|
||||
"Starline: %s, Cars: %s, Magellan: %s, BinRAW: %s",
|
||||
instance->frequency / 1000000 % 1000,
|
||||
instance->frequency / 10000 % 100,
|
||||
instance->frequency_analyzer_feedback_level,
|
||||
@@ -324,6 +326,5 @@ void subghz_last_settings_log(SubGhzLastSettings* instance) {
|
||||
instance->ignore_filter, SubGhzProtocolFlag_AutoAlarms),
|
||||
subghz_last_settings_log_filter_get_index(
|
||||
instance->ignore_filter, SubGhzProtocolFlag_Magelan),
|
||||
subghz_last_settings_log_filter_get_index(instance->filter, SubGhzProtocolFlag_BinRAW),
|
||||
instance->sound);
|
||||
subghz_last_settings_log_filter_get_index(instance->filter, SubGhzProtocolFlag_BinRAW));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user