[FL-2669] SubGhz: add support for loading custom presets (#1398)
* SubGhz: load custom -preset * SubGhz: fix error prt=0 * SubGhz: load custom preset * SubGhz: code refactoring to support custom preset * SubGhz: add custom presert refactoring * SubGhz: fix alloc history alloc preset * SubGhz: fix error load file * SubGhz: fix start custom preset * SubGhz: fix delete custom preset * SubGhz: add description Custom_preset_data for CC1101 * SubGhz: debug logging and buffer size rounding Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
This commit is contained in:
@@ -75,8 +75,7 @@ static void subghz_scene_add_to_history_callback(
|
||||
string_t str_buff;
|
||||
string_init(str_buff);
|
||||
|
||||
if(subghz_history_add_to_history(
|
||||
subghz->txrx->history, decoder_base, subghz->txrx->frequency, subghz->txrx->preset)) {
|
||||
if(subghz_history_add_to_history(subghz->txrx->history, decoder_base, subghz->txrx->preset)) {
|
||||
string_reset(str_buff);
|
||||
|
||||
subghz->state_notifications = SubGhzNotificationStateRxDone;
|
||||
@@ -103,8 +102,8 @@ void subghz_scene_receiver_on_enter(void* context) {
|
||||
string_init(str_buff);
|
||||
|
||||
if(subghz->txrx->rx_key_state == SubGhzRxKeyStateIDLE) {
|
||||
subghz->txrx->frequency = subghz_setting_get_default_frequency(subghz->setting);
|
||||
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
|
||||
subghz_preset_init(
|
||||
subghz, "AM650", subghz_setting_get_default_frequency(subghz->setting), NULL, 0);
|
||||
subghz_history_reset(subghz->txrx->history);
|
||||
subghz->txrx->rx_key_state = SubGhzRxKeyStateStart;
|
||||
}
|
||||
@@ -135,8 +134,11 @@ void subghz_scene_receiver_on_enter(void* context) {
|
||||
};
|
||||
if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) ||
|
||||
(subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) {
|
||||
subghz_begin(subghz, subghz->txrx->preset);
|
||||
subghz_rx(subghz, subghz->txrx->frequency);
|
||||
subghz_begin(
|
||||
subghz,
|
||||
subghz_setting_get_preset_data_by_name(
|
||||
subghz->setting, string_get_cstr(subghz->txrx->preset->name)));
|
||||
subghz_rx(subghz, subghz->txrx->preset->frequency);
|
||||
}
|
||||
subghz_view_receiver_set_idx_menu(subghz->subghz_receiver, subghz->txrx->idx_menu_chosen);
|
||||
|
||||
@@ -164,8 +166,12 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
||||
} else {
|
||||
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
||||
subghz->txrx->frequency = subghz_setting_get_default_frequency(subghz->setting);
|
||||
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
|
||||
subghz_preset_init(
|
||||
subghz,
|
||||
"AM650",
|
||||
subghz_setting_get_default_frequency(subghz->setting),
|
||||
NULL,
|
||||
0);
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
subghz->scene_manager, SubGhzSceneStart);
|
||||
}
|
||||
|
Reference in New Issue
Block a user