diff --git a/Configurator.Designer.vb b/Configurator.Designer.vb index e4a27d2..72b48c6 100644 --- a/Configurator.Designer.vb +++ b/Configurator.Designer.vb @@ -108,6 +108,8 @@ Partial Class Configurator txtSerial = New TextBox() TabPage7 = New TabPage() GroupBox3 = New GroupBox() + namePreset = New TextBox() + createPreset = New Button() lblPreset = New TextBox() cmbPresets = New ComboBox() btnPreset = New Button() @@ -213,6 +215,7 @@ Partial Class Configurator btnReboot = New Button() txtPassword = New TextBox() connected = New PictureBox() + chkYAML = New CheckBox() rBtnCam = New RadioButton() rBtnNVR = New RadioButton() rBtnRadxaZero3w = New RadioButton() @@ -222,7 +225,6 @@ Partial Class Configurator Timer1 = New Timer(components) Label12 = New Label() Label13 = New Label() - chkYAML = New CheckBox() TabControl1.SuspendLayout() TabPage1.SuspendLayout() TabPage2.SuspendLayout() @@ -1268,6 +1270,8 @@ Partial Class Configurator ' ' GroupBox3 ' + GroupBox3.Controls.Add(namePreset) + GroupBox3.Controls.Add(createPreset) GroupBox3.Controls.Add(lblPreset) GroupBox3.Controls.Add(cmbPresets) GroupBox3.Controls.Add(btnPreset) @@ -1279,6 +1283,31 @@ Partial Class Configurator GroupBox3.TabStop = False GroupBox3.Text = "OpenIPC Camera Presets" ' + ' namePreset + ' + namePreset.BackColor = Color.FromArgb(CByte(45), CByte(45), CByte(45)) + namePreset.BorderStyle = BorderStyle.FixedSingle + namePreset.Font = New Font("Arial", 8.25F, FontStyle.Bold) + namePreset.ForeColor = Color.FromArgb(CByte(244), CByte(244), CByte(244)) + namePreset.Location = New Point(162, 362) + namePreset.Name = "namePreset" + namePreset.Size = New Size(336, 20) + namePreset.TabIndex = 68 + btnToolTip.SetToolTip(namePreset, "Type the name of your preset." & vbCrLf & "If no name given it will be named custom_XXX.bat") + ' + ' createPreset + ' + createPreset.BackColor = Color.Gold + createPreset.FlatStyle = FlatStyle.Popup + createPreset.ForeColor = SystemColors.ControlText + createPreset.Location = New Point(11, 359) + createPreset.Name = "createPreset" + createPreset.Size = New Size(145, 23) + createPreset.TabIndex = 67 + createPreset.Text = "Create Custom Preset" + btnToolTip.SetToolTip(createPreset, "Create a Custom Preset with the current loaded settings" & vbCrLf) + createPreset.UseVisualStyleBackColor = False + ' ' lblPreset ' lblPreset.BackColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) @@ -1309,9 +1338,9 @@ Partial Class Configurator btnPreset.BackColor = Color.Gold btnPreset.FlatStyle = FlatStyle.Popup btnPreset.ForeColor = SystemColors.ControlText - btnPreset.Location = New Point(488, 359) + btnPreset.Location = New Point(504, 359) btnPreset.Name = "btnPreset" - btnPreset.Size = New Size(159, 23) + btnPreset.Size = New Size(143, 23) btnPreset.TabIndex = 64 btnPreset.Text = "Apply Selected Preset" btnToolTip.SetToolTip(btnPreset, "Apply the Selected Preset" & vbCrLf) @@ -2633,6 +2662,18 @@ Partial Class Configurator connected.TabStop = False btnToolTip.SetToolTip(connected, "Green = pinged and ready to connect" & vbCrLf & "Red = pinged and remote side unreachable") ' + ' chkYAML + ' + chkYAML.AutoSize = True + chkYAML.ForeColor = Color.White + chkYAML.Location = New Point(334, 474) + chkYAML.Name = "chkYAML" + chkYAML.Size = New Size(116, 19) + chkYAML.TabIndex = 60 + chkYAML.Text = "YAML file system" + btnToolTip.SetToolTip(chkYAML, "Enables the new YAML file system.") + chkYAML.UseVisualStyleBackColor = True + ' ' rBtnCam ' rBtnCam.AutoSize = True @@ -2704,7 +2745,7 @@ Partial Class Configurator Label12.Name = "Label12" Label12.Size = New Size(41, 10) Label12.TabIndex = 51 - Label12.Text = "26/02/2025" + Label12.Text = "27/02/2025" ' ' Label13 ' @@ -2717,18 +2758,6 @@ Partial Class Configurator Label13.TabIndex = 52 Label13.Text = "SBC v1.9.7" ' - ' chkYAML - ' - chkYAML.AutoSize = True - chkYAML.ForeColor = Color.White - chkYAML.Location = New Point(334, 474) - chkYAML.Name = "chkYAML" - chkYAML.Size = New Size(116, 19) - chkYAML.TabIndex = 60 - chkYAML.Text = "YAML file system" - btnToolTip.SetToolTip(chkYAML, "Enables the new YAML file system.") - chkYAML.UseVisualStyleBackColor = True - ' ' Configurator ' AutoScaleDimensions = New SizeF(7F, 15F) @@ -2987,5 +3016,7 @@ Partial Class Configurator Friend WithEvents chkForce As CheckBox Friend WithEvents chkYAML As CheckBox Friend WithEvents lblPreset As TextBox + Friend WithEvents createPreset As Button + Friend WithEvents namePreset As TextBox End Class diff --git a/Configurator.vb b/Configurator.vb index ca882df..be3b3b9 100755 --- a/Configurator.vb +++ b/Configurator.vb @@ -1128,6 +1128,7 @@ err1: Private Sub cmbFPS_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbFPS.SelectedIndexChanged txtFPS.Text = " fps: " & cmbFPS.SelectedItem.ToString + cmbExposure.Text = Math.Floor(1000 / CInt(cmbFPS.SelectedItem.ToString)) txtExposure.Text = " exposure: " & Math.Floor(1000 / CInt(cmbFPS.SelectedItem.ToString)) End Sub @@ -2787,7 +2788,7 @@ err1: IO.File.WriteAllLines(WFBfilePath, lines) End If End If - If txtResolution.Text <> "" Then + If txtResolution.Text <> "" Then Dim majestic = "majestic.yaml" If Not IO.File.Exists(majestic) Then MsgBox("File " + majestic + " not found!" + vbCrLf + "Install the latest version of Putty and try again.") @@ -3373,7 +3374,7 @@ err1: End Sub Private Sub btnPreset_Click(sender As Object, e As EventArgs) Handles btnPreset.Click - Dim selected_preset = "presets/" + CStr(cmbPresets.Text) + ".bat" + Dim selected_preset = "presets/" + cmbPresets.Text + ".bat" If Not File.Exists(selected_preset) Then MsgBox("File " + selected_preset + " not found!") Return @@ -3386,7 +3387,7 @@ err1: .StartInfo.FileName = selected_preset .StartInfo.Arguments = "preset " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text .StartInfo.RedirectStandardOutput = False - .Start() + .Start End With Else MsgBox("Please enter a valid IP address") @@ -3399,5 +3400,78 @@ err1: lblPreset.Text = System.IO.File.ReadAllText(wfbconf) End Sub + Private Sub createPreset_Click(sender As Object, e As EventArgs) Handles createPreset.Click + Dim i As Integer + Dim dirPresets = "presets\" + Dim sSource As String + Dim sTarget As String + sSource = "presets/1080p60_15Mbps_40MHz_AF1_12_15_UART0_MSPOSD.bat" + sTarget = "presets/custom_1.bat" + If btnRead.Enabled = True Then + If namePreset.Text <> "" Then + sTarget = "presets/" + namePreset.Text & ".bat" + Else + Do While System.IO.File.Exists(sTarget) = True + i = i + 1 + sTarget = "presets/custom_" & i & ".bat" + Loop + End If + File.Copy(sSource, sTarget, True) + Dim x As Integer + Dim PresetfilePath As String = sTarget + Dim lines = IO.File.ReadAllLines(PresetfilePath) + For x = 0 To lines.Count() - 1 + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 cli -s .video0.fps ") And Not cmbFPS.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 cli -s .video0.fps " + cmbFPS.Text + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 cli -s .isp.exposure ") And Not cmbExposure.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 cli -s .isp.exposure " + cmbExposure.Text + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 cli -s .video0.size ") And Not cmbResolution.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 cli -s .video0.size " + cmbResolution.Text + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 cli -s .video0.bitrate ") And Not cmbBitrate.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 cli -s .video0.bitrate " + cmbBitrate.Text + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 sed -i '/driver_txpower_override=/c\driver_txpower_override=") And Not ComboBox2.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 sed -i '/driver_txpower_override=/c\driver_txpower_override=" + ComboBox2.Text + "' /etc/wfb.conf" + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 sed -i '/stbc=/c\stbc=") And Not ComboBox6.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 sed -i '/stbc=/c\stbc=" + ComboBox6.Text + "' /etc/wfb.conf" + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 sed -i '/ldpc=/c\ldpc=") And Not ComboBox7.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 sed -i '/stbc=/c\stbc=" + ComboBox7.Text + "' /etc/wfb.conf" + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 sed -i '/mcs_index=/c\mcs_index=") And Not ComboBox5.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 sed -i '/mcs_index=/c\mcs_index=" + ComboBox5.Text + "' /etc/wfb.conf" + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 sed -i '/bandwidth=/c\bandwidth=") And Not cmbBandwidth.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 sed -i '/bandwidth=/c\bandwidth=" + cmbBandwidth.Text + "' /etc/wfb.conf" + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 sed -i '/fec_k=/c\fec_k=") And Not ComboBox8.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 sed -i '/fec_k=/c\fec_k=" + ComboBox8.Text + "' /etc/wfb.conf" + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 sed -i '/fec_n=/c\fec_n=") And Not ComboBox9.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 sed -i '/fec_n=/c\fec_n=" + ComboBox9.Text + "' /etc/wfb.conf" + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 sed -i '/serial=/c\serial=") And Not cmbSerial.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 sed -i '/serial=/c\serial=" + cmbSerial.Text + "' /etc/telemetry.conf" + End If + If lines(x).StartsWith(" plink -ssh root@%2 -pw %3 sed -i '/router=/c\router=") And Not cmbRouter.Text.StartsWith("Select") Then + lines(x) = " plink -ssh root@%2 -pw %3 sed -i '/router=/c\router=" + cmbRouter.Text + "' /etc/telemetry.conf" + End If + Next + IO.File.WriteAllLines(PresetfilePath, lines) + cmbPresets.Items.Clear() + For Each filePresets As String In System.IO.Directory.GetFiles(dirPresets) + cmbPresets.Items.Add(System.IO.Path.GetFileNameWithoutExtension(filePresets)) + Next + cmbPresets.Text = "Select Preset" + MsgBox("Your Custom Preset is created with name " + sTarget.Replace("presets/", "") + vbCrLf + "Please select it from the list and hit Apply Selected Preset.") + Else + MsgBox("You must Connect and Load the settings before you can Create a new Custom Preset.") + End If + End Sub + #End Region End Class diff --git a/presets/1080p60_15Mbps_40MHz_AF1_12_15_UART0_MSPOSD.bat b/presets/1080p60_15Mbps_40MHz_AF1_12_15_UART0_MSPOSD.bat index 799333c..031f868 100644 --- a/presets/1080p60_15Mbps_40MHz_AF1_12_15_UART0_MSPOSD.bat +++ b/presets/1080p60_15Mbps_40MHz_AF1_12_15_UART0_MSPOSD.bat @@ -1,19 +1,10 @@ @echo off if "%1" == "preset" ( - echo y | pscp -scp -pw %3 sensors/imx415_milos15.bin root@%2:/etc/sensors/ - echo y | pscp -scp -pw %3 vtxmenu.ini root@%2:/etc/ - echo y | pscp -scp -pw %3 reset/wifibroadcast root@%2:/usr/bin/ - plink -ssh root@%2 -pw %3 dos2unix /etc/vtxmenu.ini - plink -ssh root@%2 -pw %3 dos2unix /usr/bin/wifibroadcast - plink -ssh root@%2 -pw %3 cli -s .isp.sensorConfig /etc/sensors/imx415_milos15.bin - plink -ssh root@%2 -pw %3 cli -s .isp.exposure 16 - plink -ssh root@%2 -pw %3 cli -s .video0.codec h265 plink -ssh root@%2 -pw %3 cli -s .video0.fps 60 + plink -ssh root@%2 -pw %3 cli -s .isp.exposure 16 plink -ssh root@%2 -pw %3 cli -s .video0.size 1920x1080 plink -ssh root@%2 -pw %3 cli -s .video0.bitrate 15360 - plink -ssh root@%2 -pw %3 cli -s .fpv.enabled true - plink -ssh root@%2 -pw %3 cli -s .fpv.noiseLevel 0 plink -ssh root@%2 -pw %3 sed -i '/driver_txpower_override=/c\driver_txpower_override=30' /etc/wfb.conf plink -ssh root@%2 -pw %3 sed -i '/stbc=/c\stbc=1' /etc/wfb.conf plink -ssh root@%2 -pw %3 sed -i '/ldpc=/c\ldpc=1' /etc/wfb.conf @@ -21,8 +12,18 @@ if "%1" == "preset" ( plink -ssh root@%2 -pw %3 sed -i '/bandwidth=/c\bandwidth=40' /etc/wfb.conf plink -ssh root@%2 -pw %3 sed -i '/fec_k=/c\fec_k=12' /etc/wfb.conf plink -ssh root@%2 -pw %3 sed -i '/fec_n=/c\fec_n=15' /etc/wfb.conf + plink -ssh root@%2 -pw %3 sed -i '/serial=/c\serial=/dev/ttyS0' /etc/telemetry.conf plink -ssh root@%2 -pw %3 sed -i '/router=/c\router=2' /etc/telemetry.conf plink -ssh root@%2 -pw %3 sed -i 's/console::respawn:\/sbin\/getty -L console 0 vt100/#console::respawn:\/sbin\/getty -L console 0 vt100/' /etc/inittab + plink -ssh root@%2 -pw %3 dos2unix /etc/vtxmenu.ini + plink -ssh root@%2 -pw %3 dos2unix /usr/bin/wifibroadcast + plink -ssh root@%2 -pw %3 cli -s .isp.sensorConfig /etc/sensors/imx415_milos15.bin + plink -ssh root@%2 -pw %3 cli -s .fpv.enabled true + plink -ssh root@%2 -pw %3 cli -s .fpv.noiseLevel 0 + plink -ssh root@%2 -pw %3 cli -s .video0.codec h265 + echo y | pscp -scp -pw %3 sensors/imx415_milos15.bin root@%2:/etc/sensors/ + echo y | pscp -scp -pw %3 vtxmenu.ini root@%2:/etc/ + echo y | pscp -scp -pw %3 reset/wifibroadcast root@%2:/usr/bin/ plink -ssh root@%2 -pw %3 reboot ) diff --git a/presets/720p120_15Mbps_40MHz_AF1_8_12_UART0_MSPOSD.bat b/presets/720p120_15Mbps_40MHz_AF1_8_12_UART0_MSPOSD.bat index 8e966ea..79ef497 100644 --- a/presets/720p120_15Mbps_40MHz_AF1_8_12_UART0_MSPOSD.bat +++ b/presets/720p120_15Mbps_40MHz_AF1_8_12_UART0_MSPOSD.bat @@ -1,19 +1,10 @@ @echo off if "%1" == "preset" ( - echo y | pscp -scp -pw %3 sensors/imx415_milos15.bin root@%2:/etc/sensors/ - echo y | pscp -scp -pw %3 vtxmenu.ini root@%2:/etc/ - echo y | pscp -scp -pw %3 reset/wifibroadcast root@%2:/usr/bin/ - plink -ssh root@%2 -pw %3 dos2unix /etc/vtxmenu.ini - plink -ssh root@%2 -pw %3 dos2unix /usr/bin/wifibroadcast - plink -ssh root@%2 -pw %3 cli -s .isp.sensorConfig /etc/sensors/imx415_milos15.bin - plink -ssh root@%2 -pw %3 cli -s .isp.exposure 8 - plink -ssh root@%2 -pw %3 cli -s .video0.codec h265 plink -ssh root@%2 -pw %3 cli -s .video0.fps 120 + plink -ssh root@%2 -pw %3 cli -s .isp.exposure 8 plink -ssh root@%2 -pw %3 cli -s .video0.size 1280x720 plink -ssh root@%2 -pw %3 cli -s .video0.bitrate 15360 - plink -ssh root@%2 -pw %3 cli -s .fpv.enabled true - plink -ssh root@%2 -pw %3 cli -s .fpv.noiseLevel 0 plink -ssh root@%2 -pw %3 sed -i '/driver_txpower_override=/c\driver_txpower_override=40' /etc/wfb.conf plink -ssh root@%2 -pw %3 sed -i '/stbc=/c\stbc=1' /etc/wfb.conf plink -ssh root@%2 -pw %3 sed -i '/ldpc=/c\ldpc=1' /etc/wfb.conf @@ -21,8 +12,18 @@ if "%1" == "preset" ( plink -ssh root@%2 -pw %3 sed -i '/bandwidth=/c\bandwidth=40' /etc/wfb.conf plink -ssh root@%2 -pw %3 sed -i '/fec_k=/c\fec_k=8' /etc/wfb.conf plink -ssh root@%2 -pw %3 sed -i '/fec_n=/c\fec_n=12' /etc/wfb.conf + plink -ssh root@%2 -pw %3 sed -i '/serial=/c\serial=/dev/ttyS0' /etc/telemetry.conf plink -ssh root@%2 -pw %3 sed -i '/router=/c\router=2' /etc/telemetry.conf plink -ssh root@%2 -pw %3 sed -i 's/console::respawn:\/sbin\/getty -L console 0 vt100/#console::respawn:\/sbin\/getty -L console 0 vt100/' /etc/inittab + plink -ssh root@%2 -pw %3 dos2unix /etc/vtxmenu.ini + plink -ssh root@%2 -pw %3 dos2unix /usr/bin/wifibroadcast + plink -ssh root@%2 -pw %3 cli -s .isp.sensorConfig /etc/sensors/imx415_milos15.bin + plink -ssh root@%2 -pw %3 cli -s .fpv.enabled true + plink -ssh root@%2 -pw %3 cli -s .fpv.noiseLevel 0 + plink -ssh root@%2 -pw %3 cli -s .video0.codec h265 + echo y | pscp -scp -pw %3 sensors/imx415_milos15.bin root@%2:/etc/sensors/ + echo y | pscp -scp -pw %3 vtxmenu.ini root@%2:/etc/ + echo y | pscp -scp -pw %3 reset/wifibroadcast root@%2:/usr/bin/ plink -ssh root@%2 -pw %3 reboot )