Skip to content

Commit

Permalink
Update for Radxa buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioFPVdev authored and MarioFPVdev committed Oct 9, 2024
1 parent 6783c99 commit 73f08b1
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 10 deletions.
44 changes: 39 additions & 5 deletions Configurator.vb
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,27 @@ err1:
Dim array() As String

LineOfText = ReadLine(1, DisplayReaderallLines)

array = LineOfText.Split("@")

txtResolutionVRX.Text = array(0)
txtCodecVRX.Text = array(1)

Dim stream = "wifibroadcast"
If Not System.IO.File.Exists(stream) Then
MsgBox("File " + stream + " not found!" + vbCrLf + "Install the latest version of Putty and try again.")
Return
End If
Dim streamReader As New IO.StreamReader(stream)
Dim streamReaderallLines = New List(Of String)

Do While Not streamReader.EndOfStream
streamReaderallLines.Add(streamReader.ReadLine)
Loop
streamReader.Close()
Dim streamOfText As String
Dim sArray() As String
streamOfText = ReadLine(1, streamReaderallLines)
sArray = streamOfText.Split("=")
txtExtras.Text = sArray(1).Replace("""", "")
End If
btnSaveReboot.Enabled = True
btnReboot.Enabled = True
Expand Down Expand Up @@ -1792,8 +1808,8 @@ err1:
txtPower24.Visible = False
txtPortVRX.Visible = False
txtMavlinkVRX.Visible = False
txtExtras.Visible = False
Label2.Visible = False
txtExtras.Visible = True
Label2.Visible = True
txtMCS.ReadOnly = False
txtSTBC.ReadOnly = False
ComboBox1.Items.Clear()
Expand Down Expand Up @@ -3164,6 +3180,25 @@ err1:
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 System.IO.File.Exists(extern) Then
MsgBox("File " + extern + " not found!")
Expand All @@ -3183,6 +3218,5 @@ err1:
End If
End Sub


#End Region
End Class
12 changes: 7 additions & 5 deletions Extern.bat
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if "%1" == "dlwfbng" (
echo y | pscp -scp -pw %3 root@%2:/etc/modprobe.d/wfb.conf .
echo y | pscp -scp -pw %3 root@%2:/home/radxa/scripts/screen-mode .
echo y | pscp -scp -pw %3 root@%2:/config/scripts/screen-mode .
echo y | pscp -scp -pw %3 root@%2:/etc/default/wifibroadcast .
)

if "%1" == "ulwfbng" (
Expand All @@ -56,7 +57,7 @@ if "%1" == "ulwfbng" (
echo y | pscp -scp -pw %3 screen-mode root@%2:/home/radxa/scripts/
plink -ssh root@%2 -pw %3 dos2unix /etc/wifibroadcast.cfg /etc/modprobe.d/wfb.conf /home/radxa/scripts/screen-mode
echo y | pscp -scp -pw %3 screen-mode root@%2:/config/scripts/
plink -ssh root@%2 -pw %3 dos2unix /etc/wifibroadcast.cfg /etc/modprobe.d/wfb.conf /config/scripts/screen-mode
plink -ssh root@%2 -pw %3 dos2unix /config/scripts/screen-mode
)

if "%1" == "ulwfbngr" (
Expand All @@ -66,7 +67,7 @@ if "%1" == "ulwfbngr" (
echo y | pscp -scp -pw %3 screen-mode root@%2:/home/radxa/scripts/
plink -ssh root@%2 -pw %3 dos2unix /etc/wifibroadcast.cfg /etc/modprobe.d/wfb.conf /home/radxa/scripts/screen-mode
echo y | pscp -scp -pw %3 screen-mode root@%2:/config/scripts/
plink -ssh root@%2 -pw %3 dos2unix /etc/wifibroadcast.cfg /etc/modprobe.d/wfb.conf /config/scripts/screen-mode
plink -ssh root@%2 -pw %3 dos2unix /config/scripts/screen-mode
plink -ssh root@%2 -pw %3 reboot
)

Expand Down Expand Up @@ -272,9 +273,10 @@ if "%1" == "resetradxa" (
echo y | pscp -scp -pw %3 reset/wifibroadcast.cfg root@%2:/etc
echo y | pscp -scp -pw %3 reset/wfb.conf root@%2:/etc/modprobe.d/
echo y | pscp -scp -pw %3 reset/screen-mode root@%2:/home/radxa/scripts/
plink -ssh root@%2 -pw %3 dos2unix /etc/wifibroadcast.cfg /etc/modprobe.d/wfb.conf /home/radxa/scripts/screen-mode
echo y | pscp -scp -pw %3 reset/wifibroadcast root@%2:/etc/default/
plink -ssh root@%2 -pw %3 dos2unix /etc/wifibroadcast.cfg /etc/modprobe.d/wfb.conf /etc/default/wifibroadcast /home/radxa/scripts/screen-mode
echo y | pscp -scp -pw %3 reset/screen-mode root@%2:/config/scripts/
plink -ssh root@%2 -pw %3 dos2unix /etc/wifibroadcast.cfg /etc/modprobe.d/wfb.conf /config/scripts/screen-mode
plink -ssh root@%2 -pw %3 dos2unix /config/scripts/screen-mode
plink -ssh root@%2 -pw %3 reboot
)

Expand All @@ -285,7 +287,7 @@ if "%1" == "resetcam" (
if "%1" == "addbuttons" (
plink -ssh root@%2 -pw %3 apt install dos2unix
echo y | pscp -scp -pw %3 stream.sh root@%2:/config/scripts/
plink -ssh root@%2 -pw %3 dos2unix /config/scripts/addbuttons
plink -ssh root@%2 -pw %3 dos2unix /config/scripts/stream.sh
)

if "%1" == "fonts" (
Expand Down
95 changes: 95 additions & 0 deletions reset/stream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/bin/bash

SCREEN_MODE=$(</config/scripts/screen-mode)
REC_FPS=$(</config/scripts/rec-fps)


RUNNING=0
STREAMING=0
i=0
j=0
gpio_chip="gpiochip4"
gpio_offset="10"
gpio_chip2="gpiochip3"
gpio_offset2="1"
gpio_offset3="2"
gpio_offset4="9"
gpio_offset5="10"
freq_list=("5180" "5200" "5220" "5240" "5260" "5280" "5300" "5320" "5500" "5520" "5540" "5560" "5580" "5600" "5620" "5640" "5660" "5680" "5700" "5720" "5745" "5765" "5785" "5805" "5825")
chan_list=("36" "40" "44" "48" "52" "56" "60" "64" "100" "104" "108" "112" "116" "120" "124" "128" "132" "136" "140" "144" "149" "153" "157" "161" "165")

cd /media


while true; do
if [ $(gpioget $gpio_chip $gpio_offset) -eq 0 ]; then

if [ $RUNNING -eq 0 ]; then
kill -15 $STREAMING
sleep 0.1
current_date=$(date +'%m-%d-%Y_%H-%M-%S')

pixelpilot --osd --osd-elements video,wfbng --screen-mode $SCREEN_MODE --dvr-framerate $REC_FPS --dvr-fmp4 --dvr record_${current_date}.mp4 &

RUNNING=$!
else
kill -15 $RUNNING
RUNNING=0
STREAMING=0
fi
sleep 0.1
elif [ $STREAMING -eq 0 ]; then

pixelpilot --osd --osd-elements video,wfbng --screen-mode $SCREEN_MODE &

STREAMING=$!

fi
if [ $(gpioget $gpio_chip2 $gpio_offset4) -eq 1 ]; then
Freq=${freq_list[$i]}
Chan=${chan_list[$i]}
iw wlx00c0caafee0e set freq $Freq
sed -i "s/wifi_channel = .*/wifi_channel = $Chan/" /etc/wifibroadcast.cfg
echo "$Freq"
i=$((i+1))
if [[ $i -gt 24 ]]
then
i=0
fi
fi
if [ $(gpioget $gpio_chip2 $gpio_offset5) -eq 1 ]; then
i=$((i-1))
if [[ $i -lt 0 ]]
then
i=24
fi
Freq=${freq_list[$i]}
Chan=${chan_list[$i]}
iw wlx00c0caafee0e set freq $Freq
sed -i "s/wifi_channel = .*/wifi_channel = $Chan/" /etc/wifibroadcast.cfg
echo "$Freq"
fi
if [ $(gpioget $gpio_chip2 $gpio_offset2) -eq 1 ]; then
for Freq in ${freq_list[@]}; do
Chan=${chan_list[$j]}
if [ $(gpioget $gpio_chip2 $gpio_offset3) -eq 1 ]; then
echo "exit loop"
break
fi
iw wlx00c0caafee0e set freq $Freq
sed -i "s/wifi_channel = .*/wifi_channel = $Chan/" /etc/wifibroadcast.cfg
j=$((j+1))
if [[ $j -gt 24 ]]
then
j=0
fi
echo "$Freq"
sleep 3
if [ $(gpioget $gpio_chip2 $gpio_offset3) -eq 1 ]; then
echo "exit loop"
break
fi
done
fi
sleep 0.2
done
1 change: 1 addition & 0 deletions wifibroadcast
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WFB_NICS="wlx00c0caafee0e"

0 comments on commit 73f08b1

Please sign in to comment.