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

tune_control: added define for tune strength #8939

Merged
merged 1 commit into from
Feb 22, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions msg/tune_control.msg
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ uint16 frequency # in Hz
uint32 duration # in us
uint32 silence # in us
uint8 strength # value between 0-100 if supported by backend

uint8 STRENGTH_NORMAL = 40
2 changes: 2 additions & 0 deletions src/modules/commander/commander_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ void buzzer_deinit()
void set_tune_override(int tune)
{
tune_control.tune_id = tune;
tune_control.strength = tune_control_s::STRENGTH_NORMAL;
tune_control.tune_override = 1;
tune_control.timestamp = hrt_absolute_time();
orb_publish(ORB_ID(tune_control), tune_control_pub, &tune_control);
Expand All @@ -154,6 +155,7 @@ void set_tune(int tune)
/* allow interrupting current non-repeating tune by the same tune */
if (tune != tune_current || new_tune_duration != 0) {
tune_control.tune_id = tune;
tune_control.strength = tune_control_s::STRENGTH_NORMAL;
tune_control.tune_override = 0;
tune_control.timestamp = hrt_absolute_time();
orb_publish(ORB_ID(tune_control), tune_control_pub, &tune_control);
Expand Down
4 changes: 2 additions & 2 deletions src/systemcmds/tune_control/tune_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ tune_control_main(int argc, char *argv[])
unsigned int value;
tune_control_s tune_control = {};
tune_control.tune_id = 0;
tune_control.strength = 40;
tune_control.strength = tune_control_s::STRENGTH_NORMAL;

while ((ch = px4_getopt(argc, argv, "f:d:t:m:s:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
Expand Down Expand Up @@ -151,7 +151,7 @@ tune_control_main(int argc, char *argv[])
tune_control.strength = value;

} else {
tune_control.strength = 40;
tune_control.strength = tune_control_s::STRENGTH_NORMAL;
}

break;
Expand Down