Skip to content

Commit 33e762d

Browse files
authored
Merge pull request #74 from carabidulebabat/patch-1
Update APFPV.md
2 parents f3a63bf + ce77e7c commit 33e762d

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed

src/content/docs/use-cases/fpv/APFPV.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,130 @@ Unlike complex mesh networking systems (WFB-NG, RubyFPV), APFPV:
320320
- Provides easy web-based configuration
321321

322322
APFPV bridges the gap between complex FPV systems and simple solutions, making FPV accessible to everyone while supporting professional equipment for advanced users.
323+
324+
##APFPV with runcam gs or other gs that got many wifi card
325+
326+
step 1 : download APFPV radxa img at this link https://github.com/OpenIPC/sbc-groundstations/ and click on APFPV v0.0.1 link
327+
step 2 : flash sd card using balena etcher or other similar software
328+
setp 3 : once finish we need to modify stream.sh and firstboot.sh
329+
330+
in /script/firstboot.sh copy this block of code that will shearch external wifi card at the beginning of the file it should replace the wlan0 connection script.
331+
332+
```bash
333+
#!/bin/bash
334+
335+
SSID="OpenIPC"
336+
PASSWORD="12345678"
337+
EXCLUDE_IFACE="wlan0"
338+
339+
echo "[*] scan wifi card"
340+
341+
# list every wifi interface wlx or wlan expect wlan0
342+
WIFI_IFACES=$(ip -o link show | awk -F': ' '{print $2}' | grep -E '^wlan|^wlx' | grep -v "^$EXCLUDE_IFACE$")
343+
344+
INDEX=1
345+
346+
for IFACE in $WIFI_IFACES; do
347+
CONN_NAME="wifi$INDEX"
348+
349+
echo ""
350+
echo "=== wifi card detected : $IFACE$CONN_NAME ==="
351+
352+
# delete old connection
353+
if nmcli connection show "$CONN_NAME" &>/dev/null; then
354+
nmcli connection delete "$CONN_NAME"
355+
fi
356+
357+
# scan avaible wifi network
358+
nmcli device wifi rescan ifname "$IFACE"
359+
sleep 2
360+
361+
# connect to APFPV network
362+
echo "[*] create $CONN_NAME..."
363+
nmcli connection add type wifi ifname "$IFACE" con-name "$CONN_NAME" ssid "$SSID" \
364+
wifi-sec.key-mgmt wpa-psk wifi-sec.psk "$PASSWORD" \
365+
ipv4.method auto connection.autoconnect yes
366+
367+
# enable ip route
368+
if [[ "$CONN_NAME" == "wifi1" ]]; then
369+
370+
nmcli connection modify "$CONN_NAME" ipv4.route-metric 100
371+
elif [[ "$CONN_NAME" == "wifi2" ]]; then
372+
373+
nmcli connection modify "$CONN_NAME" ipv4.route-metric 200
374+
fi
375+
376+
# enable connection
377+
nmcli connection up "$CONN_NAME"
378+
379+
INDEX=$((INDEX + 1))
380+
done
381+
382+
echo ""
383+
echo "[✓] evrything done, end of script"
384+
```
385+
step 4 : in stream.sh disable wlan0 using nmcli
386+
387+
copy this line :
388+
389+
```bash
390+
nmcli device disconnect wlan0
391+
```
392+
393+
thats all now put the sd card on your vrx and boot it, you will get 2 wifi interface connect to apfpv credential, and with ip route it will pick the best wifi card every time to connect, the range will increase significantly.
394+
395+
###using adaptive link
396+
adaptive link will modify the bitrate to keep link alive, it still exprimental stage
397+
step 1 : download from github https://github.com/carabidulebabat/CaraSandbox/blob/main/ap_alink.sh
398+
step 2 : modify rc.local in /etc/ folder and add before exit 0
399+
```bash
400+
/etc/ap_alink.sh &
401+
````
402+
save the file
403+
step 3 : go to putty and type
404+
405+
````bash
406+
chmod +x /etc/ap_alink.sh
407+
```
408+
409+
Now lets see the different setting, cause its experimental we can play with various parametrer
410+
411+
bitrate=30 is the default bitrate, when its boot it will start at 30mbps
412+
bitratemax is the max bitrate allowed, majestic will not go higher than this value
413+
default value is bitrate 30 and max 40, its good if you have a radxa gs with good wifi card, if your on android try lower value like
414+
415+
```bash
416+
bitrate=4
417+
bitratemax=10
418+
````
419+
420+
power is not adaptive yet
421+
422+
get_dynamic_interval() {
423+
dbm=$(get_dbm)
424+
echo $(awk -v d="$dbm" 'BEGIN {
425+
if (d > -40) print 8;
426+
else if (d > -65) print 6;
427+
else if (d > -75) print 4;
428+
else if (d > -85) print 2;
429+
else print 1;
430+
}')
431+
}
432+
this function allow to increase the bitrate faster or lower depends on link quality in dbm you can modify the d value to set the sensitivity of ap alink
433+
434+
get_dynamic_decrease() {
435+
dbm=$(get_dbm)
436+
echo $(awk -v d="$dbm" 'BEGIN {
437+
if (d > -60) print 2;
438+
else if (d > -75) print 5;
439+
else if (d > -85) print 15;
440+
else print 20;
441+
}')
442+
}
443+
444+
same thing at get dynamic interval will lower bitrate faster or lower depends of link quality.
445+
446+
I suggest to try different value for d > dbm and see in flight
447+
you can killall ap_alink.sh and type sh /etc/ap_alink.sh to execute script with log, log will show current bitrate, interval and dbm
448+
thats all for the moment
449+

0 commit comments

Comments
 (0)