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

Buzzer cli command #4006

Draft
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

ivanbarsukov
Copy link
Contributor

What's new

  • Added buzzer cli command
  • Added function for parsing note frequency
  • Added function for parsing time and converting it to ms
  • Added function for parsing float argument (HELP needed. "%f" is not working for sscanf. Temporarily it reads int)

Verification

  • Open Flipper cli
  • Run buzzer freq 659 or buzzer note e5 for playing e5 for 100 ms (default value)
  • Run buzzer freq 659 5s or buzzer note e5 5s for playing e5 for 5 s
  • Run buzzer freq 659 0 or buzzer note e5 0 for playing e5 in background and then buzzer off to turn it off

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

@@ -97,3 +116,75 @@ bool args_read_hex_bytes(FuriString* args, uint8_t* bytes, size_t bytes_count) {

return result;
}

bool args_read_time(FuriString* args, uint32_t* value, const char* default_unit) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like time is not a right word, duration maybe? It will be nice to take a look into other standard libraries and pick common term for the thing.

* @param note_name The name of the note (e.g., "A4", cs5")
* @return The frequency of the note in Hz, or 0.0 if the note name is invalid
*/
extern float note_frequency(const char* note_name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function naming. See coding convention for details.

@@ -525,6 +658,7 @@ void cli_commands_init(Cli* cli) {

cli_add_command(cli, "vibro", CliCommandFlagDefault, cli_command_vibro, NULL);
cli_add_command(cli, "led", CliCommandFlagDefault, cli_command_led, NULL);
cli_add_command(cli, "buzzer", CliCommandFlagDefault, cli_command_buzzer, NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We kinda low on free flash memory, adding this feature directly into firmware looks kinda bad.
There is a chance that we will postpone this PR till @portasynthinca3 finish cli refactoring, so we can move non essential things into external apps.

@skotopes skotopes marked this pull request as draft December 23, 2024 03:45
@skotopes
Copy link
Member

Un-draft when ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants