From 056f2eb7d5f9d70c95a637d99a87bb83e9aa6d0b Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sat, 4 Mar 2023 00:24:56 +0300 Subject: [PATCH] Return frequency check --- applications/main/subghz/helpers/subghz_types.h | 1 + applications/main/subghz/subghz_i.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/applications/main/subghz/helpers/subghz_types.h b/applications/main/subghz/helpers/subghz_types.h index 9f6648147..3c5982427 100644 --- a/applications/main/subghz/helpers/subghz_types.h +++ b/applications/main/subghz/helpers/subghz_types.h @@ -53,6 +53,7 @@ typedef enum { SubGhzLoadKeyStateUnknown, SubGhzLoadKeyStateOK, SubGhzLoadKeyStateParseErr, + SubGhzLoadKeyStateOnlyRx, SubGhzLoadKeyStateProtocolDescriptionErr, } SubGhzLoadKeyState; diff --git a/applications/main/subghz/subghz_i.c b/applications/main/subghz/subghz_i.c index 62010ed6b..579a16520 100644 --- a/applications/main/subghz/subghz_i.c +++ b/applications/main/subghz/subghz_i.c @@ -285,6 +285,11 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) { break; } + if(!furi_hal_subghz_is_tx_allowed(temp_data32)) { + FURI_LOG_E(TAG, "This frequency can only be used for RX"); + load_key_state = SubGhzLoadKeyStateOnlyRx; + break; + } subghz->txrx->preset->frequency = temp_data32; if(!flipper_format_read_string(fff_data_file, "Preset", temp_str)) { @@ -366,6 +371,12 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) { } return false; + case SubGhzLoadKeyStateOnlyRx: + if(show_dialog) { + subghz_dialog_message_show_only_rx(subghz); + } + return false; + case SubGhzLoadKeyStateOK: return true;