Return frequency check

This commit is contained in:
MX 2023-03-04 00:24:56 +03:00
parent fe84e9521c
commit 056f2eb7d5
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
2 changed files with 12 additions and 0 deletions

View File

@ -53,6 +53,7 @@ typedef enum {
SubGhzLoadKeyStateUnknown,
SubGhzLoadKeyStateOK,
SubGhzLoadKeyStateParseErr,
SubGhzLoadKeyStateOnlyRx,
SubGhzLoadKeyStateProtocolDescriptionErr,
} SubGhzLoadKeyState;

View File

@ -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;