tmpCommit
This commit is contained in:
@@ -491,6 +491,10 @@ class ControlPanel:
|
||||
menu_stack.pop()
|
||||
idx_stack.pop()
|
||||
|
||||
elif selected.action == "DO_DISCOVERY_PANEL":
|
||||
if hasattr(selected, 'serial_id'):
|
||||
cmd_q.put(("DO_DISCOVERY", selected.serial_id))
|
||||
|
||||
# related with -> 列表選單
|
||||
elif selected.action in ("PREV_PAGE", "NEXT_PAGE"):
|
||||
if hasattr(selected, 'page'):
|
||||
@@ -868,6 +872,7 @@ class ControlPanel:
|
||||
obj_menu = MenuNode(f"Serial #{serial_id}", f"連結口 {serial_id}", None, children=[
|
||||
MenuNode("Info", "查看詳細資訊", "INSPECT_LINKED_SERIAL"),
|
||||
MenuNode("Remove", "移除此連結口", "REMOVE_LINKED_SERIAL"),
|
||||
MenuNode("Discovery", "搜尋遠端RF(Only XBEE-ESP32)", "DO_DISCOVERY_PANEL"),
|
||||
# MenuNode("Change UDP Target", "變更目標 UDP (工程)", "CHANGE_LINKED_SERIAL_TARGET"),
|
||||
MenuNode("GoUp", "回到列表", "BACK"),
|
||||
])
|
||||
@@ -1319,6 +1324,11 @@ class Orchestrator:
|
||||
elif action == "REMOVE_LINKED_SERIAL":
|
||||
serial_id = cmd[1]
|
||||
self.plumber.remove_serial_link(serial_id)
|
||||
elif action == "DO_DISCOVERY":
|
||||
serial_id = cmd[1]
|
||||
processor = self.plumber.get_espv1_processor(serial_id)
|
||||
if processor:
|
||||
processor.request_discovery()
|
||||
|
||||
elif action == "INSPECT_VEHICLE":
|
||||
sysid, compid = cmd[1], cmd[2]
|
||||
|
||||
@@ -349,7 +349,7 @@ class XBeeFrameProcessor_ESPv1(XBeeFrameProcessor_Base):
|
||||
self.max_time_tolerance_poll_interval = 150 # (msec) poll 期間 每筆 MAVLink 資料 /DONE 最大閒置間隔
|
||||
self.discovery_interval_seconds = 200.0 # (sec) 每次做 discovery 程序的間隔時間
|
||||
self.device_offline_timeout = self.discovery_interval_seconds * 2 # 遠端沒有回應會被踢出 超時時限
|
||||
self.operator_tick_interval_seconds = 0.01 #
|
||||
self.operator_tick_interval_seconds = 0.005 #
|
||||
self.guard_milliseconds = 50 # POLL DONE 的保底時間間隔
|
||||
|
||||
self.pending_manual_discovery = False
|
||||
|
||||
@@ -7,7 +7,7 @@ POLL 輪詢策略,供 XBeeFrameProcessor_ESPv1 使用。
|
||||
from dataclasses import dataclass
|
||||
from typing import List
|
||||
|
||||
MIN_TRIGGER_INTERVAL_MS = 50
|
||||
MIN_TRIGGER_INTERVAL_MS = 5
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PollDevice:
|
||||
@@ -34,10 +34,13 @@ def pick_next(devices: List[PollDevice], now_time):
|
||||
|
||||
for i in range(device_count):
|
||||
gap = int((now_time - devices[i].last_poll_time)*1000)
|
||||
# 時間大於觸發間隔 才會計算
|
||||
if gap >= MIN_TRIGGER_INTERVAL_MS:
|
||||
weights[i] += devices[i].remain_bytes
|
||||
weights[i] += gap
|
||||
# # 時間大於觸發間隔 才會計算
|
||||
# if gap >= MIN_TRIGGER_INTERVAL_MS:
|
||||
# weights[i] += devices[i].remain_bytes
|
||||
# weights[i] += gap
|
||||
|
||||
weights[i] += devices[i].remain_bytes
|
||||
weights[i] += gap
|
||||
|
||||
maxarg = weights.index(max(weights))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user