first commit

This commit is contained in:
2026-04-08 23:13:35 +08:00
commit 3d8af3debb
6 changed files with 307 additions and 0 deletions

40
alink_gs.conf Normal file
View File

@@ -0,0 +1,40 @@
# adaptive-link VRX settings
[outgoing]
udp_ip = 10.5.0.10
udp_port = 9999
[json]
HOST = 127.0.0.1
PORT = 8103
[weights]
snr_weight = 0.5
rssi_weight = 0.5
[ranges]
SNR_MIN = 10
SNR_MAX = 36
RSSI_MIN = -85
RSSI_MAX = -40
[keyframe]
allow_idr = True
idr_max_messages = 20
[dynamic refinement]
allow_penalty = False
allow_fec_increase = False
[noise]
min_noise = 0.01
max_noise = 0.1
deduction_exponent = 0.5
min_noise_for_fec_change = 0.01
noise_for_max_fec_change = 0.1
[error estimation]
kalman_estimate = 0.005
kalman_error_estimate = 0.1
process_variance = 1e-5
measurement_variance = 0.01

186
config_osd.json Normal file
View File

@@ -0,0 +1,186 @@
{
"format": "0.0.1",
"assets_dir": "/usr/share/pixelpilot/",
"widgets": [
{
"type": "IconSelectorWidget",
"name": "RSSI of antenna 1",
"x": -96,
"y": 0,
"facts": [
{"name": "wfbcli.rx.ant_stats.rssi_avg","tags": {"ant_id": "0", "id": "video rx"}}
],
"ranges_and_icons": [
{"range": [-49, 1], "icon_path": "signal1.png"},
{"range": [-59, -50],"icon_path": "signal2.png"},
{"range": [-69, -60],"icon_path": "signal3.png"},
{"range": [-79, -70],"icon_path": "signal4.png"},
{"range": [-130, -80],"icon_path": "signal5.png"}
]
},
{
"type": "IconSelectorWidget",
"name": "RSSI of antenna 2",
"x": -192,
"y": 0,
"facts": [
{"name": "wfbcli.rx.ant_stats.rssi_avg","tags": {"ant_id": "1", "id": "video rx"}}
],
"ranges_and_icons": [
{"range": [-49, 1], "icon_path": "signal1.png"},
{"range": [-59, -50],"icon_path": "signal2.png"},
{"range": [-69, -60],"icon_path": "signal3.png"},
{"range": [-79, -70],"icon_path": "signal4.png"},
{"range": [-130, -80],"icon_path": "signal5.png"}
],
"calculation": "wfbcli_rx_ant_stats_rssi_avg_ant_id_1_id_video_rx"
},
{
"type": "IconSelectorWidget",
"name": "RSSI of antenna 3",
"x": -288,
"y": 0,
"facts": [
{"name": "wfbcli.rx.ant_stats.rssi_avg","tags": {"ant_id": "256", "id": "video rx"}}
],
"ranges_and_icons": [
{"range": [-49, 1], "icon_path": "signal1.png"},
{"range": [-59, -50],"icon_path": "signal2.png"},
{"range": [-69, -60],"icon_path": "signal3.png"},
{"range": [-79, -70],"icon_path": "signal4.png"},
{"range": [-130, -80],"icon_path": "signal5.png"}
]
},
{
"type": "IconSelectorWidget",
"name": "RSSI of antenna 4",
"x": -384,
"y": 0,
"facts": [
{"name": "wfbcli.rx.ant_stats.rssi_avg","tags": {"ant_id": "257", "id": "video rx"}}
],
"ranges_and_icons": [
{"range": [-49, 1], "icon_path": "signal1.png"},
{"range": [-59, -50],"icon_path": "signal2.png"},
{"range": [-69, -60],"icon_path": "signal3.png"},
{"range": [-79, -70],"icon_path": "signal4.png"},
{"range": [-130, -80],"icon_path": "signal5.png"}
]
},
{
"type": "IconSelectorWidget",
"name": "RSSI of antenna 5",
"x": -480,
"y": 0,
"facts": [
{"name": "wfbcli.rx.ant_stats.rssi_avg","tags": {"ant_id": "512", "id": "video rx"}}
],
"ranges_and_icons": [
{"range": [-49, 1], "icon_path": "signal1.png"},
{"range": [-59, -50],"icon_path": "signal2.png"},
{"range": [-69, -60],"icon_path": "signal3.png"},
{"range": [-79, -70],"icon_path": "signal4.png"},
{"range": [-130, -80],"icon_path": "signal5.png"}
]
},
{
"type": "IconSelectorWidget",
"name": "RSSI of antenna 6",
"x": -576,
"y": 0,
"facts": [
{"name": "wfbcli.rx.ant_stats.rssi_avg","tags": {"ant_id": "513", "id": "video rx"}}
],
"ranges_and_icons": [
{"range": [-49, 1], "icon_path": "signal1.png"},
{"range": [-59, -50],"icon_path": "signal2.png"},
{"range": [-69, -60],"icon_path": "signal3.png"},
{"range": [-79, -70],"icon_path": "signal4.png"},
{"range": [-130, -80],"icon_path": "signal5.png"}
]
},
{
"name": "Metrics background",
"type": "BoxWidget",
"x": -270,
"y": 100,
"width": 270,
"height": 100,
"color": {
"r": 0.0,
"g": 0.0,
"b": 0.0,
"alpha": 0.4
},
"facts": []
},
{
"name": "Video FPS and resolution",
"type": "VideoWidget",
"x": -250,
"y": 126,
"icon_path": "framerate.png",
"template": "%u fps | %ux%u",
"per_second_window_s": 2,
"per_second_bucket_ms": 200,
"facts": [
{
"__comment": "Will be converted to per-second",
"name": "video.displayed_frame"
},
{
"name": "video.width"
},
{
"name": "video.height"
}
]
},
{
"name": "Video link throughput",
"type": "VideoBitrateWidget",
"x": -250,
"y": 156,
"icon_path": "network.png",
"template": "%f Mbps",
"per_second_window_s": 2,
"per_second_bucket_ms": 100,
"facts": [
{
"__comment": "Should be sum per-second, scaled to Megs",
"name": "gstreamer.received_bytes"
}
]
},
{
"name": "DVR status",
"type": "DvrStatusWidget",
"x": -250,
"y": 186,
"icon_path": "sdcard-white.png",
"text": "Recording",
"facts": [
{"name": "dvr.recording"}
]
},
{
"name": "Custom fading message",
"type": "PopupWidget",
"x": 400,
"y": 50,
"timeout_ms": 10000,
"facts": [
{"name": "osd.custom_message"}
]
},
{
"name": "msposd",
"type": "ExternalSurfaceWidget",
"x": 0,
"y": 0,
"width": 0,
"height": 0,
"facts": []
}
]
}

55
scripts/autoload-wfb-nics.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
# Initialize log file and type variables
LOG_FILE=""
TYPE=""
# Parse arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
--log)
LOG_FILE="$2"
shift
;;
--type)
TYPE="$2"
shift
;;
*)
echo "Unknown parameter passed: $1"
exit 1
;;
esac
shift
done
# Initialize an empty string to store matching interface names
matching_interfaces=""
# List all network interfaces and filter only wireless ones
for iface in /sys/class/net/*; do
iface_name=$(basename $iface)
# Check if the interface is wireless and usb
if [ -d "/sys/class/net/$iface_name/wireless" ] && [[ "$(readlink -f /sys/class/net/$iface_name/device/subsystem)" == *"usb"* ]]; then
# Append the interface name to the list
matching_interfaces+="$iface_name "
fi
done
# Output the list of matching interfaces as a space-separated string
new_wfb_nics="WFB_NICS=\"${matching_interfaces% }\""
# Read the current contents of /etc/default/wifibroadcast
current_wfb_nics=$(cat /etc/default/wifibroadcast 2>/dev/null)
# Compare and update if different
if [[ "$current_wfb_nics" != "$new_wfb_nics" ]]; then
echo "$new_wfb_nics" >/etc/default/wifibroadcast
systemctl restart wifibroadcast &
# Log to file if --log argument was provided
if [[ -n "$LOG_FILE" ]]; then
echo "$(date) [$TYPE]: Network interface $ACTION $INTERFACE" >>"$LOG_FILE"
echo "$(date) [$TYPE]: $new_wfb_nics" >>"$LOG_FILE"
echo "$(date) [$TYPE]: Restarting Wifibroadcast service" >>"$LOG_FILE"
fi
fi

1
scripts/rec-fps Normal file
View File

@@ -0,0 +1 @@
60

1
scripts/screen-mode Normal file
View File

@@ -0,0 +1 @@
1280x720@60

24
scripts/stream.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
DVR_PATH=/media
SCREEN_MODE=$(</config/scripts/screen-mode)
REC_FPS=$(</config/scripts/rec-fps)
PID=0
BUTTON=21
#pixelpilot --osd --osd-config /config/config_osd.json --screen-mode $SCREEN_MODE --dvr-framerate $REC_FPS --dvr-fmp4 --dvr-template $DVR_PATH/record_%Y-%m-%d_%H-%M-%S.mp4 &
pixelpilot --osd --osd-config /config/config_osd.json --screen-mode $(</config/scripts/screen-mode) --dvr-framerate $(</config/scripts/rec-fps) --dvr-fmp4 --dvr-template $DVR_PATH/record_%Y-%m-%d_%H-%M-%S.mp4
PID=$!
while true; do
# Wait for button click
if [ $(gpio read $BUTTON) -eq 1 ]; then
echo "toggle DVR for $PID"
kill -SIGUSR1 $PID
# wait 2s to let user release the button
sleep 2
fi
sleep 0.1
done