Merge pull request #7 from BritishAmateurTelevisionClub/batc_staging

Release of 201701020 - EasyCap Config
pull/61/head
Dave Crump 2017-01-03 20:03:09 +00:00 zatwierdzone przez GitHub
commit 2386888d25
8 zmienionych plików z 177 dodań i 26 usunięć

Wyświetl plik

@ -1,10 +0,0 @@
RpiDATV is software for Raspberry Pi which allows to transmit DVB-S
There is an interactive menu :
gbmenu.sh is in english
frmenu.sh is in french
All the parameters ar written in rpidatvconfig.txt
For media (Transport stream and jpeg pictures), by default there should be placed on a USB key plugged.
Folder by default could be changed with the parameter pathmedia.
If you prefere to have files on SD card you could set for example pathmedia=/home/pi

Wyświetl plik

@ -1,10 +1,14 @@
#! /bin/bash
# set -x #Uncomment for testing
############# SET GLOBAL VARIABLES ####################
PATHRPI="/home/pi/rpidatv/bin"
PATHSCRIPT="/home/pi/rpidatv/scripts"
CONFIGFILE=$PATHSCRIPT"/rpidatvconfig.txt"
############ FUNCTION TO READ CONFIG FILE #############################
get_config_var() {
lua - "$1" "$2" <<EOF
local key=assert(arg[1])
@ -39,7 +43,7 @@ detect_audio()
devicea="/proc/asound/card1"
if [ -e "$devicea" ]; then
AUDIO_CARD=1
else
else
AUDIO_CARD=0
fi
@ -71,6 +75,8 @@ PIN_I=$(get_config_var gpio_i $CONFIGFILE)
PIN_Q=$(get_config_var gpio_q $CONFIGFILE)
ANALOGCAMNAME=$(get_config_var analogcamname $CONFIGFILE)
ANALOGCAMINPUT=$(get_config_var analogcaminput $CONFIGFILE)
ANALOGCAMSTANDARD=$(get_config_var analogcamstandard $CONFIGFILE)
VNCADDR=$(get_config_var vncaddr $CONFIGFILE)
#v4l2-ctl --overlay=0
@ -315,6 +321,15 @@ $PATHRPI"/avc2ts" -b $BITRATE_VIDEO -m $BITRATE_TS -x $VIDEO_WIDTH -y $VIDEO_HEI
#============================================ ANALOG =============================================================
"ANALOGCAM")
if [ "$ANALOGCAMINPUT" != "-" ]; then
v4l2-ctl -d $ANALOGCAMNAME "--set-input="$ANALOGCAMINPUT
fi
if [ "$ANALOGCAMSTANDARD" != "-" ]; then
v4l2-ctl -d $ANALOGCAMNAME "--set-standard="$ANALOGCAMSTANDARD
fi
sudo modprobe -r bcm2835_v4l2
case "$MODE_OUTPUT" in
"BATC")

Wyświetl plik

@ -0,0 +1,114 @@
####### Set Environment Variables ###############
PATHSCRIPT=/home/pi/rpidatv/scripts
OLDCONFIGFILE=/home/pi/rpidatvconfig.txt
NEWCONFIGFILE=$PATHSCRIPT"/rpidatvconfig.txt"
####### Define Functions ########################
set_config_var() {
lua - "$1" "$2" "$3" <<EOF > "$3.bak"
local key=assert(arg[1])
local value=assert(arg[2])
local fn=assert(arg[3])
local file=assert(io.open(fn))
local made_change=false
for line in file:lines() do
if line:match("^#?%s*"..key.."=.*$") then
line=key.."="..value
made_change=true
end
print(line)
end
if not made_change then
print(key.."="..value)
end
EOF
mv "$3.bak" "$3"
}
get_config_var() {
lua - "$1" "$2" <<EOF
local key=assert(arg[1])
local fn=assert(arg[2])
local file=assert(io.open(fn))
for line in file:lines() do
local val = line:match("^#?%s*"..key.."=(.*)$")
if (val ~= nil) then
print(val)
break
end
end
EOF
}
####### Transfer each value to the New File ###############
TRANSFER=$(get_config_var modeinput $OLDCONFIGFILE)
set_config_var modeinput "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var symbolrate $OLDCONFIGFILE)
set_config_var symbolrate "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var fec $OLDCONFIGFILE)
set_config_var fec "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var freqoutput $OLDCONFIGFILE)
set_config_var freqoutput "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var rfpower $OLDCONFIGFILE)
set_config_var rfpower "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var modeoutput $OLDCONFIGFILE)
set_config_var modeoutput "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var tsvideofile $OLDCONFIGFILE)
set_config_var tsvideofile "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var call $OLDCONFIGFILE)
set_config_var call "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var paternfile $OLDCONFIGFILE)
set_config_var paternfile "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var udpinaddr $OLDCONFIGFILE)
set_config_var udpinaddr "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var pidvideo $OLDCONFIGFILE)
set_config_var pidvideo "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var pidpmt $OLDCONFIGFILE)
set_config_var pidpmt "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var serviceid $OLDCONFIGFILE)
set_config_var serviceid "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var gpio_i $OLDCONFIGFILE)
set_config_var gpio_i "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var gpio_q $OLDCONFIGFILE)
set_config_var gpio_q "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var pathmedia $OLDCONFIGFILE)
set_config_var pathmedia "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var pidstart $OLDCONFIGFILE)
set_config_var pidstart "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var pidaudio $OLDCONFIGFILE)
set_config_var pidaudio "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var display $OLDCONFIGFILE)
set_config_var display "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var menulanguage $OLDCONFIGFILE)
set_config_var menulanguage "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var analogcamname $OLDCONFIGFILE)
set_config_var analogcamname "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var startup $OLDCONFIGFILE)
set_config_var startup "$TRANSFER" $NEWCONFIGFILE
TRANSFER=$(get_config_var modeinput $OLDCONFIGFILE)
set_config_var modeinput "$TRANSFER" $NEWCONFIGFILE

Wyświetl plik

@ -1 +1 @@
201612310
201701020

Wyświetl plik

@ -7,6 +7,8 @@ PATHRPI=/home/pi/rpidatv/bin
CONFIGFILE=$PATHSCRIPT"/rpidatvconfig.txt"
PATHCONFIGS="/home/pi/rpidatv/scripts/configs" ## Path to config files
############ Function to Write to Config File ###############
set_config_var() {
lua - "$1" "$2" "$3" <<EOF > "$3.bak"
local key=assert(arg[1])
@ -28,6 +30,8 @@ EOF
mv "$3.bak" "$3"
}
############ Function to Read from Config File ###############
get_config_var() {
lua - "$1" "$2" <<EOF
local key=assert(arg[1])
@ -43,6 +47,8 @@ end
EOF
}
############ Function to Select Files ###############
Filebrowser() {
if [ -z $1 ]; then
imgpath=$(ls -lhp / | awk -F ' ' ' { print $9 " " $5 } ')
@ -321,11 +327,9 @@ LOCATOR=$(whiptail --inputbox "$StrLocatorContext" 8 78 $LOCATOR --title "$StrLo
if [ $? -eq 0 ]; then
set_config_var locator "$LOCATOR" $CONFIGFILE
fi
}
do_output_setup_mode() {
MODE_OUTPUT=$(get_config_var modeoutput $CONFIGFILE)
case "$MODE_OUTPUT" in
@ -862,7 +866,17 @@ whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please pr
do_EasyCap()
{
whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78
ACINPUT=$(get_config_var analogcaminput $CONFIGFILE)
ACINPUT=$(whiptail --inputbox "Enter 0 for Composite, 1 for S-VHS, - for not set" 8 78 $ACINPUT --title "SET EASYCAP INPUT NUMBER" 3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then
set_config_var analogcaminput "$ACINPUT" $CONFIGFILE
fi
ACSTANDARD=$(get_config_var analogcamstandard $CONFIGFILE)
ACSTANDARD=$(whiptail --inputbox "Enter 0 for NTSC, 6 for PAL, - for not set" 8 78 $ACSTANDARD --title "SET EASYCAP VIDEO STANDARD" 3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then
set_config_var analogcamstandard "$ACSTANDARD" $CONFIGFILE
fi
}
do_Update()
@ -880,7 +894,7 @@ menuchoice=$(whiptail --title "$StrSystemTitle" --menu "$StrSystemContext" 16 78
"4 WiFi Set-up" "SSID and password" \
"5 WiFi Off" "Turn the WiFi Off" \
"6 Enable DigiThin" "Not Implemented Yet" \
"7 Set EasyCap" "Not implemented yet" \
"7 Set-up EasyCap" "Set input socket and PAL/NTSC" \
"8 Update" "Check for Updated rpidatv Software" \
3>&2 2>&1 1>&3)
case "$menuchoice" in
@ -1034,7 +1048,7 @@ FREQ_OUTPUT=$(get_config_var freqoutput $CONFIGFILE)
GAIN_OUTPUT=$(get_config_var rfpower $CONFIGFILE)
let FECNUM=FEC
let FECDEN=FEC+1
INFO=$CALL":"$MODE_INPUT"-->"$MODE_OUTPUT"("$SYMBOLRATEK"KSymbol FEC "$FECNUM"/"$FECDEN") sur "$FREQ_OUTPUT"Mhz Gain "$GAIN_OUTPUT
INFO=$CALL":"$MODE_INPUT"-->"$MODE_OUTPUT"("$SYMBOLRATEK"KSymbol FEC "$FECNUM"/"$FECDEN") on "$FREQ_OUTPUT"Mhz Gain "$GAIN_OUTPUT

Wyświetl plik

@ -1,7 +1,7 @@
modeinput=CAMH264
symbolrate=333
modeinput=ANALOGCAM
symbolrate=1000
fec=7
freqoutput=1249
freqoutput=1255
rfpower=7
modeoutput=IQ
tsvideofile=/home/pi/rpidatv/video/f4day.ts
@ -20,4 +20,6 @@ pidaudio=257
display=Waveshare
menulanguage=en
analogcamname=/dev/video0
analogcaminput=-
analogcamstandard=-
startup=Console

Wyświetl plik

@ -1,6 +1,6 @@
#!/bin/bash
# Updated by davecrump 20161221
# Updated by davecrump 20170103
# Modified to overwrite ~/rpidatv/scripts and
# ~/rpidatv/src, then compile
@ -107,10 +107,16 @@ cd /home/pi
#sudo install fbcp /usr/local/bin/fbcp
#cd ../../
# Restore rpidatvconfig.txt
# Comment out if upgrade changes format of file
cp -f -r /home/pi/rpidatvconfig.txt /home/pi/rpidatv/scripts/rpidatvconfig.txt
rm -rf /home/pi/rpidatvconfig.txt
# Restore or update rpidatvconfig.txt
if ! grep -q analogcaminput /home/pi/rpidatvconfig.txt; then
# File needs updating
source /home/pi/rpidatv/scripts/copy_config.sh
else
# File is correct format
cp -f -r /home/pi/rpidatvconfig.txt /home/pi/rpidatv/scripts/rpidatvconfig.txt
fi
rm -f /home/pi/rpidatvconfig.txt
rm -f /home/pi/rpidatv/scripts/copy_config.sh
# Update the version number
rm -rf /home/pi/rpidatv/scripts/installed_version.txt
@ -119,7 +125,7 @@ cp -f -r /home/pi/prev_installed_version.txt /home/pi/rpidatv/scripts/prev_insta
rm -rf /home/pi/prev_installed_version.txt
# Offer reboot
printf "A reboot will be required before using the update.\n"
printf "A reboot may be required before using the update.\n"
printf "Do you want to reboot now? (y/n)\n"
read -n 1
printf "\n"

Wyświetl plik

@ -1,3 +1,13 @@
201701020
Added parameters in rpidatvconfig.txt to select input and TV standard for Analog Cam
Changes in menu.sh to store analog cam parameters
Changes in a.sh set analog cam parameters
201612310
Added installation of fbi (frame buffer imager)
Used fbi to blank screen behind received picture
Added BATC logo when screen not in use.
201612202
Swapped TS File button offgui for Analog cam button
added 125 button and removed 500 BUTTON