Skip to content

Commit

Permalink
link: add option to suppress printing of ACKs from other systems
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Jun 3, 2022
1 parent d405441 commit c4b1173
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
2 changes: 2 additions & 0 deletions MAVProxy/mavproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def __init__(self):

MPSetting('vehicle_name', str, '', 'Vehicle Name', tab='Vehicle'),

MPSetting('all_command_acks', bool, True, 'Show COMMAND_ACKs even if they are targetted at other vehicles'),

MPSetting('sys_status_error_warn_interval', int, 30, 'interval to warn of autopilot software failure'),

MPSetting('inhibit_screensaver_when_armed', bool, False, 'inhibit screensaver while vehicle armed'),
Expand Down
33 changes: 30 additions & 3 deletions MAVProxy/modules/mavproxy_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,34 @@ def emit_accumulated_statustext(self, key, id, pending):
self.status.last_apm_msg_time = time.time()
del self.status.statustexts_by_sysidcompid[key][id]

def should_show_command_ack(self, m):
'''returns true if we should display some text on the console for m'''
if m.target_component in [mavutil.mavlink.MAV_COMP_ID_MAVCAN]:
# too noisy?
return False

if m.command in [mavutil.mavlink.MAV_CMD_GET_HOME_POSITION]:
# too noisy?
return False

if self.settings.all_command_acks:
# we're showing everything
return True

if m.target_system == 0:
return True

if m.target_system != self.settings.source_system:
return False

if m.target_component == 0:
return True

if m.target_component != self.settings.source_component:
return False

return True

def master_msg_handling(self, m, master):
'''link message handling for an upstream link'''
if self.settings.target_system != 0 and m.get_srcSystem() != self.settings.target_system:
Expand Down Expand Up @@ -744,10 +772,9 @@ def accumulated_statustext(self):
cmd = cmd[8:]
res = mavutil.mavlink.enums["MAV_RESULT"][m.result].name
res = res[11:]
if (m.target_component not in [mavutil.mavlink.MAV_COMP_ID_MAVCAN] and
m.command not in [mavutil.mavlink.MAV_CMD_GET_HOME_POSITION]):
if self.should_show_command_ack(m):
self.mpstate.console.writeln("Got COMMAND_ACK: %s: %s" % (cmd, res))
except Exception:
except KeyError as e:
self.mpstate.console.writeln("Got MAVLink msg: %s" % m)

if m.command == mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION:
Expand Down

0 comments on commit c4b1173

Please sign in to comment.