Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delay setting to Sub-GHz playlist when repeating #835

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Example file, it will not work, you need to add paths to your files!
delay: 60000
sub: /ext/subghz/Vehicles/Tesla/Tesla_charge_AM270.sub
sub: /ext/subghz/Vehicles/Tesla/Tesla_charge_AM650.sub
sub: /ext/subghz/Test1.sub
sub: /ext/subghz/Test2.sub
sub: /ext/subghz/Test2.sub
11 changes: 11 additions & 0 deletions applications/main/subghz/subghz_cli.c
Original file line number Diff line number Diff line change
@@ -586,6 +586,7 @@ void subghz_cli_command_tx_from_file(Cli* cli, FuriString* args, void* context)
furi_string_set(file_name, EXT_PATH("subghz/test.sub"));
uint32_t repeat = 10;
uint32_t device_ind = 0; // 0 - CC1101_INT, 1 - CC1101_EXT
uint32_t delay = 0; // Delay in milliseconds

Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
@@ -756,6 +757,11 @@ void subghz_cli_command_tx_from_file(Cli* cli, FuriString* args, void* context)
flipper_format_delete_key(fff_data_file, "Repeat");
}

// Load delay
if(!flipper_format_read_uint32(fff_data_file, "Delay", &delay, 1)) {
delay = 0; // Default to 0 if delay is not specified
}

if(is_init_protocol) {
check_file = true;
} else {
@@ -801,6 +807,11 @@ void subghz_cli_command_tx_from_file(Cli* cli, FuriString* args, void* context)
subghz_transmitter_deserialize(transmitter, fff_data_raw);
}

// Apply delay if specified
if(delay > 0 && repeat) {
furi_delay_ms(delay);
}

} while(!cli_cmd_interrupt_received(cli) &&
(repeat && !strcmp(furi_string_get_cstr(temp_str), "RAW")));