Skip to content

Commit

Permalink
[fpv] some modifications (#1139)
Browse files Browse the repository at this point in the history
  • Loading branch information
cronyx authored Nov 14, 2023
1 parent a8b6bcb commit 568abb2
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 45 deletions.
77 changes: 42 additions & 35 deletions general/package/datalink/files/tweaksys
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ if ! [ ${chip} = "hi3536dv100" ]; then
sensor=$(ipcinfo -s)
fi

basic() {
# set boot delay
fw_setenv bootdelay 0
# don't load f2fs module (disabled in kernel)
sed -i "s!f2fs!#f2fs!g" /etc/modules
# freely uart for telemetry
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

# tune socket buffer
echo "net.core.rmem_default=512000" >> /etc/sysctl.conf
}

prefix=${family}

hisi_goke() {
Expand All @@ -27,6 +39,7 @@ hisi_goke() {
# 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
sed -i "s!Isp_FrameRate=25!Isp_FrameRate=30!g" /etc/sensors/imx335_i2c_4M.ini
}

sigmastar() {
Expand All @@ -35,49 +48,42 @@ sigmastar() {
}

majestic_generic() {
# majestic basic settings
cli -s .isp.slowShutter disabled
cli -s .isp.drc 350
# enable digital image stabilization
# cli -s .isp.dis true
cli -s .image.contrast 50
cli -s .image.luminance 50
cli -s .video0.bitrate 4096
cli -s .video0.size 1920x1080
cli -s .video0.fps 30
cli -s .video0.bitrate 5120
cli -s .video0.codec h264
cli -s .video0.rcMode cbr
cli -s .video0.gopSize 1
cli -s .hls.enabled false
cli -s .netip.enabled false
cli -s .jpeg.enabled false
cli -s .video0.gopSize 1.5
# lowdelay support only imx307 sensor
if [ ${sensor} = "imx307" ]; then
cli -s .video0.size 1280x720
cli -s .video0.gopSize 0.2
# cli -s .video0.fps 30
cli -s .isp.lowDelay true
# cli -s .video0.sliceUnits 4
fi
if [ ${sensor} = "imx335" ]; then
cli -s .isp.drc 350
cli -s .isp.sensorConfig /etc/sensors/imx335_i2c_4M.ini
fi
cli -s .hls.enabled false
cli -s .netip.enabled false
cli -s .jpeg.enabled false
}

majestic_sigmastar() {
cli -s .isp.exposure 10
cli -s .isp.aGain 8
cli -s .isp.dGain 8
cli -s .video0.size 1920x1080
cli -s .video0.fps 90
cli -s .video0.rcMode cbr
cli -s .jpeg.enabled false
}

all_other() {
# set boot delay
fw_setenv bootdelay 0
# don't load f2fs module (disabled in kernel)
sed -i "s!f2fs!#f2fs!g" /etc/modules
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
if [ -f /usr/bin/mavlink-routerd ]; then
# disable mavlink routerd autostart
sed -i "s!/usr/bin/mavlink-routerd &!#/usr/bin/mavlink-routerd &!g" /etc/init.d/S97mavlink
fi
streamer() {
if [ -f /usr/bin/majestic ]; then
if [ ${vendor} = "sigmastar" ]; then
majestic_sigmastar
Expand All @@ -89,15 +95,16 @@ all_other() {
cli -s .outgoing.server udp://127.0.0.1:5600
fi

# tune socket buffer
cat >> /etc/sysctl.conf << EOF
net.core.rmem_default=524288
net.core.rmem_max=2048000
EOF
if [ -f /usr/bin/venc ]; then
if [ ${sensor} = "imx335" ]; then
sed -i "s!version=200_imx307B!version=300_imx335B!g" /etc/venc.conf
sed -i "s!size=720p!size=1292x972!g" /etc/venc.conf
fi
fi
}

finish() {
# complete tweaks
# complete tweaks and add marker
touch /etc/system.ok
echo "Preparing system done."
reboot
Expand All @@ -124,8 +131,9 @@ case "$1" in
# remove unneeded to reduce some memory
rm -f /etc/init.d/S60crond /etc/init.d/S49ntpd /etc/init.d/S02klogd

basic
hisi_goke
all_other
streamer
finish
;;
gk7205v300 | hi3516ev300)
Expand All @@ -139,30 +147,29 @@ case "$1" in
cli -s .isp.sensorConfig /etc/sensors/smtsec_imx307_i2c_4l_1080p.ini
fi

basic
hisi_goke
all_other
streamer
finish
;;
t31l | t31n | t31x | t31zx)
echo "Preparing system tweaks for ${chip}..."

all_other
basic
streamer
finish
;;
hi3536dv100)
echo "Preparing system tweaks for ${chip}..."

if [ -f /usr/bin/mavlink-routerd ]; then
# disable mavlink routerd autostart
sed -i "s!/usr/bin/mavlink-routerd &!#/usr/bin/mavlink-routerd &!g" /etc/init.d/S97mavlink
fi

finish
;;
ssc33x)
echo "Preparing system tweaks for ${chip}..."

basic
sigmastar
all_other
streamer
finish
;;
*)
Expand Down
4 changes: 2 additions & 2 deletions general/package/mavlink-router/mavlink-router.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ define MAVLINK_ROUTER_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc
cp $(MAVLINK_ROUTER_PKGDIR)/files/mavlink_$(MAVLINK_ROUTER_UNIT).conf $(TARGET_DIR)/etc/mavlink.conf

$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
cp $(MAVLINK_ROUTER_PKGDIR)/files/S97mavlink $(TARGET_DIR)/etc/init.d
# $(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
# cp $(MAVLINK_ROUTER_PKGDIR)/files/S97mavlink $(TARGET_DIR)/etc/init.d
endef

$(eval $(generic-package))
2 changes: 1 addition & 1 deletion general/package/vdec-openipc/files/S98vdec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi
case "$1" in
start)
echo "Starting vdec decoder service..."
vdec -p ${port} -d ${format} -c ${codec} -m ${mode} --bg-r ${bg_r} --bg-g ${bg_g} --bg-b ${bg_b} --mavlink-port ${mavlink_port} ${osd_variant} > /dev/null 2>&1 &
vdec -p ${port} -d ${format} -c ${codec} -m ${mode} --mavlink-port ${mavlink_port} ${osd_variant} ${extra} > /dev/null 2>&1 &
sleep 3
if [ ${osd} = "custom" ]; then
osd > /dev/null 2>&1 &
Expand Down
26 changes: 22 additions & 4 deletions general/package/vdec-openipc/files/vdec.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ format=frame
# 1024x768x60 - 1024 x 768 @ 60 fps
# 1366x768x60 - 1366 x 768 @ 60 fps
# 1280x1024x60 - 1280 x 1024 @ 60 fps
# 1600x1200x60 - 1600 x 1200 @ 60 fps
# 2560x1440x30 - 2560 x 1440 @ 30 fps

mode=720p60

Expand All @@ -27,8 +29,24 @@ mavlink_port=14750

osd=simple

### Background color components (RGB)
Extra param (write in one line split by space):

bg_r=30
bg_g=0
bg_b=30
# --ar [mode] - Aspect ratio mode (Default: keep)
# keep - Keep stream aspect ratio
# stretch - Stretch to output resolution
# manual - Manual image size definition

# --ar-bg-r [Value] - Fill color red component (Default: 0)
# --ar-bg-g [Value] - Fill color green component (Default: 0)
# --ar-bg-b [Value] - Fill color blue component (Default: 0)

# --ar-x [Value] - Image position X
# --ar-y [Value] - Image position Y
# --ar-w [Value] - Image width
# --ar-h [Value] - Image height

# --bg-r [Value] - Background color red (Default: 0)
# --bg-g [Value] - Background color green (Default: 96)
# --bg-b [Value] - Background color blue (Default: 0)

extra="--bg-r 30 --bg-g 0 --bg-b 30"
4 changes: 3 additions & 1 deletion general/package/venc-openipc/files/venc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
# 300_imx307F - v300, IMX307, 4-lane MIPI | 1080p | 30 fps only
#
# GK7205v300 / IMX335
# 300_imx335F - v300, IMX335, 4-lane MIPI | 4MP | 30 fps only
# 300_imx335F4 - v300, IMX335, 4-lane MIPI | 2592x1520 | 25 fps only
# 300_imx335F5 - v300, IMX335, 4-lane MIPI | 2592x1944 | 25 fps only
# 300_imx335B - v300, IMX335, 4-lane MIPI | 1292x972 | 30 / 60 fps only

version=200_imx307B

Expand Down
1 change: 1 addition & 0 deletions general/package/wifibroadcast/files/drone.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
���n��j�������+ܗ�� G�_���{FĊa��p�tzf�<�@�k���QSz��t�c
1 change: 1 addition & 0 deletions general/package/wifibroadcast/files/gs.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�hCң���֓d�'�Y�:��NZV8�V���l3q��ar�@�X"'P#ʞHY�v�c;ƤS��^
2 changes: 1 addition & 1 deletion general/package/wifibroadcast/files/wfb_drone.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
unit=drone

wlan=wlan0
region=BO
region=00
### By default used channel number, but, you may set freq instead. For ex: 2387M
channel=14
frequency=
Expand Down
2 changes: 1 addition & 1 deletion general/package/wifibroadcast/files/wfb_gs.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
unit=gs

wlan=wlan0
region=BO
region=00
### By default used channel number, but, you may set freq instead. For ex: 2387M
channel=14
frequency=
Expand Down
3 changes: 3 additions & 0 deletions general/package/wifibroadcast/wifibroadcast.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ define WIFIBROADCAST_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
cp $(WIFIBROADCAST_PKGDIR)/files/wifibroadcast $(TARGET_DIR)/usr/bin

$(INSTALL) -m 755 -d $(TARGET_DIR)/etc
cp $(WIFIBROADCAST_PKGDIR)/files/$(WIFIBROADCAST_UNIT).key $(TARGET_DIR)/etc/$(WIFIBROADCAST_UNIT).key

$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin
cp $(WIFIBROADCAST_PKGDIR)/files/setmcs $(TARGET_DIR)/usr/bin

Expand Down

0 comments on commit 568abb2

Please sign in to comment.