Skip to content

Commit

Permalink
subghz update hopping config text
Browse files Browse the repository at this point in the history
by Willy-JL
  • Loading branch information
xMasterX committed Jul 21, 2024
1 parent 3d46a62 commit 69c780f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
29 changes: 16 additions & 13 deletions applications/main/subghz/scenes/subghz_scene_receiver_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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]);
Expand Down
6 changes: 6 additions & 0 deletions applications/services/gui/modules/variable_item_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions applications/services/gui/modules/variable_item_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion targets/f7/api_symbols.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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*"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 69c780f

Please sign in to comment.