fix: 5G自动拨号、软件时钟同步、机器人端控制程序自启。

This commit is contained in:
2026-04-11 17:20:52 +08:00
parent 09dd9e24c0
commit 7622360a0e
4 changed files with 63 additions and 13 deletions

View File

@@ -54,6 +54,8 @@ blitz_load_boot_env() {
export BLITZ_LOG_FILE="${BLITZ_LOG_FILE:-/var/log/blitz-robot/startup.log}"
export BLITZ_5G_DIAL_DIR="${BLITZ_5G_DIAL_DIR:-/home/nvidia/5g-test/5G}"
export BLITZ_5G_SERIAL_PORT="${BLITZ_5G_SERIAL_PORT:-/dev/ttyUSB7}"
export BLITZ_5G_INTERFACE="${BLITZ_5G_INTERFACE:-eth0}"
export BLITZ_5G_DISABLE_INTERFACES="${BLITZ_5G_DISABLE_INTERFACES:-}"
export BLITZ_5G_SERIAL_WAIT_SEC="${BLITZ_5G_SERIAL_WAIT_SEC:-60}"
export BLITZ_5G_ROUTE_WAIT_SEC="${BLITZ_5G_ROUTE_WAIT_SEC:-30}"
export BLITZ_TIME_SERVER_IP="${BLITZ_TIME_SERVER_IP:-${default_time_server}}"
@@ -158,21 +160,24 @@ blitz_require_root() {
blitz_run() {
local step="$1"
local action="$2"
local rc
shift 2
blitz_log "${step}" "${action}" "start" "$(blitz_join_cmd "$@")" 0
if "$@"; then
blitz_log "${step}" "${action}" "success" "$(blitz_join_cmd "$@")" 0
return 0
else
rc=$?
fi
local rc=$?
blitz_log "${step}" "${action}" "failure" "$(blitz_join_cmd "$@")" "${rc}"
return "${rc}"
}
blitz_route_ready() {
local target_ip="$1"
local expected_interface="${2:-}"
local route_output
route_output="$(ip route get "${target_ip}" 2>&1 || true)"
@@ -182,6 +187,9 @@ blitz_route_ready() {
if [[ "${route_output}" == *"unreachable"* || "${route_output}" == *"prohibit"* ]]; then
return 1
fi
if [[ -n "${expected_interface}" && "${route_output}" != *" dev ${expected_interface} "* && "${route_output}" != *" dev ${expected_interface}" ]]; then
return 1
fi
printf '%s\n' "${route_output}"
return 0