From 0d0be6251ad9b36e064226fd9e5e4db23b5ef2ac Mon Sep 17 00:00:00 2001
From: viktorxda <35473052+viktorxda@users.noreply.github.com>
Date: Fri, 11 Apr 2025 13:44:52 +0200
Subject: [PATCH] [no ci] Package: update wifibroadcast-ng

---
 .../wifibroadcast-ng/files/wifibroadcast      | 23 +++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/general/package/wifibroadcast-ng/files/wifibroadcast b/general/package/wifibroadcast-ng/files/wifibroadcast
index c072b1d5..5be74040 100755
--- a/general/package/wifibroadcast-ng/files/wifibroadcast
+++ b/general/package/wifibroadcast-ng/files/wifibroadcast
@@ -65,17 +65,21 @@ load_interface() {
 	iw "$wfb_dev" set txpower fixed "$wfb_power"
 }
 
+load_wfb() {
+	wfb_rx -K "$wfb_key" -i "$link_id" -p "$1" -u "$3" "$wfb_dev" &> /dev/null &
+	wfb_tx -K "$wfb_key" -M "$tun_index" -B "$width" -k "$fec_k" -n "$fec_n" \
+		-S "$stbc" -L "$ldpc" -i "$link_id" -p "$2" -u "$4" "$wfb_dev" &> /dev/null &
+}
+
 start_broadcast() {
 	echo_log "Starting wfb_tx"
 	wfb_tx -K "$wfb_key" -M "$mcs_index" -B "$width" -k "$fec_k" -n "$fec_n" -U rtp_local \
-		-S "$stbc" -L "$ldpc" -i "$link_id" -C 8000 -G short "$wfb_dev" &> /dev/null &
+		-S "$stbc" -L "$ldpc" -i "$link_id" -C 8000 "$wfb_dev" &> /dev/null &
 }
 
 start_tunnel() {
 	echo_log "Starting wfb_tun"
-	wfb_rx -K "$wfb_key" -i "$link_id" -p 160 -u 5800 "$wfb_dev" &> /dev/null &
-	wfb_tx -K "$wfb_key" -M "$tun_index" -B "$width" -k "$fec_k" -n "$fec_n" \
-		-S "$stbc" -L "$ldpc" -i "$link_id" -p 32 -u 5801 "$wfb_dev" &> /dev/null &
+	load_wfb 160 32 5800 5801
 	wfb_tun -a 10.5.0.10/24 > /dev/null &
 }
 
@@ -83,16 +87,21 @@ start_telemetry() {
 	chipset=$(ipcinfo -c)
 	[ "$chipset" = "ssc33x" ] && devmem 0x1F207890 16 0x8
 
+	port_rx=14551
+	port_tx=14550
+
 	echo_log "Starting $router"
+	load_wfb 144 16 "$port_rx" "$port_tx"
+
 	if [ "$router" = "mavfwd" ]; then
 		mavfwd -b 115200 -c 8 -p 100 -a 15 -t -m /dev/"$serial" \
-			-i 0.0.0.0:14550 -o 10.5.0.1:14551 > /dev/null &
+			-i 0.0.0.0:"$port_rx" -o 0.0.0.0:"$port_tx" > /dev/null &
 	else
 		if [ "$router" = "msposd" ]; then
-			size=$(curl -s localhost/api/v1/config.json | jsonfilter -e "@.video0.size")
+			size=$(curl -s localhost/api/v1/config.json | jsonfilter -qe "@.video0.size")
 		fi
 		msposd -b 115200 -c 8 -r "$osd_fps" -m /dev/"$serial" \
-			-o 10.5.0.1:14551 -z "$size" > /dev/null &
+			-o 0.0.0.0:"$port_rx" -z "$size" > /dev/null &
 	fi
 }