mavlink: add 'verbose [on|off]' command

This commit is contained in:
Beat Küng 2017-05-15 16:58:50 +02:00 committed by Lorenz Meier
parent 371586be2c
commit cf3b068179
2 changed files with 10 additions and 4 deletions

View File

@ -506,7 +506,7 @@ Mavlink::set_verbose(bool v)
}
int
Mavlink::set_verbose_all_instances()
Mavlink::set_verbose_all_instances(bool enabled)
{
Mavlink *inst = ::_mavlink_instances;
@ -514,7 +514,7 @@ Mavlink::set_verbose_all_instances()
while (inst != nullptr) {
inst->set_verbose(true);
inst->set_verbose(enabled);
/* move on */
inst = inst->next;
@ -2834,7 +2834,13 @@ int mavlink_main(int argc, char *argv[])
return Mavlink::get_status_all_instances();
} else if (!strcmp(argv[1], "verbose")) {
return Mavlink::set_verbose_all_instances();
bool on = true;
if (argc > 2 && !strcmp(argv[2], "off")) {
on = false;
}
return Mavlink::set_verbose_all_instances(on);
} else if (!strcmp(argv[1], "stream")) {
return Mavlink::stream_command(argc, argv);

View File

@ -138,7 +138,7 @@ public:
* This is primarily intended for analysis and
* not intended for normal operation
*/
static int set_verbose_all_instances();
static int set_verbose_all_instances(bool enabled);
static bool instance_exists(const char *device_name, Mavlink *self);