From c75a0293b9c8c09826e399aea3e12e8c004003d7 Mon Sep 17 00:00:00 2001 From: MarioFPVdev Date: Sun, 13 Oct 2024 10:26:04 +0100 Subject: [PATCH] MSPOSD fixes --- Configurator.Designer.vb | 81 ++----------- Configurator.resx | 3 - Configurator.vb | 250 ++++++++++++++++----------------------- Extern.bat | 6 - 4 files changed, 106 insertions(+), 234 deletions(-) diff --git a/Configurator.Designer.vb b/Configurator.Designer.vb index 70f1939..d4ff748 100644 --- a/Configurator.Designer.vb +++ b/Configurator.Designer.vb @@ -81,11 +81,7 @@ Partial Class Configurator rBtnRECON = New RadioButton() btnOnboardREC = New Button() btnDualOSD = New Button() - rBtnttyS2 = New RadioButton() - rBtnttyS0 = New RadioButton() btnFontsINAV = New Button() - btnFonts = New Button() - btnMavlink = New Button() btnMSP = New Button() btnExtra = New Button() cmbRC_Channel = New ComboBox() @@ -870,11 +866,7 @@ Partial Class Configurator TabPage3.Controls.Add(rBtnRECON) TabPage3.Controls.Add(btnOnboardREC) TabPage3.Controls.Add(btnDualOSD) - TabPage3.Controls.Add(rBtnttyS2) - TabPage3.Controls.Add(rBtnttyS0) TabPage3.Controls.Add(btnFontsINAV) - TabPage3.Controls.Add(btnFonts) - TabPage3.Controls.Add(btnMavlink) TabPage3.Controls.Add(btnMSP) TabPage3.Controls.Add(btnExtra) TabPage3.Controls.Add(cmbRC_Channel) @@ -905,7 +897,7 @@ Partial Class Configurator rBtnRECOFF.AutoSize = True rBtnRECOFF.Checked = True rBtnRECOFF.ForeColor = Color.White - rBtnRECOFF.Location = New Point(547, 229) + rBtnRECOFF.Location = New Point(547, 192) rBtnRECOFF.Name = "rBtnRECOFF" rBtnRECOFF.Size = New Size(45, 18) rBtnRECOFF.TabIndex = 65 @@ -918,7 +910,7 @@ Partial Class Configurator ' rBtnRECON.AutoSize = True rBtnRECON.ForeColor = Color.White - rBtnRECON.Location = New Point(547, 214) + rBtnRECON.Location = New Point(547, 177) rBtnRECON.Name = "rBtnRECON" rBtnRECON.Size = New Size(40, 18) rBtnRECON.TabIndex = 64 @@ -931,7 +923,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, 216) + btnOnboardREC.Location = New Point(454, 179) btnOnboardREC.Name = "btnOnboardREC" btnOnboardREC.Size = New Size(87, 30) btnOnboardREC.TabIndex = 63 @@ -944,7 +936,7 @@ Partial Class Configurator btnDualOSD.BackColor = Color.Gold btnDualOSD.FlatStyle = FlatStyle.Popup btnDualOSD.Font = New Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, CByte(0)) - btnDualOSD.Location = New Point(454, 252) + btnDualOSD.Location = New Point(454, 216) btnDualOSD.Name = "btnDualOSD" btnDualOSD.Size = New Size(116, 30) btnDualOSD.TabIndex = 62 @@ -953,34 +945,6 @@ Partial Class Configurator btnDualOSD.UseVisualStyleBackColor = False btnDualOSD.Visible = False ' - ' rBtnttyS2 - ' - rBtnttyS2.AutoSize = True - rBtnttyS2.Checked = True - rBtnttyS2.ForeColor = Color.White - rBtnttyS2.Location = New Point(580, 123) - rBtnttyS2.Name = "rBtnttyS2" - rBtnttyS2.Size = New Size(52, 18) - rBtnttyS2.TabIndex = 61 - rBtnttyS2.TabStop = True - rBtnttyS2.Text = "ttyS2" - btnToolTip.SetToolTip(rBtnttyS2, "Enable MSPOSD on ttyS2") - rBtnttyS2.UseVisualStyleBackColor = True - rBtnttyS2.Visible = False - ' - ' rBtnttyS0 - ' - rBtnttyS0.AutoSize = True - rBtnttyS0.ForeColor = Color.White - rBtnttyS0.Location = New Point(580, 107) - rBtnttyS0.Name = "rBtnttyS0" - rBtnttyS0.Size = New Size(52, 18) - rBtnttyS0.TabIndex = 60 - rBtnttyS0.Text = "ttyS0" - btnToolTip.SetToolTip(rBtnttyS0, "Enable MSPOSD on ttyS0") - rBtnttyS0.UseVisualStyleBackColor = True - rBtnttyS0.Visible = False - ' ' btnFontsINAV ' btnFontsINAV.BackColor = Color.Gold @@ -994,33 +958,6 @@ Partial Class Configurator btnToolTip.SetToolTip(btnFontsINAV, "Upload the fonts for INAV to the OpenIPC camera") btnFontsINAV.UseVisualStyleBackColor = False ' - ' btnFonts - ' - btnFonts.BackColor = Color.Gold - btnFonts.FlatStyle = FlatStyle.Popup - btnFonts.Font = New Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, CByte(0)) - btnFonts.Location = New Point(454, 290) - btnFonts.Name = "btnFonts" - btnFonts.Size = New Size(116, 30) - btnFonts.TabIndex = 58 - btnFonts.Text = "Upload BF Fonts" - btnToolTip.SetToolTip(btnFonts, "Upload the fonts for Betaflight to the OpenIPC camera") - btnFonts.UseVisualStyleBackColor = False - btnFonts.Visible = False - ' - ' btnMavlink - ' - btnMavlink.BackColor = Color.Gold - btnMavlink.FlatStyle = FlatStyle.Popup - btnMavlink.Font = New Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, CByte(0)) - btnMavlink.Location = New Point(454, 179) - btnMavlink.Name = "btnMavlink" - btnMavlink.Size = New Size(116, 30) - btnMavlink.TabIndex = 57 - btnMavlink.Text = "Enable Mavlink" - btnToolTip.SetToolTip(btnMavlink, "Enables the Mavlink telemetry" & vbCrLf & "of OpenIPC") - btnMavlink.UseVisualStyleBackColor = False - ' ' btnMSP ' btnMSP.BackColor = Color.Gold @@ -1030,8 +967,8 @@ Partial Class Configurator btnMSP.Name = "btnMSP" btnMSP.Size = New Size(116, 30) btnMSP.TabIndex = 56 - btnMSP.Text = "Enable MSPOSD" - btnToolTip.SetToolTip(btnMSP, "Enables the MSPOSD of OpenIPC" & vbCrLf & "Adds CPU Bitrate FPS Temp OSD" & vbCrLf & "Upload the fonts for Betaflight " & vbCrLf & "to the OpenIPC camera") + btnMSP.Text = "Upload MSPOSD" + btnToolTip.SetToolTip(btnMSP, "Upload the latest MSPOSD of OpenIPC" & vbCrLf & "Upload the fonts for Betaflight " & vbCrLf & "to the OpenIPC camera") btnMSP.UseVisualStyleBackColor = False ' ' btnExtra @@ -2597,7 +2534,7 @@ Partial Class Configurator version.AutoSize = True version.Font = New Font("Arial", 6F, FontStyle.Bold) version.ForeColor = Color.White - version.Location = New Point(642, 490) + version.Location = New Point(647, 490) version.Name = "version" version.Size = New Size(22, 10) version.TabIndex = 48 @@ -2837,11 +2774,7 @@ Partial Class Configurator Friend WithEvents rBtnRECON As RadioButton Friend WithEvents btnOnboardREC As Button Friend WithEvents btnDualOSD As Button - Friend WithEvents rBtnttyS2 As RadioButton - Friend WithEvents rBtnttyS0 As RadioButton Friend WithEvents btnFontsINAV As Button - Friend WithEvents btnFonts As Button - Friend WithEvents btnMavlink As Button Friend WithEvents btnMSP As Button Friend WithEvents version As Label diff --git a/Configurator.resx b/Configurator.resx index 0b4b3ee..b220129 100644 --- a/Configurator.resx +++ b/Configurator.resx @@ -120,9 +120,6 @@ 17, 17 - - 17, 17 - Step 1: Select which VRX to use Step 2: Enter the VRX IP diff --git a/Configurator.vb b/Configurator.vb index ff82757..ec80777 100755 --- a/Configurator.vb +++ b/Configurator.vb @@ -898,7 +898,8 @@ err1: cmbRouter.Items.Clear() cmbRouter.Items.Add("0") cmbRouter.Items.Add("1") - cmbRouter.Text = "Select MAVFWD(0)/MAVLINK(1)" + cmbRouter.Items.Add("2") + cmbRouter.Text = "Select MAVFWD(0)/MAV-ROUTER(1)/MSPOSD(2)" cmbMCSTLM.Items.Clear() cmbMCSTLM.Items.Add("0") @@ -1511,7 +1512,6 @@ err1: txtExtras.Visible = True btnMSP.Visible = False btnFontsINAV.Visible = False - btnMavlink.Visible = False btnOnboardREC.Visible = False rBtnRECON.Visible = False rBtnRECOFF.Visible = False @@ -1669,7 +1669,6 @@ err1: txtExtras.Visible = True btnMSP.Visible = True btnFontsINAV.Visible = True - btnMavlink.Visible = True btnOnboardREC.Visible = True rBtnRECON.Visible = True rBtnRECOFF.Visible = True @@ -1826,7 +1825,6 @@ err1: txtExtras.Visible = True btnMSP.Visible = False btnFontsINAV.Visible = False - btnMavlink.Visible = False btnOnboardREC.Visible = False rBtnRECON.Visible = False rBtnRECOFF.Visible = False @@ -2681,81 +2679,6 @@ err1: End If End Sub - Private Sub btnMSP_Click(sender As Object, e As EventArgs) - Dim extern = "extern.bat" - Dim msp_file = "msposd" - If Not File.Exists(extern) Then - MsgBox("File " + extern + " not found!") - Return - End If - If Not File.Exists(msp_file) Then - MsgBox("File " + msp_file + " not found!") - Return - End If - - If IsValidIP(txtIP.Text) Then - With New Process() - .StartInfo.UseShellExecute = False - .StartInfo.FileName = extern - .StartInfo.Arguments = "msp " + 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 - - Private Sub btnMavlink_Click(sender As Object, e As EventArgs) - Dim extern = "extern.bat" - If Not File.Exists(extern) Then - MsgBox("File " + extern + " not found!") - Return - End If - - If IsValidIP(txtIP.Text) Then - With New Process() - .StartInfo.UseShellExecute = False - .StartInfo.FileName = extern - .StartInfo.Arguments = "mav " + 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 - - Private Sub btnFonts_Click(sender As Object, e As EventArgs) - Dim extern = "extern.bat" - Dim font_file1 = "bf/font.png" - Dim font_file2 = "bf/font_hd.png" - If Not File.Exists(extern) Then - MsgBox("File " + extern + " not found!") - Return - End If - If Not File.Exists(font_file1) Then - MsgBox("File " + font_file1 + " not found!") - Return - End If - If Not File.Exists(font_file2) Then - MsgBox("File " + font_file2 + " not found!") - Return - End If - - If IsValidIP(txtIP.Text) Then - With New Process() - .StartInfo.UseShellExecute = False - .StartInfo.FileName = extern - .StartInfo.Arguments = "fonts " + 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 - Private Sub btnSaveReboot_Click(sender As Object, e As EventArgs) Handles btnSaveReboot.Click Dim vdecconf As String = "vdec.conf" If Not IO.File.Exists(vdecconf) Then @@ -3057,28 +2980,18 @@ err1: End If End Sub - Private Sub btnFontsINAV_Click(sender As Object, e As EventArgs) + Private Sub btnExtra_Click(sender As Object, e As EventArgs) Handles btnExtra.Click Dim extern = "extern.bat" - Dim font_file1 = "inav/font.png" - Dim font_file2 = "inav/font_hd.png" - If Not File.Exists(extern) Then + If Not IO.File.Exists(extern) Then MsgBox("File " + extern + " not found!") Return End If - If Not File.Exists(font_file1) Then - MsgBox("File " + font_file1 + " not found!") - Return - End If - If Not File.Exists(font_file2) Then - MsgBox("File " + font_file2 + " not found!") - Return - End If If IsValidIP(txtIP.Text) Then With New Process() .StartInfo.UseShellExecute = False .StartInfo.FileName = extern - .StartInfo.Arguments = "fontsINAV " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text + .StartInfo.Arguments = "extra " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text .StartInfo.RedirectStandardOutput = False .Start() End With @@ -3087,7 +3000,7 @@ err1: End If End Sub - Private Sub btnDualOS_Click(sender As Object, e As EventArgs) + Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click Dim extern = "extern.bat" If Not File.Exists(extern) Then MsgBox("File " + extern + " not found!") @@ -3098,18 +3011,62 @@ err1: With New Process() .StartInfo.UseShellExecute = False .StartInfo.FileName = extern - .StartInfo.Arguments = "dualosd " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text + .StartInfo.Arguments = "resetradxa " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text .StartInfo.RedirectStandardOutput = False - .Start() + .Start End With Else MsgBox("Please enter a valid IP address") End If End Sub - Private Sub btnOnboardREC_Click(sender As Object, e As EventArgs) + Private Sub btnResetCam_Click(sender As Object, e As EventArgs) Handles btnResetCam.Click + Dim result As DialogResult = MessageBox.Show("All OpenIPC camera settings will be restored to default.", "Warning!!!", MessageBoxButtons.YesNo) + If result = DialogResult.No Then + MessageBox.Show("No changes have been done.") + ElseIf result = DialogResult.Yes Then + Dim extern = "extern.bat" + If Not System.IO.File.Exists(extern) Then + MsgBox("File " + extern + " not found!") + Return + End If + + If IsValidIP(txtIP.Text) Then + With New Process() + .StartInfo.UseShellExecute = False + .StartInfo.FileName = extern + .StartInfo.Arguments = "resetcam " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text + .StartInfo.RedirectStandardOutput = False + .Start() + End With + Else + MsgBox("Please enter a valid IP address") + End If + End If + End Sub + + Private Sub btnAddButtons_Click(sender As Object, e As EventArgs) Handles btnAddButtons.Click + If txtFrequency.Text <> "" Then + Dim stream = "stream.sh" + If Not IO.File.Exists(stream) Then + MsgBox("File " + stream + " not found!" + vbCrLf + "Install the latest version of Putty and try again.") + Return + End If + Dim x As Integer + Dim StreamfilePath = stream + Dim lines = IO.File.ReadAllLines(StreamfilePath) + For x = 0 To lines.Count() - 1 + If lines(x).StartsWith(" iw") Then + lines(x) = " iw " + txtExtras.Text + " set freq $Freq" + End If + If lines(x).StartsWith(" iw") Then + lines(x) = " iw " + txtExtras.Text + " set freq $Freq" + End If + Next + IO.File.WriteAllLines(StreamfilePath, lines) + End If Dim extern = "extern.bat" - If Not File.Exists(extern) Then + If Not System.IO.File.Exists(extern) Then MsgBox("File " + extern + " not found!") Return End If @@ -3118,11 +3075,7 @@ err1: With New Process() .StartInfo.UseShellExecute = False .StartInfo.FileName = extern - If rBtnRECON.Checked Then - .StartInfo.Arguments = "onboardrecon " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text - Else - .StartInfo.Arguments = "onboardrecoff " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text - End If + .StartInfo.Arguments = "addbuttons " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text .StartInfo.RedirectStandardOutput = False .Start() End With @@ -3131,18 +3084,23 @@ err1: End If End Sub - Private Sub btnExtra_Click(sender As Object, e As EventArgs) Handles btnExtra.Click + Private Sub btnMSP_Click_1(sender As Object, e As EventArgs) Handles btnMSP.Click Dim extern = "extern.bat" - If Not IO.File.Exists(extern) Then + Dim msp_file = "msposd" + If Not File.Exists(extern) Then MsgBox("File " + extern + " not found!") Return End If + If Not File.Exists(msp_file) Then + MsgBox("File " + msp_file + " not found!") + Return + End If If IsValidIP(txtIP.Text) Then With New Process() .StartInfo.UseShellExecute = False .StartInfo.FileName = extern - .StartInfo.Arguments = "extra " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text + .StartInfo.Arguments = "msp " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text .StartInfo.RedirectStandardOutput = False .Start() End With @@ -3151,73 +3109,63 @@ err1: End If End Sub - Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click + Private Sub btnFontsINAV_Click_1(sender As Object, e As EventArgs) Handles btnFontsINAV.Click Dim extern = "extern.bat" + Dim font_file1 = "inav/font.png" + Dim font_file2 = "inav/font_hd.png" If Not File.Exists(extern) Then MsgBox("File " + extern + " not found!") Return End If + If Not File.Exists(font_file1) Then + MsgBox("File " + font_file1 + " not found!") + Return + End If + If Not File.Exists(font_file2) Then + MsgBox("File " + font_file2 + " not found!") + Return + End If If IsValidIP(txtIP.Text) Then With New Process() .StartInfo.UseShellExecute = False .StartInfo.FileName = extern - .StartInfo.Arguments = "resetradxa " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text + .StartInfo.Arguments = "fontsINAV " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text .StartInfo.RedirectStandardOutput = False - .Start + .Start() End With Else MsgBox("Please enter a valid IP address") End If End Sub - Private Sub btnResetCam_Click(sender As Object, e As EventArgs) Handles btnResetCam.Click - Dim result As DialogResult = MessageBox.Show("All OpenIPC camera settings will be restored to default.", "Warning!!!", MessageBoxButtons.YesNo) - If result = DialogResult.No Then - MessageBox.Show("No changes have been done.") - ElseIf result = DialogResult.Yes Then - Dim extern = "extern.bat" - If Not System.IO.File.Exists(extern) Then - MsgBox("File " + extern + " not found!") - Return - End If - - If IsValidIP(txtIP.Text) Then - With New Process() - .StartInfo.UseShellExecute = False - .StartInfo.FileName = extern - .StartInfo.Arguments = "resetcam " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text - .StartInfo.RedirectStandardOutput = False - .Start() - End With - Else - MsgBox("Please enter a valid IP address") - End If + Private Sub btnOnboardREC_Click_1(sender As Object, e As EventArgs) Handles btnOnboardREC.Click + Dim extern = "extern.bat" + If Not File.Exists(extern) Then + MsgBox("File " + extern + " not found!") + Return End If - End Sub - Private Sub btnAddButtons_Click(sender As Object, e As EventArgs) Handles btnAddButtons.Click - If txtFrequency.Text <> "" Then - Dim stream = "stream.sh" - If Not IO.File.Exists(stream) Then - MsgBox("File " + stream + " not found!" + vbCrLf + "Install the latest version of Putty and try again.") - Return - End If - Dim x As Integer - Dim StreamfilePath = stream - Dim lines = IO.File.ReadAllLines(StreamfilePath) - For x = 0 To lines.Count() - 1 - If lines(x).StartsWith(" iw") Then - lines(x) = " iw " + txtExtras.Text + " set freq $Freq" - End If - If lines(x).StartsWith(" iw") Then - lines(x) = " iw " + txtExtras.Text + " set freq $Freq" + If IsValidIP(txtIP.Text) Then + With New Process() + .StartInfo.UseShellExecute = False + .StartInfo.FileName = extern + If rBtnRECON.Checked Then + .StartInfo.Arguments = "onboardrecon " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text + Else + .StartInfo.Arguments = "onboardrecoff " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text End If - Next - IO.File.WriteAllLines(StreamfilePath, lines) + .StartInfo.RedirectStandardOutput = False + .Start() + End With + Else + MsgBox("Please enter a valid IP address") End If + End Sub + + Private Sub btnDualOSD_Click(sender As Object, e As EventArgs) Handles btnDualOSD.Click Dim extern = "extern.bat" - If Not System.IO.File.Exists(extern) Then + If Not File.Exists(extern) Then MsgBox("File " + extern + " not found!") Return End If @@ -3226,7 +3174,7 @@ err1: With New Process() .StartInfo.UseShellExecute = False .StartInfo.FileName = extern - .StartInfo.Arguments = "addbuttons " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text + .StartInfo.Arguments = "dualosd " + String.Format("{0}", txtIP.Text) + " " + txtPassword.Text .StartInfo.RedirectStandardOutput = False .Start() End With diff --git a/Extern.bat b/Extern.bat index 2d01760..f715728 100755 --- a/Extern.bat +++ b/Extern.bat @@ -192,7 +192,6 @@ if "%1" == "offlinefw" ( ) if "%1" == "msp" ( - plink -ssh root@%2 -pw %3 sed -i '/router=/c\router=2' /etc/telemetry.conf 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/bin/ @@ -208,11 +207,6 @@ if "%1" == "mspgs" ( plink -ssh root@%2 -pw %3 reboot ) -if "%1" == "mav" ( - plink -ssh root@%2 -pw %3 sed -i '/router=/c\router=0' /etc/telemetry.conf - plink -ssh root@%2 -pw %3 reboot -) - if "%1" == "dualosd" ( plink -ssh root@%2 -pw %3 sed -i '/telemetry=false/c\telemetry=true' /etc/datalink.conf plink -ssh root@%2 -pw %3 reboot