Fix Repeat in subghz remote

This commit is contained in:
MX 2023-04-04 17:38:33 +03:00
parent d4b32dc143
commit 3b7b48be4a
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83

View File

@ -385,17 +385,35 @@ bool subghz_remote_key_load(
FURI_LOG_E(TAG, "Could not read Protocol.");
break;
}
if(!furi_string_cmp_str(preset->protocol, "RAW")) {
subghz_protocol_raw_gen_fff_data(fff_data, path);
// repeat
if(!flipper_format_insert_or_update_uint32(fff_data, "Repeat", &preset->repeat, 1)) {
FURI_LOG_E(TAG, "Unable to insert or update Repeat");
break;
}
if(!flipper_format_rewind(fff_data)) {
FURI_LOG_E(TAG, "Rewind error");
return false;
}
} else {
stream_copy_full(
flipper_format_get_raw_stream(fff_file), flipper_format_get_raw_stream(fff_data));
// repeat
if(!flipper_format_insert_or_update_uint32(fff_data, "Repeat", &preset->repeat, 1)) {
FURI_LOG_E(TAG, "Unable to insert or update Repeat");
break;
}
if(!flipper_format_rewind(fff_data)) {
FURI_LOG_E(TAG, "Rewind error");
return false;
}
}
// repeat
if(!flipper_format_insert_or_update_uint32(fff_file, "Repeat", &preset->repeat, 1)) {
FURI_LOG_E(TAG, "Unable to insert or update Repeat");
break;
if(!flipper_format_rewind(fff_file)) {
FURI_LOG_E(TAG, "Rewind error");
return false;
}
preset->decoder = subghz_receiver_search_decoder_base_by_name(
@ -478,11 +496,11 @@ void subghz_remote_tx_stop(SubGHzRemote* app) {
protocol_registry_items, furi_string_get_cstr(app->txpreset->protocol));
//FURI_LOG_D(TAG, "Protocol-TYPE %d", proto->type);
// Remove repeat if it was present
flipper_format_delete_key(app->tx_fff_data, "Repeat");
if(proto && proto->type == SubGhzProtocolTypeDynamic) {
//FURI_LOG_D(TAG, "Protocol is dynamic. Saving key");
// Remove repeat if it was present
flipper_format_delete_key(app->tx_fff_data, "Repeat");
subghz_remote_save_protocol_to_file(app->tx_fff_data, app->tx_file_path);
keeloq_reset_mfname();