From d67d5da034aa1edbbc0943a1c9fcac92de9857c2 Mon Sep 17 00:00:00 2001 From: Der Skythe Date: Fri, 16 Sep 2022 18:38:08 +0400 Subject: [PATCH 1/5] fix: SubGhz Read reset setting ReadRAW after using scene ReadRAW --- .../subghz/scenes/subghz_scene_decode_raw.c | 2 +- .../subghz/scenes/subghz_scene_read_raw.c | 2 ++ .../subghz/scenes/subghz_scene_receiver.c | 20 +++++++---- .../scenes/subghz_scene_receiver_config.c | 36 +++++++------------ applications/main/subghz/subghz.c | 6 ++-- applications/main/subghz/subghz_history.c | 4 --- applications/main/subghz/subghz_i.h | 4 +-- .../main/subghz/subghz_last_setting.c | 36 +++++++++---------- .../main/subghz/subghz_last_setting.h | 2 +- applications/main/subghz/subghz_setting.c | 2 +- .../notification_settings_app.c | 19 ++++++++-- 11 files changed, 69 insertions(+), 64 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_decode_raw.c b/applications/main/subghz/scenes/subghz_scene_decode_raw.c index 59916441e..05b58c9b8 100644 --- a/applications/main/subghz/scenes/subghz_scene_decode_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_decode_raw.c @@ -257,7 +257,7 @@ bool subghz_scene_decode_raw_on_event(void* context, SceneManagerEvent event) { notification_message(subghz->notifications, &sequence_blink_cyan_10); break; case SubGhzNotificationStateRxDone: - notification_message(subghz->notifications, &subghs_sequence_rx); + notification_message(subghz->notifications, &subghz_sequence_rx); subghz->state_notifications = SubGhzNotificationStateRx; break; default: diff --git a/applications/main/subghz/scenes/subghz_scene_read_raw.c b/applications/main/subghz/scenes/subghz_scene_read_raw.c index bd62b0d37..d1918a270 100644 --- a/applications/main/subghz/scenes/subghz_scene_read_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_read_raw.c @@ -115,6 +115,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) { case SubGhzCustomEventViewReadRAWBack: // Check if return from config save values if(subghz->current_scene == SubGhzSceneReceiverConfig) { + FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); subghz_last_setting_save( subghz->last_setting, EXT_PATH("subghz/assets/last_used.txt")); } @@ -181,6 +182,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) { scene_manager_set_scene_state( subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSet); subghz->current_scene = SubGhzSceneReceiverConfig; + FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiverConfig); consumed = true; break; diff --git a/applications/main/subghz/scenes/subghz_scene_receiver.c b/applications/main/subghz/scenes/subghz_scene_receiver.c index 8a53a4a56..70ed4c9b4 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver.c @@ -1,7 +1,9 @@ #include "../subghz_i.h" #include "../views/receiver.h" -const NotificationSequence subghs_sequence_rx = { +#define TAG "SubGhzSceneReceiver" + +const NotificationSequence subghz_sequence_rx = { &message_green_255, &message_vibro_on, @@ -14,7 +16,7 @@ const NotificationSequence subghs_sequence_rx = { NULL, }; -const NotificationSequence subghs_sequence_rx_locked = { +const NotificationSequence subghz_sequence_rx_locked = { &message_green_255, &message_display_backlight_on, @@ -136,9 +138,11 @@ void subghz_scene_receiver_on_enter(void* context) { subghz->state_notifications = SubGhzNotificationStateRx; if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) { subghz_rx_end(subghz); - }; + } if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) || (subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) { + // Set values that can be reset after using DetectRAW Scene + subghz_last_setting_set_receiver_values(subghz->last_setting, subghz->txrx->receiver); subghz_begin( subghz, subghz_setting_get_preset_data_by_name( @@ -158,6 +162,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) { case SubGhzCustomEventViewReceiverBack: // Check if return from config save values if(subghz->current_scene == SubGhzSceneReceiverConfig) { + FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); subghz_last_setting_save( subghz->last_setting, EXT_PATH("subghz/assets/last_used.txt")); } @@ -166,7 +171,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) { if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) { subghz_rx_end(subghz); subghz_sleep(subghz); - }; + } subghz->txrx->hopper_state = SubGhzHopperStateOFF; subghz->txrx->idx_menu_chosen = 0; subghz_receiver_set_rx_callback(subghz->txrx->receiver, NULL, subghz); @@ -200,7 +205,10 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) { subghz->state_notifications = SubGhzNotificationStateIDLE; subghz->txrx->idx_menu_chosen = subghz_view_receiver_get_idx_menu(subghz->subghz_receiver); + scene_manager_set_scene_state( + subghz->scene_manager, SubGhzViewIdReceiver, SubGhzCustomEventManagerSet); subghz->current_scene = SubGhzSceneReceiverConfig; + FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiverConfig); consumed = true; break; @@ -226,9 +234,9 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) { break; case SubGhzNotificationStateRxDone: if(subghz->lock != SubGhzLockOn) { - notification_message(subghz->notifications, &subghs_sequence_rx); + notification_message(subghz->notifications, &subghz_sequence_rx); } else { - notification_message(subghz->notifications, &subghs_sequence_rx_locked); + notification_message(subghz->notifications, &subghz_sequence_rx_locked); } subghz->state_notifications = SubGhzNotificationStateRx; break; diff --git a/applications/main/subghz/scenes/subghz_scene_receiver_config.c b/applications/main/subghz/scenes/subghz_scene_receiver_config.c index 3ef9535e1..196b39772 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver_config.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver_config.c @@ -186,8 +186,7 @@ static void subghz_scene_receiver_config_set_detect_raw(VariableItem* item) { variable_item_set_current_value_text(item, detect_raw_text[index]); subghz_receiver_set_filter(subghz->txrx->receiver, detect_raw_value[index]); - - //subghz->last_setting->detect_raw = detect_raw_value[index]; + subghz->last_setting->detect_raw = detect_raw_value[index]; subghz_protocol_decoder_raw_set_auto_mode( subghz_receiver_search_decoder_base_by_name( @@ -253,8 +252,6 @@ void subghz_scene_receiver_config_on_enter(void* context) { subghz); value_index = subghz_scene_receiver_config_next_frequency(subghz->txrx->preset->frequency, subghz); - scene_manager_set_scene_state( - subghz->scene_manager, SubGhzSceneReceiverConfig, (uint32_t)item); variable_item_set_current_value_index(item, value_index); char text_buf[10] = {0}; snprintf( @@ -265,20 +262,6 @@ void subghz_scene_receiver_config_on_enter(void* context) { (subghz_setting_get_frequency(subghz->setting, value_index) % 1000000) / 10000); variable_item_set_current_value_text(item, text_buf); - if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) != - SubGhzCustomEventManagerSet) { - item = variable_item_list_add( - subghz->variable_item_list, - "Hopping:", - HOPPING_COUNT, - subghz_scene_receiver_config_set_hopping_running, - subghz); - value_index = subghz_scene_receiver_config_hopper_value_index( - subghz->txrx->hopper_state, hopping_value, HOPPING_COUNT, subghz); - variable_item_set_current_value_index(item, value_index); - variable_item_set_current_value_text(item, hopping_text[value_index]); - } - item = variable_item_list_add( subghz->variable_item_list, "Modulation:", @@ -293,6 +276,17 @@ void subghz_scene_receiver_config_on_enter(void* context) { if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) != SubGhzCustomEventManagerSet) { + item = variable_item_list_add( + subghz->variable_item_list, + "Hopping:", + HOPPING_COUNT, + subghz_scene_receiver_config_set_hopping_running, + subghz); + value_index = subghz_scene_receiver_config_hopper_value_index( + subghz->txrx->hopper_state, hopping_value, HOPPING_COUNT, subghz); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, hopping_text[value_index]); + item = variable_item_list_add( subghz->variable_item_list, "Detect Raw:", @@ -305,10 +299,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { DETECT_RAW_COUNT); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, detect_raw_text[value_index]); - } - if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) != - SubGhzCustomEventManagerSet) { item = variable_item_list_add( subghz->variable_item_list, "RSSI for Raw:", @@ -322,10 +313,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { RSSI_THRESHOLD_COUNT); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, rssi_threshold_text[value_index]); - } - if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) != - SubGhzCustomEventManagerSet) { variable_item_list_add(subghz->variable_item_list, "Lock Keyboard", 1, NULL, NULL); variable_item_list_set_enter_callback( subghz->variable_item_list, diff --git a/applications/main/subghz/subghz.c b/applications/main/subghz/subghz.c index d709eebd1..2aa29cc84 100644 --- a/applications/main/subghz/subghz.c +++ b/applications/main/subghz/subghz.c @@ -1,9 +1,9 @@ /* Abandon hope, all ye who enter here. */ -#include "m-string.h" -#include "subghz/types.h" -#include "subghz_i.h" +#include +#include #include +#include "subghz_i.h" bool subghz_custom_event_callback(void* context, uint32_t event) { furi_assert(context); diff --git a/applications/main/subghz/subghz_history.c b/applications/main/subghz/subghz_history.c index bf6571f80..b806b9568 100644 --- a/applications/main/subghz/subghz_history.c +++ b/applications/main/subghz/subghz_history.c @@ -1,9 +1,5 @@ #include "subghz_history.h" #include -#include - -#include -#include #define SUBGHZ_HISTORY_MAX 65 #define TAG "SubGhzHistory" diff --git a/applications/main/subghz/subghz_i.h b/applications/main/subghz/subghz_i.h index 3c72a44bc..16c3838c5 100644 --- a/applications/main/subghz/subghz_i.h +++ b/applications/main/subghz/subghz_i.h @@ -142,5 +142,5 @@ bool subghz_path_is_file(string_t path); uint32_t subghz_random_serial(void); void subghz_hopper_update(SubGhz* subghz); -extern const NotificationSequence subghs_sequence_rx; -extern const NotificationSequence subghs_sequence_rx_locked; +extern const NotificationSequence subghz_sequence_rx; +extern const NotificationSequence subghz_sequence_rx_locked; diff --git a/applications/main/subghz/subghz_last_setting.c b/applications/main/subghz/subghz_last_setting.c index 739d7ab0d..846d3d4fe 100644 --- a/applications/main/subghz/subghz_last_setting.c +++ b/applications/main/subghz/subghz_last_setting.c @@ -1,12 +1,11 @@ #include "subghz_setting.h" #include "subghz_i.h" - #include "subghz_last_setting.h" #include #include -#include "furi_hal_subghz.h" -#include "furi_hal_subghz_configs.h" +#include +#include #include #define TAG "SubGhzLastSetting" @@ -41,7 +40,7 @@ void subghz_last_setting_load(SubGhzLastSetting* instance, const char* file_path string_init(temp_preset); uint32_t temp_frequency = 0; // Default 433920000 uint32_t temp_hopping = 0; // Default 0 - //uint32_t temp_detect_raw = 0; Default 2 + uint32_t temp_detect_raw = 0; // Default 2 int32_t temp_rssi_threshold = 0; // Default -72 if(FSE_OK == storage_sd_status(storage) && file_path && @@ -49,31 +48,31 @@ void subghz_last_setting_load(SubGhzLastSetting* instance, const char* file_path flipper_format_read_string(fff_data_file, "Preset", temp_preset); flipper_format_read_uint32(fff_data_file, "Frequency", (uint32_t*)&temp_frequency, 1); flipper_format_read_uint32(fff_data_file, "Hopping", (uint32_t*)&temp_hopping, 1); - //flipper_format_read_uint32(fff_data_file, "DetectRaw", (uint32_t*)&temp_detect_raw, 1); + flipper_format_read_uint32(fff_data_file, "DetectRaw", (uint32_t*)&temp_detect_raw, 1); flipper_format_read_int32(fff_data_file, "Rssi", (int32_t*)&temp_rssi_threshold, 1); } else { FURI_LOG_E(TAG, "Error open file %s", file_path); } if(string_empty_p(temp_preset)) { - //FURI_LOG_I(TAG, "Last used preset not found"); + FURI_LOG_D(TAG, "Last used preset not found"); string_set(instance->preset_name, SUBGHZ_LAST_SETTING_DEFAULT_PRESET); } else { string_set(instance->preset_name, temp_preset); } if(temp_frequency == 0 || !furi_hal_subghz_is_tx_allowed(temp_frequency)) { - //FURI_LOG_I(TAG, "Last used frequency not found or can't be used!"); + FURI_LOG_D(TAG, "Last used frequency not found or can't be used!"); instance->frequency = SUBGHZ_LAST_SETTING_DEFAULT_FREQUENCY; } else { instance->frequency = temp_frequency; } - /*if(temp_detect_raw == 0) { + if(temp_detect_raw == 0) { instance->detect_raw = SubGhzProtocolFlag_Decodable; } else { instance->detect_raw = temp_detect_raw; - }*/ + } if(temp_rssi_threshold == 0) { instance->rssi_threshold = -72; @@ -105,15 +104,15 @@ bool subghz_last_setting_save(SubGhzLastSetting* instance, const char* file_path file, SUBGHZ_LAST_SETTING_FILE_TYPE, SUBGHZ_LAST_SETTING_FILE_VERSION)) break; - //FURI_LOG_D(TAG, "Preset %s", string_get_cstr(instance->preset_name)); + FURI_LOG_D(TAG, "Preset %s", string_get_cstr(instance->preset_name)); if(!flipper_format_insert_or_update_string_cstr( file, "Preset", string_get_cstr(instance->preset_name))) break; if(!flipper_format_insert_or_update_uint32(file, "Frequency", &instance->frequency, 1)) break; if(!flipper_format_insert_or_update_uint32(file, "Hopping", &instance->hopping, 1)) break; - //if(!flipper_format_insert_or_update_uint32(file, "DetectRaw", &instance->detect_raw, 1)) - // break; + if(!flipper_format_insert_or_update_uint32(file, "DetectRaw", &instance->detect_raw, 1)) + break; if(!flipper_format_insert_or_update_int32(file, "Rssi", &instance->rssi_threshold, 1)) break; @@ -131,14 +130,11 @@ bool subghz_last_setting_save(SubGhzLastSetting* instance, const char* file_path } void subghz_last_setting_set_receiver_values(SubGhzLastSetting* instance, SubGhzReceiver* receiver) { - subghz_receiver_set_filter(receiver, SubGhzProtocolFlag_Decodable); - /*subghz_receiver_set_filter(receiver, instance->detect_raw); + SubGhzProtocolDecoderBase* protocolDecoderBase = + subghz_receiver_search_decoder_base_by_name(receiver, SUBGHZ_PROTOCOL_RAW_NAME); + subghz_receiver_set_filter(receiver, instance->detect_raw); subghz_protocol_decoder_raw_set_auto_mode( - subghz_receiver_search_decoder_base_by_name(receiver, SUBGHZ_PROTOCOL_RAW_NAME), - (instance->detect_raw != SubGhzProtocolFlag_Decodable));*/ - - subghz_protocol_decoder_raw_set_rssi_threshold( - subghz_receiver_search_decoder_base_by_name(receiver, SUBGHZ_PROTOCOL_RAW_NAME), - instance->rssi_threshold); + protocolDecoderBase, (instance->detect_raw != SubGhzProtocolFlag_Decodable)); + subghz_protocol_decoder_raw_set_rssi_threshold(protocolDecoderBase, instance->rssi_threshold); } \ No newline at end of file diff --git a/applications/main/subghz/subghz_last_setting.h b/applications/main/subghz/subghz_last_setting.h index f0f56d09a..2c20944be 100644 --- a/applications/main/subghz/subghz_last_setting.h +++ b/applications/main/subghz/subghz_last_setting.h @@ -9,7 +9,7 @@ typedef struct { string_t preset_name; uint32_t frequency; uint32_t hopping; - //uint32_t detect_raw; + uint32_t detect_raw; int32_t rssi_threshold; } SubGhzLastSetting; diff --git a/applications/main/subghz/subghz_setting.c b/applications/main/subghz/subghz_setting.c index 13a8f0b95..b065f4ab3 100644 --- a/applications/main/subghz/subghz_setting.c +++ b/applications/main/subghz/subghz_setting.c @@ -3,7 +3,7 @@ #include #include -#include "furi_hal_subghz_configs.h" +#include #define TAG "SubGhzSetting" diff --git a/applications/settings/notification_settings/notification_settings_app.c b/applications/settings/notification_settings/notification_settings_app.c index 2c53fc230..bfda689ea 100644 --- a/applications/settings/notification_settings/notification_settings_app.c +++ b/applications/settings/notification_settings/notification_settings_app.c @@ -46,7 +46,7 @@ const char* const volume_text[VOLUME_COUNT] = { }; const float volume_value[VOLUME_COUNT] = {0.0f, 0.25f, 0.5f, 0.75f, 1.0f}; -#define DELAY_COUNT 8 +#define DELAY_COUNT 11 const char* const delay_text[DELAY_COUNT] = { "1s", "5s", @@ -56,8 +56,23 @@ const char* const delay_text[DELAY_COUNT] = { "60s", "90s", "120s", + "5min", + "10min", + "30min", +}; +const uint32_t delay_value[DELAY_COUNT] = { + 1000, + 5000, + 10000, + 15000, + 30000, + 60000, + 90000, + 120000, + 300000, + 600000, + 1800000 }; -const uint32_t delay_value[DELAY_COUNT] = {1000, 5000, 10000, 15000, 30000, 60000, 90000, 120000}; #define VIBRO_COUNT 2 const char* const vibro_text[VIBRO_COUNT] = { From d97a3ef1616877d84833e7e2582fd81bec96b095 Mon Sep 17 00:00:00 2001 From: Der Skythe Date: Fri, 16 Sep 2022 21:35:26 +0400 Subject: [PATCH 2/5] fix: change SUBGHZ_HISTORY_MAX to 50 according off-firm --- .../subghz/scenes/subghz_scene_show_error.c | 4 ++-- applications/main/subghz/subghz_history.c | 22 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_show_error.c b/applications/main/subghz/scenes/subghz_scene_show_error.c index 5632a859e..7b0350bf7 100644 --- a/applications/main/subghz/scenes/subghz_scene_show_error.c +++ b/applications/main/subghz/scenes/subghz_scene_show_error.c @@ -1,7 +1,7 @@ #include "../subghz_i.h" #include "../helpers/subghz_custom_event.h" -static const NotificationSequence subghs_sequence_sd_error = { +static const NotificationSequence subghz_sequence_sd_error = { &message_red_255, &message_green_255, &message_do_not_reset, @@ -39,7 +39,7 @@ void subghz_scene_show_error_on_enter(void* context) { widget_add_button_element( subghz->widget, GuiButtonTypeRight, "OK", subghz_scene_show_error_callback, subghz); } else { - notification_message(subghz->notifications, &subghs_sequence_sd_error); + notification_message(subghz->notifications, &subghz_sequence_sd_error); } widget_add_button_element( diff --git a/applications/main/subghz/subghz_history.c b/applications/main/subghz/subghz_history.c index b806b9568..427ee624c 100644 --- a/applications/main/subghz/subghz_history.c +++ b/applications/main/subghz/subghz_history.c @@ -1,7 +1,7 @@ #include "subghz_history.h" #include -#define SUBGHZ_HISTORY_MAX 65 +#define SUBGHZ_HISTORY_MAX 50 #define TAG "SubGhzHistory" typedef struct { @@ -37,15 +37,9 @@ SubGhzHistory* subghz_history_alloc(void) { void subghz_history_free(SubGhzHistory* instance) { furi_assert(instance); - string_clear(instance->tmp_string); - for - M_EACH(item, instance->history->data, SubGhzHistoryItemArray_t) { - string_clear(item->item_str); - string_clear(item->preset->name); - free(item->preset); - flipper_format_free(item->flipper_string); - item->type = 0; - } + + // Call method instead of code duplicate + subghz_history_reset(instance); SubGhzHistoryItemArray_clear(instance->history->data); free(instance->history); free(instance); @@ -139,16 +133,22 @@ bool subghz_history_add_to_history( furi_assert(instance); furi_assert(context); - if(instance->last_index_write >= SUBGHZ_HISTORY_MAX) return false; + if(instance->last_index_write >= SUBGHZ_HISTORY_MAX) { + FURI_LOG_W(TAG, "Out of history slots!"); + return false; + } SubGhzProtocolDecoderBase* decoder_base = context; if((instance->code_last_hash_data == subghz_protocol_decoder_base_get_hash_data(decoder_base)) && ((furi_get_tick() - instance->last_update_timestamp) < 500)) { + FURI_LOG_W(TAG, "Too short period for add"); instance->last_update_timestamp = furi_get_tick(); return false; } + FURI_LOG_I(TAG, "Add to history. Total: %d", instance->last_index_write + 1); + instance->code_last_hash_data = subghz_protocol_decoder_base_get_hash_data(decoder_base); instance->last_update_timestamp = furi_get_tick(); From d2bb1ef4d3878e38318e8221080555f59fdba558 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 16 Sep 2022 21:30:53 +0300 Subject: [PATCH 3/5] fix receiver filter set-up --- applications/main/subghz/scenes/subghz_scene_receiver.c | 7 ++++++- applications/main/subghz/subghz.c | 2 +- applications/main/subghz/subghz_history.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_receiver.c b/applications/main/subghz/scenes/subghz_scene_receiver.c index 70ed4c9b4..eedec9ac4 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver.c @@ -100,6 +100,8 @@ static void subghz_scene_add_to_history_callback( void subghz_scene_receiver_on_enter(void* context) { SubGhz* subghz = context; + subghz_last_setting_set_receiver_values(subghz->last_setting, subghz->txrx->receiver); + string_t str_buff; string_init(str_buff); @@ -248,5 +250,8 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) { } void subghz_scene_receiver_on_exit(void* context) { - UNUSED(context); + SubGhz* subghz = context; + + //filter restoration + subghz_receiver_set_filter(subghz->txrx->receiver, SubGhzProtocolFlag_Decodable); } diff --git a/applications/main/subghz/subghz.c b/applications/main/subghz/subghz.c index 2aa29cc84..84c775c3a 100644 --- a/applications/main/subghz/subghz.c +++ b/applications/main/subghz/subghz.c @@ -207,7 +207,7 @@ SubGhz* subghz_alloc() { subghz->txrx->receiver = subghz_receiver_alloc_init(subghz->txrx->environment); // Setup values - subghz_last_setting_set_receiver_values(subghz->last_setting, subghz->txrx->receiver); + subghz_receiver_set_filter(subghz->txrx->receiver, SubGhzProtocolFlag_Decodable); subghz_worker_set_overrun_callback( subghz->txrx->worker, (SubGhzWorkerOverrunCallback)subghz_receiver_reset); diff --git a/applications/main/subghz/subghz_history.c b/applications/main/subghz/subghz_history.c index 427ee624c..efa63689f 100644 --- a/applications/main/subghz/subghz_history.c +++ b/applications/main/subghz/subghz_history.c @@ -1,7 +1,7 @@ #include "subghz_history.h" #include -#define SUBGHZ_HISTORY_MAX 50 +#define SUBGHZ_HISTORY_MAX 65 #define TAG "SubGhzHistory" typedef struct { From 66487abaeee97f97e05a62e771a6bee07eb87678 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 16 Sep 2022 21:37:01 +0300 Subject: [PATCH 4/5] disable some logs --- applications/main/subghz/scenes/subghz_scene_decode_raw.c | 4 ++-- applications/main/subghz/scenes/subghz_scene_read_raw.c | 4 ++-- applications/main/subghz/scenes/subghz_scene_receiver.c | 4 ++-- applications/main/subghz/subghz_history.c | 4 ++-- applications/main/subghz/subghz_last_setting.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_decode_raw.c b/applications/main/subghz/scenes/subghz_scene_decode_raw.c index 05b58c9b8..d8c087182 100644 --- a/applications/main/subghz/scenes/subghz_scene_decode_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_decode_raw.c @@ -112,7 +112,7 @@ bool subghz_scene_decode_raw_start(SubGhz* subghz) { } while(false); if(success) { - FURI_LOG_I(TAG, "Listening at \033[0;33m%s\033[0m.", string_get_cstr(file_name)); + //FURI_LOG_I(TAG, "Listening at \033[0;33m%s\033[0m.", string_get_cstr(file_name)); file_worker_encoder = subghz_file_encoder_worker_alloc(); if(subghz_file_encoder_worker_start(file_worker_encoder, string_get_cstr(file_name))) { @@ -237,7 +237,7 @@ bool subghz_scene_decode_raw_on_event(void* context, SceneManagerEvent event) { consumed = true; break; case SubGhzCustomEventViewReceiverConfig: - FURI_LOG_I(TAG, "No config options"); + FURI_LOG_W(TAG, "No config options"); consumed = true; break; case SubGhzCustomEventViewReceiverOffDisplay: diff --git a/applications/main/subghz/scenes/subghz_scene_read_raw.c b/applications/main/subghz/scenes/subghz_scene_read_raw.c index d1918a270..86c9d88e5 100644 --- a/applications/main/subghz/scenes/subghz_scene_read_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_read_raw.c @@ -115,7 +115,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) { case SubGhzCustomEventViewReadRAWBack: // Check if return from config save values if(subghz->current_scene == SubGhzSceneReceiverConfig) { - FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); + //FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); subghz_last_setting_save( subghz->last_setting, EXT_PATH("subghz/assets/last_used.txt")); } @@ -182,7 +182,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) { scene_manager_set_scene_state( subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSet); subghz->current_scene = SubGhzSceneReceiverConfig; - FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); + //FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiverConfig); consumed = true; break; diff --git a/applications/main/subghz/scenes/subghz_scene_receiver.c b/applications/main/subghz/scenes/subghz_scene_receiver.c index eedec9ac4..2d0fcd861 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver.c @@ -164,7 +164,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) { case SubGhzCustomEventViewReceiverBack: // Check if return from config save values if(subghz->current_scene == SubGhzSceneReceiverConfig) { - FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); + //FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); subghz_last_setting_save( subghz->last_setting, EXT_PATH("subghz/assets/last_used.txt")); } @@ -210,7 +210,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) { scene_manager_set_scene_state( subghz->scene_manager, SubGhzViewIdReceiver, SubGhzCustomEventManagerSet); subghz->current_scene = SubGhzSceneReceiverConfig; - FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); + //FURI_LOG_I(TAG, "Raw value: %d", subghz->last_setting->detect_raw); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiverConfig); consumed = true; break; diff --git a/applications/main/subghz/subghz_history.c b/applications/main/subghz/subghz_history.c index efa63689f..a4906eb73 100644 --- a/applications/main/subghz/subghz_history.c +++ b/applications/main/subghz/subghz_history.c @@ -142,12 +142,12 @@ bool subghz_history_add_to_history( if((instance->code_last_hash_data == subghz_protocol_decoder_base_get_hash_data(decoder_base)) && ((furi_get_tick() - instance->last_update_timestamp) < 500)) { - FURI_LOG_W(TAG, "Too short period for add"); + //FURI_LOG_W(TAG, "Too short period for add"); instance->last_update_timestamp = furi_get_tick(); return false; } - FURI_LOG_I(TAG, "Add to history. Total: %d", instance->last_index_write + 1); + //FURI_LOG_I(TAG, "Add to history. Total: %d", instance->last_index_write + 1); instance->code_last_hash_data = subghz_protocol_decoder_base_get_hash_data(decoder_base); instance->last_update_timestamp = furi_get_tick(); diff --git a/applications/main/subghz/subghz_last_setting.c b/applications/main/subghz/subghz_last_setting.c index 846d3d4fe..82ddb26d8 100644 --- a/applications/main/subghz/subghz_last_setting.c +++ b/applications/main/subghz/subghz_last_setting.c @@ -104,7 +104,7 @@ bool subghz_last_setting_save(SubGhzLastSetting* instance, const char* file_path file, SUBGHZ_LAST_SETTING_FILE_TYPE, SUBGHZ_LAST_SETTING_FILE_VERSION)) break; - FURI_LOG_D(TAG, "Preset %s", string_get_cstr(instance->preset_name)); + //FURI_LOG_D(TAG, "Preset %s", string_get_cstr(instance->preset_name)); if(!flipper_format_insert_or_update_string_cstr( file, "Preset", string_get_cstr(instance->preset_name))) break; From ef5d0aa483eadce487a3f17c5c68f192d4a1367d Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 16 Sep 2022 21:48:03 +0300 Subject: [PATCH 5/5] fix null pointer dereference --- applications/main/subghz/scenes/subghz_scene_receiver_config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/applications/main/subghz/scenes/subghz_scene_receiver_config.c b/applications/main/subghz/scenes/subghz_scene_receiver_config.c index 196b39772..5e064e2f8 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver_config.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver_config.c @@ -252,6 +252,8 @@ void subghz_scene_receiver_config_on_enter(void* context) { subghz); value_index = subghz_scene_receiver_config_next_frequency(subghz->txrx->preset->frequency, subghz); + scene_manager_set_scene_state( + subghz->scene_manager, SubGhzSceneReceiverConfig, (uint32_t)item); variable_item_set_current_value_index(item, value_index); char text_buf[10] = {0}; snprintf(