|
|
|
|
@ -194,7 +194,7 @@ class ControlPanel:
|
|
|
|
|
port_menu = MenuNode(f"{port}", children=[
|
|
|
|
|
MenuNode("Set Comm Type", "設定通訊形態", "SET_SERIAL_COMM", children=[
|
|
|
|
|
MenuNode("XBee(API-AT)", "XBee 模式", "SET_SERIAL_COMM_XBEE"),
|
|
|
|
|
MenuNode("Xbee(AT-AT)", "數傳模式", "SET_SERIAL_COMM_TELEMETRY"),
|
|
|
|
|
# MenuNode("Telemetry", "數傳模式", "SET_SERIAL_COMM_TELEMETRY"),
|
|
|
|
|
]),
|
|
|
|
|
MenuNode("Set Baud", "設定 Baud", "TEXT_BAUD_SERIAL"),
|
|
|
|
|
MenuNode("Create", "建立此串口", "CREATE_SERIAL_PORT"),
|
|
|
|
|
@ -323,7 +323,7 @@ class ControlPanel:
|
|
|
|
|
def menu_tree(self):
|
|
|
|
|
"""建立多層選單結構"""
|
|
|
|
|
return MenuNode("Main Menu", children=[
|
|
|
|
|
MenuNode("MavLink Object", "控制 MavLink 物件", children=[
|
|
|
|
|
MenuNode("MavLink Object", "MavLink 通道選項", children=[
|
|
|
|
|
MenuNode("New+", children=[
|
|
|
|
|
MenuNode("UDP InBound", children=[
|
|
|
|
|
MenuNode("IP(Listen)", "設定監聽的 IP 位址", "TEXT_UDP_IP"),
|
|
|
|
|
@ -335,10 +335,13 @@ class ControlPanel:
|
|
|
|
|
MenuNode("Port(Target)", "設定目標的 Port", "TEXT_UDP_PORT"),
|
|
|
|
|
MenuNode("Create", "建立 UDP OutBound 連結口", "CREATE_UDP_OUTBOUND"),
|
|
|
|
|
]),
|
|
|
|
|
MenuNode("Serial InBound", action = "LIST_SERIAL_RES"),
|
|
|
|
|
]),
|
|
|
|
|
MenuNode("ListAll", "顯示並管理所有連結口", "LIST_MAV_OBJECT"),
|
|
|
|
|
]),
|
|
|
|
|
MenuNode("Serial Manager", "Serial 連接埠選項", children=[
|
|
|
|
|
MenuNode("New+", "新增 Serial 連接埠", action = "LIST_SERIAL_RES"),
|
|
|
|
|
MenuNode("ListAll", "顯示已連線的 Serial", action = "LIST_SERIAL_LINKS"),
|
|
|
|
|
]),
|
|
|
|
|
MenuNode("Engineer Mode", "工程模式", children=[
|
|
|
|
|
MenuNode("Stop Manager", "停止 Mavlink 物件管理", "STOP_MANAGER"),
|
|
|
|
|
MenuNode("Stop Bridge", "停止 Mavlink-ROS 橋接", "STOP_BRIDGE"),
|
|
|
|
|
@ -410,10 +413,6 @@ class ControlPanel:
|
|
|
|
|
stdscr.addstr(4, 2, f"Socket Object number : {len(state.socket_object_list)}")
|
|
|
|
|
stdscr.addstr(2, 36, f"Serial Manager State : {state.serial_manager_state}")
|
|
|
|
|
|
|
|
|
|
# stdscr.addstr(2, 25, f"{state.mavlink_bridge_state}")
|
|
|
|
|
# stdscr.addstr(3, 25, f"{state.object_manager_state}")
|
|
|
|
|
# stdscr.addstr(4, 25, f"{len(state.socket_object_list)} ")
|
|
|
|
|
|
|
|
|
|
# 顯示當前選單項目
|
|
|
|
|
start_line = 6
|
|
|
|
|
for i, child in enumerate(current_menu.children):
|
|
|
|
|
@ -611,29 +610,6 @@ class ControlPanel:
|
|
|
|
|
menu_stack.append(created_list_menu)
|
|
|
|
|
idx_stack.append(0)
|
|
|
|
|
|
|
|
|
|
# elif selected.action == "PREV_PAGE":
|
|
|
|
|
# # 上一頁
|
|
|
|
|
# if hasattr(selected, 'page'):
|
|
|
|
|
# menu_stack.pop()
|
|
|
|
|
# idx_stack.pop()
|
|
|
|
|
# if menu_stack[-1].name == "Serial Port List":
|
|
|
|
|
# created_list_menu = self.create_serial_port_menu(state, page=selected.page)
|
|
|
|
|
# elif menu_stack[-1].name == "Object List":
|
|
|
|
|
# created_list_menu = self.create_object_list_menu(state, page=selected.page)
|
|
|
|
|
# menu_stack.append(created_list_menu)
|
|
|
|
|
# idx_stack.append(0)
|
|
|
|
|
|
|
|
|
|
# elif selected.action == "NEXT_PAGE":
|
|
|
|
|
# # 下一頁
|
|
|
|
|
# if hasattr(selected, 'page'):
|
|
|
|
|
# menu_stack.pop()
|
|
|
|
|
# idx_stack.pop()
|
|
|
|
|
# if menu_stack[-1].name == "Serial Port List":
|
|
|
|
|
# created_list_menu = self.create_serial_port_menu(state, page=selected.page)
|
|
|
|
|
# elif menu_stack[-1].name == "Object List":
|
|
|
|
|
# created_list_menu = self.create_object_list_menu(state, page=selected.page)
|
|
|
|
|
# menu_stack.append(created_list_menu)
|
|
|
|
|
# idx_stack.append(0)
|
|
|
|
|
elif selected.action in ("PREV_PAGE", "NEXT_PAGE"):
|
|
|
|
|
if hasattr(selected, 'page'):
|
|
|
|
|
current_list_menu = menu_stack[-1]
|
|
|
|
|
@ -932,8 +908,8 @@ class Orchestrator:
|
|
|
|
|
|
|
|
|
|
# 定義通訊類型映射表
|
|
|
|
|
COMM_TYPE_MAP = {
|
|
|
|
|
"XBee(API-AT)": sm.CommunicationType.XBee_API_AT,
|
|
|
|
|
# "XBee(AT-AT)": sm.CommunicationType.XBee_AT_AT, # TODO: 之後再弄
|
|
|
|
|
"XBee(API-AT)": sm.SerialReceiverType.XBEEAPI2AT,
|
|
|
|
|
# "XBee(AT-AT)": sm.SerialReceiverType.TELEMETRY, # TODO: 之後再弄
|
|
|
|
|
# 新增區
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -953,11 +929,11 @@ class Orchestrator:
|
|
|
|
|
)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
ret = self.plumber.create_serial_port(
|
|
|
|
|
port=self.panelState.serial_info_temp['Port'],
|
|
|
|
|
ret = self.plumber.create_serial_link(
|
|
|
|
|
serial_port=self.panelState.serial_info_temp['Port'],
|
|
|
|
|
baudrate=self.panelState.serial_info_temp['Baud'],
|
|
|
|
|
target_port=udp_port_tmp,
|
|
|
|
|
communication_type=comm_type_tmp,
|
|
|
|
|
receiver_type=comm_type_tmp,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if not ret:
|
|
|
|
|
|