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

mavlink: correct stream_command rate use #15362

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 2 additions & 6 deletions src/modules/mavlink/mavlink_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,7 @@ Mavlink::stream_command(int argc, char *argv[])
if (0 == strcmp(argv[i], "-r") && i < argc - 1) {
rate = strtod(argv[i + 1], nullptr);

if (rate < 0.0f) {
if (rate < -2.5f) {
err_flag = true;
}

Expand Down Expand Up @@ -2935,10 +2935,6 @@ Mavlink::stream_command(int argc, char *argv[])
return 1;
}

if (rate < 0.0f) {
rate = -2.0f; // use default rate
}

if (inst != nullptr) {
inst->configure_stream_threadsafe(stream_name, rate);

Expand Down Expand Up @@ -3054,7 +3050,7 @@ Start mavlink on UDP port 14556 and enable the HIGHRES_IMU message with 50Hz:
#endif
PRINT_MODULE_USAGE_PARAM_STRING('d', nullptr, "<file:dev>", "Select Mavlink instance via Serial Device", true);
PRINT_MODULE_USAGE_PARAM_STRING('s', nullptr, nullptr, "Mavlink stream to configure", false);
PRINT_MODULE_USAGE_PARAM_FLOAT('r', -1.0f, 0.0f, 2000.0f, "Rate in Hz (0 = turn off, -1 = set to default)", false);
PRINT_MODULE_USAGE_PARAM_FLOAT('r', -1.0f, 0.0f, 2000.0f, "Rate in Hz (0 = turn off, -1 = default, -2 = unlimited rate)", false);

PRINT_MODULE_USAGE_COMMAND_DESCR("boot_complete",
"Enable sending of messages. (Must be) called as last step in startup script.");
Expand Down