MAVLink app: Make debug messages a compile time check

The debug messages are too verbose to be run in a production vehicle and inherently were something that should only be run in SITL / debug sessions on hardware. Switching the flag to the PX4_DEBUG() macro does not only make this more explicit, but also saves a lot of flash space that otherwise was consumed by the strings.
This commit is contained in:
Lorenz Meier
2018-01-13 22:02:57 -05:00
committed by Daniel Agar
parent f1a3fd09a3
commit 6227139df1
6 changed files with 64 additions and 157 deletions
+2 -6
View File
@@ -469,17 +469,13 @@ protected:
if (_cmd_sub->update_if_changed(&cmd)) {
if (!cmd.from_external) {
if (_mavlink->verbose()) {
PX4_INFO("sending command %d to %d/%d", cmd.command, cmd.target_system, cmd.target_component);
}
PX4_DEBUG("sending command %d to %d/%d", cmd.command, cmd.target_system, cmd.target_component);
MavlinkCommandSender::instance().handle_vehicle_command(cmd, _mavlink->get_channel());
sent = true;
} else {
if (_mavlink->verbose()) {
PX4_INFO("not forwarding command %d to %d/%d", cmd.command, cmd.target_system, cmd.target_component);
}
PX4_DEBUG("not forwarding command %d to %d/%d", cmd.command, cmd.target_system, cmd.target_component);
}
}