Skip to content

Commit

Permalink
Add delay setting to Sub-GHz playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasen committed Nov 12, 2024
1 parent 41ae5d8 commit ad4e9ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
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
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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")));

Expand Down

0 comments on commit ad4e9ab

Please sign in to comment.