From 08f6608dc8fc39d8ea55398cf1afa54d3092d0cd Mon Sep 17 00:00:00 2001 From: Ryan Friedman <25047695+Ryanf55@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:01:01 -0700 Subject: [PATCH] mavproxy_console.py: Add Start Websocket Server to the MAVProxy console Signed-off-by: Ryan Friedman <25047695+Ryanf55@users.noreply.github.com> --- MAVProxy/modules/mavproxy_console.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/MAVProxy/modules/mavproxy_console.py b/MAVProxy/modules/mavproxy_console.py index c85c964b02..1336d6d24d 100644 --- a/MAVProxy/modules/mavproxy_console.py +++ b/MAVProxy/modules/mavproxy_console.py @@ -91,11 +91,22 @@ def __init__(self, mpstate): # create the main menu if mp_util.has_wxpython: self.menu = MPMenuTop([]) + mavproxy_items = [MPMenuItem('Settings', 'Settings', 'menuSettings'), + MPMenuItem('Show Map', 'Load Map', '# module load map'), + MPMenuItem('Show HUD', 'Load HUD', '# module load horizon'), + MPMenuItem('Show Checklist', 'Load Checklist', '# module load checklist')] + + # wsproto is not installed by default. + # Only add the menu if it's available. + try: + import wsproto + except ImportError: + pass + else: + mavproxy_items.append(MPMenuItem('Start Websocket Server', 'Start Websocket Server', '# output add wsserver:0.0.0.0:56781')) + self.add_menu(MPMenuSubMenu('MAVProxy', - items=[MPMenuItem('Settings', 'Settings', 'menuSettings'), - MPMenuItem('Show Map', 'Load Map', '# module load map'), - MPMenuItem('Show HUD', 'Load HUD', '# module load horizon'), - MPMenuItem('Show Checklist', 'Load Checklist', '# module load checklist')])) + items=mavproxy_items)) self.vehicle_menu = MPMenuSubMenu('Vehicle', items=[]) self.add_menu(self.vehicle_menu)