diff --git a/Configurator.Designer.vb b/Configurator.Designer.vb index 923708f..649e7c3 100644 --- a/Configurator.Designer.vb +++ b/Configurator.Designer.vb @@ -47,6 +47,8 @@ Partial Class Configurator txtPower24 = New TextBox() TabControl1 = New TabControl() TabPage1 = New TabPage() + cmbBandwidth = New ComboBox() + txtBandwidth = New TextBox() btnRestartWFB = New Button() ComboBox9 = New ComboBox() ComboBox8 = New ComboBox() @@ -203,6 +205,7 @@ Partial Class Configurator BackgroundWorker1 = New ComponentModel.BackgroundWorker() Timer1 = New Timer(components) version = New Label() + btn40MHz = New Button() TabControl1.SuspendLayout() TabPage1.SuspendLayout() TabPage2.SuspendLayout() @@ -389,7 +392,7 @@ Partial Class Configurator txtMCS.BackColor = Color.FromArgb(CByte(45), CByte(45), CByte(45)) txtMCS.BorderStyle = BorderStyle.FixedSingle txtMCS.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) - txtMCS.Location = New Point(248, 136) + txtMCS.Location = New Point(248, 162) txtMCS.Name = "txtMCS" txtMCS.ReadOnly = True txtMCS.Size = New Size(325, 20) @@ -400,7 +403,7 @@ Partial Class Configurator txtLDPC.BackColor = Color.FromArgb(CByte(45), CByte(45), CByte(45)) txtLDPC.BorderStyle = BorderStyle.FixedSingle txtLDPC.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) - txtLDPC.Location = New Point(248, 194) + txtLDPC.Location = New Point(248, 220) txtLDPC.Name = "txtLDPC" txtLDPC.ReadOnly = True txtLDPC.Size = New Size(325, 20) @@ -411,7 +414,7 @@ Partial Class Configurator txtSTBC.BackColor = Color.FromArgb(CByte(45), CByte(45), CByte(45)) txtSTBC.BorderStyle = BorderStyle.FixedSingle txtSTBC.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) - txtSTBC.Location = New Point(248, 165) + txtSTBC.Location = New Point(248, 191) txtSTBC.Name = "txtSTBC" txtSTBC.ReadOnly = True txtSTBC.Size = New Size(325, 20) @@ -422,7 +425,7 @@ Partial Class Configurator txtFECN.BackColor = Color.FromArgb(CByte(45), CByte(45), CByte(45)) txtFECN.BorderStyle = BorderStyle.FixedSingle txtFECN.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) - txtFECN.Location = New Point(248, 252) + txtFECN.Location = New Point(248, 278) txtFECN.Name = "txtFECN" txtFECN.ReadOnly = True txtFECN.Size = New Size(325, 20) @@ -433,7 +436,7 @@ Partial Class Configurator txtFECK.BackColor = Color.FromArgb(CByte(45), CByte(45), CByte(45)) txtFECK.BorderStyle = BorderStyle.FixedSingle txtFECK.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) - txtFECK.Location = New Point(248, 223) + txtFECK.Location = New Point(248, 249) txtFECK.Name = "txtFECK" txtFECK.ReadOnly = True txtFECK.Size = New Size(325, 20) @@ -471,6 +474,8 @@ Partial Class Configurator ' TabPage1 ' TabPage1.BackColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + TabPage1.Controls.Add(cmbBandwidth) + TabPage1.Controls.Add(txtBandwidth) TabPage1.Controls.Add(btnRestartWFB) TabPage1.Controls.Add(ComboBox9) TabPage1.Controls.Add(ComboBox8) @@ -497,6 +502,28 @@ Partial Class Configurator TabPage1.TabIndex = 0 TabPage1.Text = "WFB Settings" ' + ' cmbBandwidth + ' + cmbBandwidth.BackColor = Color.FromArgb(CByte(45), CByte(45), CByte(45)) + cmbBandwidth.FlatStyle = FlatStyle.Popup + cmbBandwidth.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) + cmbBandwidth.FormattingEnabled = True + cmbBandwidth.Location = New Point(19, 134) + cmbBandwidth.Name = "cmbBandwidth" + cmbBandwidth.Size = New Size(214, 22) + cmbBandwidth.TabIndex = 47 + ' + ' txtBandwidth + ' + txtBandwidth.BackColor = Color.FromArgb(CByte(45), CByte(45), CByte(45)) + txtBandwidth.BorderStyle = BorderStyle.FixedSingle + txtBandwidth.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) + txtBandwidth.Location = New Point(248, 135) + txtBandwidth.Name = "txtBandwidth" + txtBandwidth.ReadOnly = True + txtBandwidth.Size = New Size(325, 20) + txtBandwidth.TabIndex = 46 + ' ' btnRestartWFB ' btnRestartWFB.BackColor = Color.Gold @@ -516,7 +543,7 @@ Partial Class Configurator ComboBox9.FlatStyle = FlatStyle.Popup ComboBox9.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) ComboBox9.FormattingEnabled = True - ComboBox9.Location = New Point(19, 252) + ComboBox9.Location = New Point(19, 278) ComboBox9.Name = "ComboBox9" ComboBox9.Size = New Size(214, 22) ComboBox9.TabIndex = 34 @@ -527,7 +554,7 @@ Partial Class Configurator ComboBox8.FlatStyle = FlatStyle.Popup ComboBox8.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) ComboBox8.FormattingEnabled = True - ComboBox8.Location = New Point(19, 223) + ComboBox8.Location = New Point(19, 249) ComboBox8.Name = "ComboBox8" ComboBox8.Size = New Size(214, 22) ComboBox8.TabIndex = 33 @@ -538,7 +565,7 @@ Partial Class Configurator ComboBox7.FlatStyle = FlatStyle.Popup ComboBox7.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) ComboBox7.FormattingEnabled = True - ComboBox7.Location = New Point(19, 194) + ComboBox7.Location = New Point(19, 220) ComboBox7.Name = "ComboBox7" ComboBox7.Size = New Size(214, 22) ComboBox7.TabIndex = 32 @@ -549,7 +576,7 @@ Partial Class Configurator ComboBox6.FlatStyle = FlatStyle.Popup ComboBox6.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) ComboBox6.FormattingEnabled = True - ComboBox6.Location = New Point(19, 165) + ComboBox6.Location = New Point(19, 191) ComboBox6.Name = "ComboBox6" ComboBox6.Size = New Size(214, 22) ComboBox6.TabIndex = 31 @@ -560,7 +587,7 @@ Partial Class Configurator ComboBox5.FlatStyle = FlatStyle.Popup ComboBox5.ForeColor = Color.FromArgb(CByte(224), CByte(224), CByte(224)) ComboBox5.FormattingEnabled = True - ComboBox5.Location = New Point(19, 136) + ComboBox5.Location = New Point(19, 162) ComboBox5.Name = "ComboBox5" ComboBox5.Size = New Size(214, 22) ComboBox5.TabIndex = 30 @@ -813,6 +840,7 @@ Partial Class Configurator ' TabPage3 ' TabPage3.BackColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + TabPage3.Controls.Add(btn40MHz) TabPage3.Controls.Add(btnMSPExtra) TabPage3.Controls.Add(rBtnRECOFF) TabPage3.Controls.Add(rBtnRECON) @@ -848,20 +876,21 @@ Partial Class Configurator btnMSPExtra.BackColor = Color.Gold btnMSPExtra.FlatStyle = FlatStyle.Popup btnMSPExtra.Font = New Font("Arial", 7F, FontStyle.Bold) - btnMSPExtra.Location = New Point(454, 179) + btnMSPExtra.Location = New Point(454, 316) btnMSPExtra.Name = "btnMSPExtra" btnMSPExtra.Size = New Size(116, 22) btnMSPExtra.TabIndex = 66 btnMSPExtra.Text = "Add MSPOSD EXTRA" btnToolTip.SetToolTip(btnMSPExtra, "1) Add OSD SOC temperature" & vbCrLf & "2) Set low delay for the channels.sh switches") btnMSPExtra.UseVisualStyleBackColor = False + btnMSPExtra.Visible = False ' ' rBtnRECOFF ' rBtnRECOFF.AutoSize = True rBtnRECOFF.Checked = True rBtnRECOFF.ForeColor = Color.White - rBtnRECOFF.Location = New Point(547, 220) + rBtnRECOFF.Location = New Point(547, 193) rBtnRECOFF.Name = "rBtnRECOFF" rBtnRECOFF.Size = New Size(45, 18) rBtnRECOFF.TabIndex = 65 @@ -874,7 +903,7 @@ Partial Class Configurator ' rBtnRECON.AutoSize = True rBtnRECON.ForeColor = Color.White - rBtnRECON.Location = New Point(547, 205) + rBtnRECON.Location = New Point(547, 178) rBtnRECON.Name = "rBtnRECON" rBtnRECON.Size = New Size(40, 18) rBtnRECON.TabIndex = 64 @@ -887,7 +916,7 @@ Partial Class Configurator btnOnboardREC.BackColor = Color.Gold btnOnboardREC.FlatStyle = FlatStyle.Popup btnOnboardREC.Font = New Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, CByte(0)) - btnOnboardREC.Location = New Point(454, 207) + btnOnboardREC.Location = New Point(454, 180) btnOnboardREC.Name = "btnOnboardREC" btnOnboardREC.Size = New Size(87, 30) btnOnboardREC.TabIndex = 63 @@ -914,13 +943,14 @@ Partial Class Configurator btnFontsINAV.BackColor = Color.Gold btnFontsINAV.FlatStyle = FlatStyle.Popup btnFontsINAV.Font = New Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, CByte(0)) - btnFontsINAV.Location = New Point(454, 143) + btnFontsINAV.Location = New Point(454, 280) btnFontsINAV.Name = "btnFontsINAV" btnFontsINAV.Size = New Size(116, 30) btnFontsINAV.TabIndex = 59 btnFontsINAV.Text = "Upload INAV Fonts" btnToolTip.SetToolTip(btnFontsINAV, "Upload the fonts for INAV to the OpenIPC camera") btnFontsINAV.UseVisualStyleBackColor = False + btnFontsINAV.Visible = False ' ' btnMSP ' @@ -931,8 +961,8 @@ Partial Class Configurator btnMSP.Name = "btnMSP" btnMSP.Size = New Size(116, 30) btnMSP.TabIndex = 56 - btnMSP.Text = "Upload MSPOSD" - btnToolTip.SetToolTip(btnMSP, resources.GetString("btnMSP.ToolTip")) + btnMSP.Text = "Latest VTXMENU" + btnToolTip.SetToolTip(btnMSP, "Upload the latest vtxmenu for the MSPOSD of OpenIPC" & vbCrLf & vbCrLf & "To enter the VTX menu move: " & vbCrLf & "LEFT stick to bottom right and" & vbCrLf & "RIGHT stick to bottom left") btnMSP.UseVisualStyleBackColor = False ' ' btnExtra @@ -2447,6 +2477,19 @@ Partial Class Configurator version.TabIndex = 48 version.Text = "v 1.7" ' + ' btn40MHz + ' + btn40MHz.BackColor = Color.Gold + btn40MHz.FlatStyle = FlatStyle.Popup + btn40MHz.Font = New Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, CByte(0)) + btn40MHz.Location = New Point(454, 144) + btn40MHz.Name = "btn40MHz" + btn40MHz.Size = New Size(116, 30) + btn40MHz.TabIndex = 67 + btn40MHz.Text = "Enable 40MHz" + btnToolTip.SetToolTip(btn40MHz, "Upload the modified wifibroadcast file to enable the 40MHz mode") + btn40MHz.UseVisualStyleBackColor = False + ' ' Configurator ' AutoScaleDimensions = New SizeF(7F, 15F) @@ -2676,5 +2719,8 @@ Partial Class Configurator Friend WithEvents GroupBox1 As GroupBox Friend WithEvents txtSOC As TextBox Friend WithEvents btnMSPExtra As Button + Friend WithEvents cmbBandwidth As ComboBox + Friend WithEvents txtBandwidth As TextBox + Friend WithEvents btn40MHz As Button End Class diff --git a/Configurator.resx b/Configurator.resx index 1986a22..0b4b3ee 100644 --- a/Configurator.resx +++ b/Configurator.resx @@ -120,16 +120,9 @@ 17, 17 - - Upload the latest MSPOSD of OpenIPC -Upload the fonts for Betaflight to the OpenIPC camera - -To enter the VTX menu move: -LEFT stick to bottom right and -RIGHT stick to bottom left - -MSPVTX is partially working, do NOT use - + + 17, 17 + Step 1: Select which VRX to use Step 2: Enter the VRX IP diff --git a/Configurator.vb b/Configurator.vb index 75b1eab..fb8da2e 100755 --- a/Configurator.vb +++ b/Configurator.vb @@ -209,6 +209,7 @@ err1: txtPower.Text = "" txtFreq24.Text = "" txtPower24.Text = "" + txtBandwidth.Text = "" txtMCS.Text = "" txtSTBC.Text = "" txtLDPC.Text = "" @@ -262,6 +263,7 @@ err1: txtPower.Text = ReadLine(10, WFBallLines) txtFreq24.Text = ReadLine(8, WFBallLines) txtPower24.Text = ReadLine(9, WFBallLines) + txtBandwidth.Text = ReadLine(11, WFBallLines) txtMCS.Text = ReadLine(14, WFBallLines) txtSTBC.Text = ReadLine(12, WFBallLines) txtLDPC.Text = ReadLine(13, WFBallLines) @@ -544,6 +546,11 @@ err1: ComboBox4.Items.Add("58") ComboBox4.Text = "Select 2.4GHz TX Power" + cmbBandwidth.Items.Clear() + cmbBandwidth.Items.Add("20") + cmbBandwidth.Items.Add("40") + cmbBandwidth.Text = "Select Channel Bandwidth" + ComboBox5.Items.Clear() ComboBox5.Items.Add("0") ComboBox5.Items.Add("1") @@ -704,7 +711,17 @@ err1: cmbBitrate.Items.Add("17408") cmbBitrate.Items.Add("18432") cmbBitrate.Items.Add("19456") - cmbBitrate.Items.Add("19968") + cmbBitrate.Items.Add("20480") + cmbBitrate.Items.Add("21504") + cmbBitrate.Items.Add("22528") + cmbBitrate.Items.Add("23552") + cmbBitrate.Items.Add("24576") + cmbBitrate.Items.Add("25600") + cmbBitrate.Items.Add("26624") + cmbBitrate.Items.Add("27648") + cmbBitrate.Items.Add("28672") + cmbBitrate.Items.Add("29692") + cmbBitrate.Items.Add("30720") cmbBitrate.Text = "Select Bitrate" cmbExposure.Items.Clear() @@ -910,6 +927,10 @@ err1: txtPower24.Text = "txpower=" & ComboBox4.SelectedItem.ToString End Sub + Private Sub cmbBandwidth_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbBandwidth.SelectedIndexChanged + txtBandwidth.Text = "bandwidth=" & cmbBandwidth.SelectedItem.ToString + End Sub + Private Sub ComboBox5_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox5.SelectedIndexChanged txtMCS.Text = "mcs_index=" & ComboBox5.SelectedItem.ToString End Sub @@ -1080,6 +1101,7 @@ err1: txtPower.Text = "" txtFreq24.Text = "" txtPower24.Text = "" + txtBandwidth.Text = "" txtMCS.Text = "" txtSTBC.Text = "" txtLDPC.Text = "" @@ -1277,6 +1299,7 @@ err1: txtPower.Text = "" txtFreq24.Text = "" txtPower24.Text = "" + txtBandwidth.Text = "" txtMCS.Text = "" txtSTBC.Text = "" txtLDPC.Text = "" @@ -1431,6 +1454,7 @@ err1: txtPower.Text = "" txtFreq24.Text = "" txtPower24.Text = "" + txtBandwidth.Text = "" txtMCS.Text = "" txtSTBC.Text = "" txtLDPC.Text = "" @@ -1476,7 +1500,7 @@ err1: btnUART0.Visible = True btnUART0OFF.Visible = True btnExtra.Visible = True - btnMSPExtra.Visible = True + btnMSPExtra.Visible = False btnRestartWFB.Visible = True btnRestartMajestic.Visible = True ComboBox3.Visible = True @@ -1499,7 +1523,7 @@ err1: txtMavlinkVRX.Visible = True txtExtras.Visible = True btnMSP.Visible = True - btnFontsINAV.Visible = True + btnFontsINAV.Visible = False btnOnboardREC.Visible = True rBtnRECON.Visible = True rBtnRECOFF.Visible = True @@ -1585,6 +1609,7 @@ err1: txtPower.Text = "" txtFreq24.Text = "" txtPower24.Text = "" + txtBandwidth.Text = "" txtMCS.Text = "" txtSTBC.Text = "" txtLDPC.Text = "" @@ -2345,6 +2370,7 @@ err1: txtPower.Text = "" txtFreq24.Text = "" txtPower24.Text = "" + txtBandwidth.Text = "" txtMCS.Text = "" txtSTBC.Text = "" txtLDPC.Text = "" @@ -2514,6 +2540,9 @@ err1: If lines(x).StartsWith("txpower=") Then lines(x) = txtPower24.Text End If + If lines(x).StartsWith("bandwidth=") Then + lines(x) = txtBandwidth.Text + End If If rBtnNVR.Checked Then If lines(x).StartsWith("udp_addr=") Then lines(x) = txtMCS.Text @@ -3012,5 +3041,30 @@ err1: End If End Sub + Private Sub btn40MHz_Click(sender As Object, e As EventArgs) Handles btn40MHz.Click + Dim extern = "extern.bat" + Dim wifi_file = "reset/wifibroadcast" + If Not File.Exists(extern) Then + MsgBox("File " + extern + " not found!") + Return + End If + If Not File.Exists(wifi_file) Then + MsgBox("File " + wifi_file + " not found!") + Return + End If + + If IsValidIP(txtIP.Text) Then + With New Process() + .StartInfo.UseShellExecute = False + .StartInfo.FileName = extern + .StartInfo.Arguments = "40mhz " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text + .StartInfo.RedirectStandardOutput = False + .Start() + End With + Else + MsgBox("Please enter a valid IP address") + End If + End Sub + #End Region End Class diff --git a/Extern.bat b/Extern.bat index 35f1f91..5819485 100755 --- a/Extern.bat +++ b/Extern.bat @@ -107,11 +107,6 @@ if "%1" == "extra" ( plink -ssh root@%2 -pw %3 reboot ) -if "%1" == "mspextra" ( - plink -ssh root@%2 -pw %3 sed -i 's/echo \"Starting wifibroadcast service...\"/echo \"\&L70 \&F35 CPU:\&C \&B Temp:\&T\" ">"\/tmp\/MSPOSD.msg "\&"/' /etc/init.d/S98datalink - plink -ssh root@%2 -pw %3 reboot -) - if "%1" == "rswfb" ( plink -ssh root@%2 -pw %3 wifibroadcast stop plink -ssh root@%2 -pw %3 sleep 3 @@ -182,14 +177,15 @@ if "%1" == "offlinefw" ( ) if "%1" == "msp" ( - plink -ssh root@%2 -pw %3 killall -q msposd - echo y | pscp -scp -pw %3 msposd root@%2:/usr/bin/ - echo y | pscp -scp -pw %3 bf/font.png root@%2:/usr/share/fonts/ - echo y | pscp -scp -pw %3 bf/font_hd.png root@%2:/usr/share/fonts/ echo y | pscp -scp -pw %3 vtxmenu.ini root@%2:/etc/ plink -ssh root@%2 -pw %3 dos2unix /etc/vtxmenu.ini - plink -ssh root@%2 -pw %3 chmod +x /usr/bin/msposd - plink -ssh root@%2 -pw %3 sed -i '/router=/c\router=2' /etc/telemetry.conf + plink -ssh root@%2 -pw %3 reboot +) + + +if "%1" == "40mhz" ( + echo y | pscp -scp -pw %3 reset/wifibroadcast root@%2:/usr/bin/ + plink -ssh root@%2 -pw %3 dos2unix /usr/bin/wifibroadcast plink -ssh root@%2 -pw %3 reboot ) @@ -247,11 +243,6 @@ if "%1" == "addbuttons" ( plink -ssh root@%2 -pw %3 dos2unix /config/scripts/stream.sh ) -if "%1" == "fontsINAV" ( - echo y | pscp -scp -pw %3 inav/font.png root@%2:/usr/share/fonts/ - echo y | pscp -scp -pw %3 inav/font_hd.png root@%2:/usr/share/fonts/ -) - :end echo. pause diff --git a/reset/wifibroadcast b/reset/wifibroadcast new file mode 100644 index 0000000..fb5f067 --- /dev/null +++ b/reset/wifibroadcast @@ -0,0 +1,184 @@ +#!/bin/sh +chip=$(ipcinfo -c) +vendor=$(ipcinfo -v) +keydir=/etc + +if [ -e /etc/datalink.conf ]; then + . /etc/datalink.conf +fi + +if [ -e /etc/wfb.conf ]; then + . /etc/wfb.conf +fi + +set_mcs() { + if [ "$vendor" = "ingenic" ]; then + mcs=$(ls -l /lib/firmware | grep "htc_9271" | awk { 'print $11' } | cut -d "." -f3) + else + mcs=$(ls -l /lib/firmware/ath9k_htc | grep "htc_9271-1.4.0.fw" | cut -d "." -f6) + fi + + if [ -z "$mcs" ]; then + setmcs "$mcs_index" + fi + + if [ "$mcs_index" -eq 1 ] || [ "$mcs_index" -eq 3 ]; then + if [ ! "$mcs_index" -eq "$mcs" ]; then + setmcs "$mcs_index" + sleep 3 + fi + fi +} + +detect_wifi_card() { + devices=$(lsusb | cut -d ' ' -f6 | sort | uniq) + for card in $devices; do + case "$card" in + "0bda:8812" | "0bda:881a" | "0b05:17d2" | "2357:0101" | "2604:0012") + driver="88XXau" + modprobe 88XXau rtw_tx_pwr_idx_override="$driver_txpower_override" + ;; + + "0bda:a81a") + driver="8812eu" + modprobe 8812eu rtw_regd_src=1 rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0 + ;; + + "0bda:f72b") + driver="8733bu" + modprobe 8733bu rtw_regd_src=1 rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0 + ;; + + "0cf3:9271" | "040d:3801") + driver="ar9271" + if [ "$unit" != "gs" ]; then + set_mcs + fi + modprobe mac80211 + modprobe ath9k_hw txpower="$txpower" + modprobe ath9k_htc + ;; + esac + done + + if [ -z "$driver" ]; then + echo "Wireless module not detected, check the usb connection." + exit 1 + else + echo "Detected: $driver" + fi + + local n=0 + while ! ifconfig -a | grep -q "$wlan"; do + if [ "$n" -ge 5 ]; then + echo "No interface for $wlan, check the usb connection." + exit 1 + fi + sleep 0.5 + n=$((n + 1)) + done +} + +load_modules() { + modprobe cfg80211 + detect_wifi_card +} + +load_interface() { + if [ "$driver" = "ar9271" ]; then + iwconfig "$wlan" mode monitor + ifconfig "$wlan" up + else + ifconfig "$wlan" up + iwconfig "$wlan" mode monitor + fi + + if [ "$driver" = "8812eu" ] || [ "$driver" = "8733bu" ]; then + iw dev "$wlan" set txpower fixed $((driver_txpower_override * 50)) + fi + + iw reg set "$region" + + if [ -n "$frequency" ]; then + iwconfig "$wlan" freq "$frequency" + else + iwconfig "$wlan" channel "$channel" + fi +} + +start_drone_wfb() { + wfb_tx -p "$stream" -u "$udp_port" -R "$rcv_buf" -K "$keydir/$unit.key" -B "$bandwidth" \ + -M "$mcs_index" -S "$stbc" -L "$ldpc" -G "$guard_interval" -k "$fec_k" -n "$fec_n" \ + -T "$pool_timeout" -i "$link_id" -f "$frame_type" -C 8000 "$wlan" > /dev/null & +} + +start_gs_wfb() { + wfb_rx -c "$udp_addr" -u "$udp_port" -p "$stream" -K "$keydir/$unit.key" -i "$link_id" "$wlan" > /dev/null & +} + +start_tunnel_wfb() { + if [ ! -e /usr/bin/tunnel_rx ] || [ ! -e /usr/bin/tunnel_tx ]; then + ln -fs /usr/bin/wfb_rx /usr/bin/tunnel_rx + ln -fs /usr/bin/wfb_tx /usr/bin/tunnel_tx + fi + + tunnel_rx -p 160 -u 5800 -K "$keydir/$unit.key" -i "$link_id" "$wlan" > /dev/null & + tunnel_tx -p 32 -u 5801 -K "$keydir/$unit.key" -M "$mcs_index" -S "$stbc" -L "$ldpc" \ + -k "$fec_k" -n "$fec_n" -i "$link_id" "$wlan" > /dev/null & + wfb_tun -a 10.5.0.10/24 > /dev/null & +} + +case "$1" in + start) + if [ "$daemon" -eq 1 ]; then + echo "Loading modules and wireless driver..." + load_modules + load_interface + if [ "$bandwidth" = "40" ]; then + iw "$wlan" set channel "$channel" HT40+ + fi + if ! cat "$keydir/$unit.key" > /dev/null 2>&1; then + echo "Generating drone & ground station keys..." + cd $keydir && wfb_keygen + fi + + start_${unit}_wfb + + if [ "$telemetry" = "true" ]; then + if [ "$chip" = "gk7205v200" ]; then + devmem 0x120C0010 32 0x1E04 + elif [ "$chip" = "ssc33x" ]; then + devmem 0x1F207890 16 0x8 + fi + telemetry start + fi + + if [ "$tunnel" = "true" ]; then + start_tunnel_wfb + fi + else + echo "Wifibroadcast service disabled in wfb.conf" + fi + ;; + + stop) + echo "Stopping wifibroadcast service..." + killall -q wfb_tx + killall -q wfb_rx + + if [ "$telemetry" = "true" ]; then + telemetry stop + fi + + if [ "$tunnel" = "true" ]; then + killall -q tunnel_rx + killall -q tunnel_tx + killall -q wfb_tun + fi + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac diff --git a/vtxmenu.ini b/vtxmenu.ini index 1c94e24..ec3dd75 100644 --- a/vtxmenu.ini +++ b/vtxmenu.ini @@ -41,7 +41,7 @@ Submenu2=VTX MENU [VIDEO] Option1=SIZE:1280X720,1456x816,1920X1080,2720x1528,2944X1656,3200x1800,3840X2160:cli -g .video0.size | tr x X:cli -s .video0.size $(echo {} | tr X x) Option2=FPS:20,30,40,50,60,70,80,90,100,120:cli -g .video0.fps:cli -s .video0.fps {} -Option3=BITRATE:1024,2048,3072,4096,5120,6144,7168,8192,9216,10240,11264,12288,13312,14336,15360:cli -g .video0.bitrate:cli -s .video0.bitrate {} +Option3=BITRATE:1024,2048,3072,4096,5120,6144,7168,8192,9216,10240,11264,12288,13312,14336,15360,16384,17408,18432,19456,20480,21504,22528,23552,24576,25600,26624,27648,28672,29692,30720:cli -g .video0.bitrate:cli -s .video0.bitrate {} Option4=CODEC:H264,H265:cli -g .video0.codec | tr h H:cli -s .video0.codec $(echo {}| tr H h) Option5=GOPSIZE:0.1-20:cli -g .video0.gopSize:cli -s .video0.gopSize {} Option6=RCMODE:VBR,AVBR,CBR:cli -g .video0.rcMode | tr a-z A-Z:cli -s .video0.rcMode $(echo {}| tr A-Z a-z) @@ -70,6 +70,7 @@ Submenu2=VTX MENU [FPV] Option1=ENABLED:TRUE,FALSE:cli -g .fpv.enabled | tr a-z A-Z:cli -s .fpv.enabled $(echo {} | tr A-Z a-z) +Option2=NOISELEVEL:0,1:cli -g .fpv.noiseLevel:cli -s .fpv.noiseLevel {} Submenu1=CAMERA SETTINGS Submenu2=VTX MENU