1
mirror of https://github.com/flipperdevices/flipperzero-firmware.git synced 2025-12-12 12:51:22 +04:00

cli: Buzzer command (#4006)

* Add args_read_float_and_trim function

* Add args_read_duration function

* Add notes_frequency_from_name function

* Add cli_sleep function and sleep CLI command

* Update CLI top command to use cli_sleep

* Add buzzer CLI command

* toolbox: make args_read_duration less convoluted

* notification: make notification_messages_notes_frequency_from_name less convoluted

* unit_tests: better float checking

* fix formatting and f18

---------

Co-authored-by: Anna Antonenko <portasynthinca3@gmail.com>
Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
Ivan Barsukov
2025-09-29 20:53:10 +03:00
committed by GitHub
parent f78a8328d1
commit 1e0f3a606f
15 changed files with 747 additions and 23 deletions

View File

@@ -15,3 +15,18 @@ void cli_print_usage(const char* cmd, const char* usage, const char* arg) {
printf("%s: illegal option -- %s\r\nusage: %s %s", cmd, arg, cmd, usage);
}
bool cli_sleep(PipeSide* side, uint32_t duration_in_ms) {
uint32_t passed_time = 0;
bool is_interrupted = false;
do {
uint32_t left_time = duration_in_ms - passed_time;
uint32_t check_interval = left_time >= 100 ? 100 : left_time;
furi_delay_ms(check_interval);
passed_time += check_interval;
is_interrupted = cli_is_pipe_broken_or_is_etx_next_char(side);
} while(!is_interrupted && passed_time < duration_in_ms);
return !is_interrupted;
}