From 69c780fddb45c93620e5c83afbfbd40611fd854e Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 22 Jul 2024 01:47:19 +0300 Subject: [PATCH] subghz update hopping config text by Willy-JL --- .../scenes/subghz_scene_receiver_config.c | 29 ++++++++++--------- .../services/gui/modules/variable_item_list.c | 6 ++++ .../services/gui/modules/variable_item_list.h | 7 +++++ targets/f7/api_symbols.csv | 3 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_receiver_config.c b/applications/main/subghz/scenes/subghz_scene_receiver_config.c index 8c329f9ded..f82a459761 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver_config.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver_config.c @@ -52,17 +52,17 @@ const float raw_threshold_rssi_value[RAW_THRESHOLD_RSSI_COUNT] = { #define HOPPING_MODE_COUNT 12 const char* const hopping_mode_text[HOPPING_MODE_COUNT] = { "OFF", - "-90.0", - "-85.0", - "-80.0", - "-75.0", - "-70.0", - "-65.0", - "-60.0", - "-55.0", - "-50.0", - "-45.0", - "-40.0", + "-90dBm", + "-85dBm", + "-80dBm", + "-75dBm", + "-70dBm", + "-65dBm", + "-60dBm", + "-55dBm", + "-50dBm", + "-45dBm", + "-40dBm", }; const float hopping_mode_value[HOPPING_MODE_COUNT] = { @@ -251,10 +251,13 @@ static void subghz_scene_receiver_config_set_hopping(VariableItem* item) { preset.data_size); variable_item_set_current_value_index( frequency_item, subghz_setting_get_frequency_default_index(setting)); + variable_item_set_item_label(item, "Hopping"); } else { variable_item_set_current_value_text(frequency_item, " -----"); variable_item_set_current_value_index( frequency_item, subghz_setting_get_frequency_default_index(setting)); + + variable_item_set_item_label(item, "Hopping RSSI"); } subghz->last_settings->enable_hopping = index != 0; subghz->last_settings->hopping_threshold = hopping_mode_value[index]; @@ -414,13 +417,13 @@ void subghz_scene_receiver_config_on_enter(void* context) { if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) != SubGhzCustomEventManagerSet) { // Hopping + value_index = subghz_scene_receiver_config_hopper_value_index(subghz); item = variable_item_list_add( subghz->variable_item_list, - "Hopping", + value_index ? "Hopping RSSI" : "Hopping", HOPPING_MODE_COUNT, subghz_scene_receiver_config_set_hopping, subghz); - value_index = subghz_scene_receiver_config_hopper_value_index(subghz); variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, hopping_mode_text[value_index]); diff --git a/applications/services/gui/modules/variable_item_list.c b/applications/services/gui/modules/variable_item_list.c index 3fe26b5693..d8fcc8652f 100644 --- a/applications/services/gui/modules/variable_item_list.c +++ b/applications/services/gui/modules/variable_item_list.c @@ -544,6 +544,12 @@ void variable_item_set_values_count(VariableItem* item, uint8_t values_count) { item->values_count = values_count; } +void variable_item_set_item_label(VariableItem* item, const char* label) { + furi_check(item); + furi_check(label); + item->label = label; +} + void variable_item_set_current_value_text(VariableItem* item, const char* current_value_text) { furi_check(item); furi_string_set(item->current_value_text, current_value_text); diff --git a/applications/services/gui/modules/variable_item_list.h b/applications/services/gui/modules/variable_item_list.h index aec2239f7e..a00b84f222 100644 --- a/applications/services/gui/modules/variable_item_list.h +++ b/applications/services/gui/modules/variable_item_list.h @@ -97,6 +97,13 @@ void variable_item_set_current_value_index(VariableItem* item, uint8_t current_v */ void variable_item_set_values_count(VariableItem* item, uint8_t values_count); +/** Set new label for item + * + * @param item VariableItem* instance + * @param label The new label text + */ +void variable_item_set_item_label(VariableItem* item, const char* label); + /** Set item current selected text * * @param item VariableItem* instance diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index 22eeac799e..6002ccbee6 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -773,8 +773,8 @@ Function,+,bt_keys_storage_set_default_path,void,Bt* Function,+,bt_keys_storage_set_file_path,void,"BtKeysStorage*, const char*" Function,+,bt_keys_storage_set_ram_params,void,"BtKeysStorage*, uint8_t*, uint16_t" Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*" -Function,-,bt_open_rpc_connection,void,Bt* Function,+,bt_keys_storage_update,_Bool,"BtKeysStorage*, uint8_t*, uint32_t" +Function,-,bt_open_rpc_connection,void,Bt* Function,+,bt_profile_restore_default,_Bool,Bt* Function,+,bt_profile_start,FuriHalBleProfileBase*,"Bt*, const FuriHalBleProfileTemplate*, FuriHalBleProfileParams" Function,+,bt_remote_rssi,_Bool,"Bt*, uint8_t*" @@ -3610,6 +3610,7 @@ Function,+,variable_item_list_set_enter_callback,void,"VariableItemList*, Variab Function,+,variable_item_list_set_selected_item,void,"VariableItemList*, uint8_t" Function,+,variable_item_set_current_value_index,void,"VariableItem*, uint8_t" Function,+,variable_item_set_current_value_text,void,"VariableItem*, const char*" +Function,+,variable_item_set_item_label,void,"VariableItem*, const char*" Function,+,variable_item_set_locked,void,"VariableItem*, _Bool, const char*" Function,+,variable_item_set_values_count,void,"VariableItem*, uint8_t" Function,+,varint_int32_length,size_t,int32_t