SubGhz: refactoring

This commit is contained in:
gid9798
2023-05-09 18:24:25 +03:00
parent a2fbe7fab8
commit 8ae2cb1d32
8 changed files with 75 additions and 52 deletions

View File

@@ -57,15 +57,16 @@ void subghz_scene_save_name_on_enter(void* context) {
if(!subghz_path_is_file(subghz->file_path)) {
char file_name_buf[SUBGHZ_MAX_LEN_NAME] = {0};
if(furi_hal_subghz_get_timestamp_file_names()) {
if(subghz->txrx->decoder_result != 0x0) {
if(subghz->txrx->decoder_result != NULL) {
if(strlen(subghz->txrx->decoder_result->protocol->name) != 0) {
SubGhzProtocolDecoderBase* decoder_result = subghz_txrx_get_decoder(subghz->txrx);
if(decoder_result != 0x0) {
if(decoder_result != NULL) {
if(strlen(decoder_result->protocol->name) != 0) {
if(scene_manager_has_previous_scene(
subghz->scene_manager, SubGhzSceneSetType)) {
subghz_scene_save_name_get_timefilename(file_name, "S", true);
} else {
subghz_scene_save_name_get_timefilename(
file_name, subghz->txrx->decoder_result->protocol->name, false);
file_name, decoder_result->protocol->name, false);
}
} else {
@@ -155,8 +156,7 @@ bool subghz_scene_save_name_on_event(void* context, SceneManagerEvent event) {
} else {
subghz_save_protocol_to_file(
subghz,
subghz_history_get_raw_data(
subghz->history, subghz->idx_menu_chosen),
subghz_history_get_raw_data(subghz->history, subghz->idx_menu_chosen),
furi_string_get_cstr(subghz->file_path));
}
}