From 2784917c82b3acf9609baa24da4ad618735cebc8 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 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/MAVProxy/modules/mavproxy_console.py b/MAVProxy/modules/mavproxy_console.py index c85c964b02..ce2e729364 100644 --- a/MAVProxy/modules/mavproxy_console.py +++ b/MAVProxy/modules/mavproxy_console.py @@ -91,11 +91,24 @@ 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)