From 64c83f6651283f973f50adcfdf5bb8d4f47565c0 Mon Sep 17 00:00:00 2001 From: cronyx Date: Mon, 12 Dec 2022 17:28:23 +0300 Subject: [PATCH] fpv build improvements (#588) --- .../configs/gk7205v200_fpv_defconfig | 3 +- .../configs/gk7205v300_fpv_defconfig | 3 +- .../configs/hi3516ev200_fpv_defconfig | 3 +- .../configs/hi3516ev300_fpv_defconfig | 3 +- general/package/wifibroadcast/files/S98wfb | 1 - general/package/wifibroadcast/files/telemetry | 2 ++ .../wifibroadcast/files/telemetry.conf | 4 ++- general/package/wifibroadcast/files/tweaksys | 36 ++++++++++++------- 8 files changed, 37 insertions(+), 18 deletions(-) diff --git a/br-ext-chip-goke/configs/gk7205v200_fpv_defconfig b/br-ext-chip-goke/configs/gk7205v200_fpv_defconfig index 4871aaad..7a9eaecd 100644 --- a/br-ext-chip-goke/configs/gk7205v200_fpv_defconfig +++ b/br-ext-chip-goke/configs/gk7205v200_fpv_defconfig @@ -100,7 +100,8 @@ BR2_PACKAGE_RTL8812AU_OPENIPC=y # FPV BR2_PACKAGE_WIFIBROADCAST=y -BR2_PACKAGE_MAVLINK_ROUTER=y +# BR2_PACKAGE_MAVLINK_ROUTER is not set +BR2_PACKAGE_MAVFWD=y # DEBUG BR2_PACKAGE_HOST_GDB=y diff --git a/br-ext-chip-goke/configs/gk7205v300_fpv_defconfig b/br-ext-chip-goke/configs/gk7205v300_fpv_defconfig index 672323ea..b0f55d56 100644 --- a/br-ext-chip-goke/configs/gk7205v300_fpv_defconfig +++ b/br-ext-chip-goke/configs/gk7205v300_fpv_defconfig @@ -100,7 +100,8 @@ BR2_PACKAGE_RTL8812AU_OPENIPC=y # FPV BR2_PACKAGE_WIFIBROADCAST=y -BR2_PACKAGE_MAVLINK_ROUTER=y +# BR2_PACKAGE_MAVLINK_ROUTER is not set +BR2_PACKAGE_MAVFWD=y # DEBUG BR2_PACKAGE_HOST_GDB=y diff --git a/br-ext-chip-hisilicon/configs/hi3516ev200_fpv_defconfig b/br-ext-chip-hisilicon/configs/hi3516ev200_fpv_defconfig index 601e2560..b4da1dca 100644 --- a/br-ext-chip-hisilicon/configs/hi3516ev200_fpv_defconfig +++ b/br-ext-chip-hisilicon/configs/hi3516ev200_fpv_defconfig @@ -100,7 +100,8 @@ BR2_PACKAGE_RTL8812AU_OPENIPC=y # FPV BR2_PACKAGE_WIFIBROADCAST=y -BR2_PACKAGE_MAVLINK_ROUTER=y +# BR2_PACKAGE_MAVLINK_ROUTER is not set +BR2_PACKAGE_MAVFWD=y # DEBUG BR2_PACKAGE_HOST_GDB=y diff --git a/br-ext-chip-hisilicon/configs/hi3516ev300_fpv_defconfig b/br-ext-chip-hisilicon/configs/hi3516ev300_fpv_defconfig index b3cf11f4..71ab3cf4 100644 --- a/br-ext-chip-hisilicon/configs/hi3516ev300_fpv_defconfig +++ b/br-ext-chip-hisilicon/configs/hi3516ev300_fpv_defconfig @@ -100,7 +100,8 @@ BR2_PACKAGE_RTL8812AU_OPENIPC=y # FPV BR2_PACKAGE_WIFIBROADCAST=y -BR2_PACKAGE_MAVLINK_ROUTER=y +# BR2_PACKAGE_MAVLINK_ROUTER is not set +BR2_PACKAGE_MAVFWD=y # DEBUG BR2_PACKAGE_HOST_GDB=y diff --git a/general/package/wifibroadcast/files/S98wfb b/general/package/wifibroadcast/files/S98wfb index aee7967f..986faeb1 100755 --- a/general/package/wifibroadcast/files/S98wfb +++ b/general/package/wifibroadcast/files/S98wfb @@ -87,7 +87,6 @@ case "$1" in # UART2_RX mux devmem 0x120c0010 32 0x1e04 fi - /usr/bin/mavlink-routerd & /usr/bin/telemetry start fi diff --git a/general/package/wifibroadcast/files/telemetry b/general/package/wifibroadcast/files/telemetry index c8aa66cb..f73a338a 100755 --- a/general/package/wifibroadcast/files/telemetry +++ b/general/package/wifibroadcast/files/telemetry @@ -23,6 +23,8 @@ case "$1" in start) echo "Loading MAVLink telemetry service..." + mavfwd --master ${serial} --baudrate ${baud} --out 127.0.0.1:${port_tx} --in 127.0.0.1:${port_rx} & + start_telemetry echo "Done." diff --git a/general/package/wifibroadcast/files/telemetry.conf b/general/package/wifibroadcast/files/telemetry.conf index 95953f29..7ecc519b 100644 --- a/general/package/wifibroadcast/files/telemetry.conf +++ b/general/package/wifibroadcast/files/telemetry.conf @@ -1,3 +1,5 @@ +serial=/dev/ttyAMA0 +baud=115200 wlan=wlan0 bandwidth=20 stbc=1 @@ -12,4 +14,4 @@ fec_k=1 fec_n=2 fec_timeout=0 guard_interval=long -one_way=true +one_way=false diff --git a/general/package/wifibroadcast/files/tweaksys b/general/package/wifibroadcast/files/tweaksys index c490957e..95d5c0bb 100755 --- a/general/package/wifibroadcast/files/tweaksys +++ b/general/package/wifibroadcast/files/tweaksys @@ -27,8 +27,6 @@ all_other() { # change fps 25 -> 30 sed -i "s!Isp_FrameRate=25!Isp_FrameRate=30!g" /etc/sensors/imx307_i2c_2l_1080p.ini sed -i "s!Isp_FrameRate=25!Isp_FrameRate=30!g" /etc/sensors/smtsec_imx307_i2c_4l_1080p.ini - # disable mavlink routerd autostart - sed -i "s!/usr/bin/mavlink-routerd &!#/usr/bin/mavlink-routerd &!g" /etc/init.d/S97mavlink # majestic basic settings ${cli} -s .isp.slowShutter disabled ${cli} -s .isp.drc 350 @@ -36,18 +34,17 @@ all_other() { # ${cli} -s .isp.dis true ${cli} -s .image.contrast 50 ${cli} -s .image.luminance 50 - ${cli} -s .video0.bitrate 4096 + ${cli} -s .video0.bitrate 5120 ${cli} -s .video0.codec h264 ${cli} -s .video0.rcMode cbr - ${cli} -s .video0.gopSize 0.1 + ${cli} -s .video0.gopSize 0 ${cli} -s .hls.enabled false ${cli} -s .netip.enabled false - ${cli} -s .rtsp.enabled false ${cli} -s .jpeg.enabled false # lowdelay support only imx307 sensor if [ ${sensor} = "imx307" ]; then - ${cli} -s .video0.size 1920x1080 - ${cli} -s .video0.fps 30 + # ${cli} -s .video0.size 1280x720 + # ${cli} -s .video0.fps 30 ${cli} -s .isp.lowDelay true # ${cli} -s .video0.sliceUnits 4 fi @@ -65,21 +62,36 @@ EOF case "$1" in gk7205v200 | hi3516ev200) echo "Preparing system tweaks for ${chip}..." - # set osmem - fw_setenv osmem 40M - # change uart2 to uart0 (uart2 used by default [RX ONLY!] If you need two way, use uart0) - #sed -i "s!Device = /dev/ttyAMA2!Device = /dev/ttyAMA0!g" /etc/mavlink.conf - #sed -i "s!console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL!#console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL!g" /etc/inittab + + # set custom config + if [ ${chip} = "gk7205v200" ] && [ ${sensor} = "imx307" ]; then + echo "switch to custom sensor config" + # ${cli} -s .isp.sensorConfig /etc/sensors/60fps/720p_imx307_i2c_2l.ini + fi + + # fix osmem in bootargs + bootargs=$(fw_printenv -n bootargs) + if echo ${bootargs} | grep -q "32M"; then + newbootargs="mem=\${osmem} "$(echo ${bootargs} | cut -d " " -f2-) + fw_setenv bootargs ${newbootargs} + fw_setenv osmem 40M + fi + + sed -i "s!console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL!#console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL!g" /etc/inittab + # remove unneeded to reduce some memory rm -f /etc/init.d/S60crond /etc/init.d/S49ntpd /etc/init.d/S02klogd + all_other ;; gk7205v300 | hi3516ev300) echo "Preparing system tweaks for ${chip}..." + # set sensor config for smtsec board if [ ${chip} = "gk7205v300" ] && [ ${sensor} = "imx307" ]; then ${cli} -s .isp.sensorConfig /etc/sensors/smtsec_imx307_i2c_4l_1080p.ini fi + all_other ;; *)