diff --git a/scripts/a.sh b/scripts/a.sh index 2e1233d..e43808b 100755 --- a/scripts/a.sh +++ b/scripts/a.sh @@ -393,18 +393,22 @@ case "$MODE_OUTPUT" in "CARRIER") echo ====================== CARRIER ========================== -sudo $PATHRPI"/rpidatv" -i videots -s $SYMBOLRATE_K -c "carrier" -f $FREQUENCY_OUT -p $GAIN -m $MODE -x $PIN_I -y $PIN_Q & +# sudo $PATHRPI"/rpidatv" -i videots -s $SYMBOLRATE_K -c "carrier" -f $FREQUENCY_OUT -p $GAIN -m $MODE -x $PIN_I -y $PIN_Q & + +# Temporary fix for swapped carrier and test modes: +sudo $PATHRPI"/rpidatv" -i videots -s $SYMBOLRATE_K -c "tesmode" -f $FREQUENCY_OUT -p $GAIN -m $MODE -x $PIN_I -y $PIN_Q & + ;; # *********************************** TESTMODE ****************************************** "TESTMODE") -sudo $PATHRPI"/rpidatv" -i videots -s $SYMBOLRATE_K -c "tesmode" -f $FREQUENCY_OUT -p $GAIN -m $MODE -x $PIN_I -y $PIN_Q & +# sudo $PATHRPI"/rpidatv" -i videots -s $SYMBOLRATE_K -c "tesmode" -f $FREQUENCY_OUT -p $GAIN -m $MODE -x $PIN_I -y $PIN_Q & + +# Temporary fix for swapped carrier and test modes: +sudo $PATHRPI"/rpidatv" -i videots -s $SYMBOLRATE_K -c "carrier" -f $FREQUENCY_OUT -p $GAIN -m $MODE -x $PIN_I -y $PIN_Q & ;; - - - esac diff --git a/scripts/copy_config.sh b/scripts/copy_config.sh index 192e867..c9915a5 100644 --- a/scripts/copy_config.sh +++ b/scripts/copy_config.sh @@ -1,3 +1,5 @@ +## Updated for version 201701270 + ####### Set Environment Variables ############### PATHSCRIPT=/home/pi/rpidatv/scripts @@ -92,6 +94,9 @@ set_config_var gpio_q "$TRANSFER" $NEWCONFIGFILE TRANSFER=$(get_config_var pathmedia $OLDCONFIGFILE) set_config_var pathmedia "$TRANSFER" $NEWCONFIGFILE +TRANSFER=$(get_config_var locator $OLDCONFIGFILE) +set_config_var locator "$TRANSFER" $NEWCONFIGFILE + TRANSFER=$(get_config_var pidstart $OLDCONFIGFILE) set_config_var pidstart "$TRANSFER" $NEWCONFIGFILE @@ -110,5 +115,14 @@ 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 +if grep -q analogcaminput /home/pi/rpidatvconfig.txt; then + # File includes analogcaminput and analogcammname + # Which were added in 201701020 + + TRANSFER=$(get_config_var analogcaminput $OLDCONFIGFILE) + set_config_var analogcaminput "$TRANSFER" $NEWCONFIGFILE + + TRANSFER=$(get_config_var analogcamstandard $OLDCONFIGFILE) + set_config_var analogcamstandard "$TRANSFER" $NEWCONFIGFILE +fi + diff --git a/scripts/ctlfilter.sh b/scripts/ctlfilter.sh index 7a14231..2982f19 100755 --- a/scripts/ctlfilter.sh +++ b/scripts/ctlfilter.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ########## ctlfilter.sh ############ # Called by a.sh in IQ mode to switch in correct @@ -12,8 +14,8 @@ # <550 011 # <1100 100 # <2200 101 -# >=2200 110 - +# >=2200 110 + # Band Outputs: # <100 00 (71 MHz) diff --git a/scripts/ctlvco.sh b/scripts/ctlvco.sh index ff35833..f094f3c 100755 --- a/scripts/ctlvco.sh +++ b/scripts/ctlvco.sh @@ -1,7 +1,7 @@ ########## ctlvco.sh ############ -# Called by a.sh in IQ mode to set ADF4351 -# vco to correct frequency +# Called by a.sh in IQ mode to set ADF4351 vco +# to correct frequency with correct ref freq and level ############ Set Environment Variables ############### @@ -26,13 +26,30 @@ end EOF } -############### Read Frequency ######################### +########### Read Frequency and Ref Frequency ############### FREQM=$(get_config_var freqoutput $CONFIGFILE) +FREQR=$(get_config_var adfref $CONFIGFILE) + +INT_FREQ_OUTPUT=${FREQM%.*} + +############### Switch Power based on Frequency ######## + +if (( $INT_FREQ_OUTPUT \< 100 )); then + PWR=$(get_config_var adflevel0 $CONFIGFILE); +elif (( $INT_FREQ_OUTPUT \< 250 )); then + PWR=$(get_config_var adflevel1 $CONFIGFILE); +elif (( $INT_FREQ_OUTPUT \< 950 )); then + PWR=$(get_config_var adflevel2 $CONFIGFILE); +elif (( $INT_FREQ_OUTPUT \< 4400 )); then + PWR=$(get_config_var adflevel3 $CONFIGFILE); +else + PWR="0"; +fi ############### Call binary to set frequency ######## -sudo $PATHRPI"/adf4351" $FREQM +sudo $PATHRPI"/adf4351" $FREQM $FREQR $PWR ### End ### diff --git a/scripts/langgb.sh b/scripts/langgb.sh index 4f482cd..bab4a74 100644 --- a/scripts/langgb.sh +++ b/scripts/langgb.sh @@ -4,9 +4,9 @@ StrInputSetupTitle="Input choice" StrInputSetupDescription="Press down/up arrows to move, space to select" StrInputSetupCAMH264="Pi Camera, H264 Encoding" StrInputSetupCAMMPEG_2="Pi Camera, MPEG-2 Encoding (for old Sat RX)" -StrInputSetupFILETS="Transport stream file (.ts)" +StrInputSetupFILETS="Play a Transport stream file (.ts)" StrInputSetupPATERNAUDIO="JPEG Pictures From File (no audio)" -StrInputSetupCARRIER="Only Carrier" +StrInputSetupCARRIER="Carrier with no Modulation" StrInputSetupTESTMODE="Testmode for Carrier Null" StrInputSetupIPTSIN="Transport stream from network" StrInputSetupFILETSName="TS file is now" @@ -16,10 +16,10 @@ StrInputSetupIPTSINTitle="Setup IP address" StrInputSetupANALOGCAM="Analog (EasyCap) Video Input" StrInputSetupANALOGCAMTitle="Analog input setup" StrInputSetupANALOGCAMName="Input analog name (/dev/video0)" -StrInputSetupVNC="Display PC via VNC" +StrInputSetupVNC="Show PC Desktop via VNC" StrInputSetupVNCName="IP of PC using VNC (password datv)" StrInputSetupVNCTitle="VNC setup" -StrInputSetupDESKTOP="Touchscreen or Raspberry display" +StrInputSetupDESKTOP="Show Touchscreen or Raspberry Pi Display" StrPIN_IContext="I GPIO {12,18,40} (12 is default:pin32)" StrPIN_ITitle="I output GPIO" StrPIN_QContext="Q GPIO {13,19,41}(13 is defaut:pin33)" @@ -35,13 +35,13 @@ StrLocatorTitle="Locator" ######## OUTPUT MENU ##################### StrOutputSetupTitle="Output type" StrOutputSetupContext="Press down/up arrows to move, space to select" -StrOutputSetupIQ="IQ output for external modulator" -StrOutputSetupRF="QPSK direct in RF" -StrOutputSetupBATC="Stream to BATC" -StrOutputSetupDigithin="Digithin card" -StrOutputSetupDTX1="DTX1" +StrOutputSetupIQ="IQ output for Portsdown filter modulator board" +StrOutputSetupRF="UGLY Test Mode. No modulator required." +StrOutputSetupBATC="Stream to BATC.TV" +StrOutputSetupDigithin="Use Digithin Modulator Card" +StrOutputSetupDTX1="Use DTX1 TS Extender Card" StrOutputSetupDATVExpress="DatvExpress" -StrOutputSetupIP="Transmit on network" +StrOutputSetupIP="Transmit on IP network" StrOutputSetupIPTSOUTName="IP address: 230.0.0.1 for example" StrOutputSetupIPTSOUTTitle="Output network setup" diff --git a/scripts/latest_version.txt b/scripts/latest_version.txt index c68ce48..fd1a043 100644 --- a/scripts/latest_version.txt +++ b/scripts/latest_version.txt @@ -1,2 +1,2 @@ -201701230 +201701270 diff --git a/scripts/menu.sh b/scripts/menu.sh index 8d0e88c..798c46a 100755 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -579,7 +579,8 @@ do_freq_setup() FREQ_OUTPUT=$(get_config_var freqoutput $CONFIGFILE) FREQ=$(whiptail --inputbox "$StrOutputRFFreqContext" 8 78 $FREQ_OUTPUT --title "$StrOutputRFFreqTitle" 3>&1 1>&2 2>&3) if [ $? -eq 0 ]; then - set_config_var freqoutput "$FREQ" $CONFIGFILE + set_config_var freqoutput "$FREQ" $CONFIGFILE + $PATHSCRIPT"/ctlfilter.sh" ## Refresh the band switching fi } @@ -910,24 +911,108 @@ do_EasyCap() fi } +do_audio_switch() +{ + AUDIO=$(get_config_var audio $CONFIGFILE) + case "$AUDIO" in + usb) + Radio1=ON + Radio2=OFF + ;; + easycap) + Radio1=OFF + Radio2=ON + esac + + AUDIO=$(whiptail --title "SELECT AUDIO SOURCE" --radiolist \ + "Select one" 20 78 8 \ + "usb" "Use the USB Audio Dongle Input" $Radio1 \ + "easycap" "Use the EasyCap Audio Input" $Radio2 \ + 3>&2 2>&1 1>&3) + + if [ $? -eq 0 ]; then ## If the selection has changed + set_config_var audio "$AUDIO" $CONFIGFILE + fi + + whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 +} + do_Update() { reset $PATHSCRIPT"/check_for_update.sh" } + do_presets() { -whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + + PFREQ1=$(get_config_var pfreq1 $CONFIGFILE) + PFREQ1=$(whiptail --inputbox "Enter Preset Frequency 1 in MHz" 8 78 $PFREQ1 --title "SET TOUCHSCREEN PRESETS" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var pfreq1 "$PFREQ1" $CONFIGFILE + fi + + PFREQ2=$(get_config_var pfreq2 $CONFIGFILE) + PFREQ2=$(whiptail --inputbox "Enter Preset Frequency 2 in MHz" 8 78 $PFREQ2 --title "SET TOUCHSCREEN PRESETS" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var pfreq2 "$PFREQ2" $CONFIGFILE + fi + + PFREQ3=$(get_config_var pfreq3 $CONFIGFILE) + PFREQ3=$(whiptail --inputbox "Enter Preset Frequency 3 in MHz" 8 78 $PFREQ3 --title "SET TOUCHSCREEN PRESETS" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var pfreq3 "$PFREQ3" $CONFIGFILE + fi + + PFREQ4=$(get_config_var pfreq4 $CONFIGFILE) + PFREQ4=$(whiptail --inputbox "Enter Preset Frequency 4 in MHz" 8 78 $PFREQ4 --title "SET TOUCHSCREEN PRESETS" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var pfreq4 "$PFREQ4" $CONFIGFILE + fi + + PFREQ5=$(get_config_var pfreq5 $CONFIGFILE) + PFREQ5=$(whiptail --inputbox "Enter Preset Frequency 5 in MHz" 8 78 $PFREQ5 --title "SET TOUCHSCREEN PRESETS" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var pfreq5 "$PFREQ5" $CONFIGFILE + fi + } do_4351_ref() { -whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + ADFREF=$(get_config_var adfref $CONFIGFILE) + ADFREF=$(whiptail --inputbox "Enter oscillator frequency in Hz" 8 78 $ADFREF --title "SET ADF4351 REFERENCE OSCILLATOR" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var adfref "$ADFREF" $CONFIGFILE + fi } do_4351_levels() { -whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + ADFLEVEL0=$(get_config_var adflevel0 $CONFIGFILE) + ADFLEVEL0=$(whiptail --inputbox "Enter 0 to 3 = plus 0, 3, 6 or 9 dB" 8 78 $ADFLEVEL0 --title "SET ADF4351 LEVEL FOR THE 71 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var adflevel0 "$ADFLEVEL0" $CONFIGFILE + fi + + ADFLEVEL1=$(get_config_var adflevel1 $CONFIGFILE) + ADFLEVEL1=$(whiptail --inputbox "Enter 0 to 3 = plus 0, 3, 6 or 9 dB" 8 78 $ADFLEVEL1 --title "SET ADF4351 LEVEL FOR THE 146 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var adflevel1 "$ADFLEVEL1" $CONFIGFILE + fi + + ADFLEVEL2=$(get_config_var adflevel2 $CONFIGFILE) + ADFLEVEL2=$(whiptail --inputbox "Enter 0 to 3 = plus 0, 3, 6 or 9 dB" 8 78 $ADFLEVEL2 --title "SET ADF4351 LEVEL FOR THE 437MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var adflevel2 "$ADFLEVEL2" $CONFIGFILE + fi + + ADFLEVEL3=$(get_config_var adflevel3 $CONFIGFILE) + ADFLEVEL3=$(whiptail --inputbox "Enter 0 to 3 = plus 0, 3, 6 or 9 dB" 8 78 $ADFLEVEL3 --title "SET ADF4351 LEVEL FOR THE 1255 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var adflevel3 "$ADFLEVEL3" $CONFIGFILE + fi } do_SD_info() @@ -937,17 +1022,116 @@ $PATHSCRIPT"/sd_card_info.sh" do_set_express() { -whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + + EXPLEVEL0=$(get_config_var explevel0 $CONFIGFILE) + EXPLEVEL0=$(whiptail --inputbox "Enter 0 to 47" 8 78 $EXPLEVEL0 --title "SET DATV EXPRESS OUTPUT LEVEL FOR THE 71 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var explevel0 "$EXPLEVEL0" $CONFIGFILE + fi + + EXPLEVEL1=$(get_config_var explevel1 $CONFIGFILE) + EXPLEVEL1=$(whiptail --inputbox "Enter 0 to 47" 8 78 $EXPLEVEL1 --title "SET DATV EXPRESS OUTPUT LEVEL FOR THE 146 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var explevel1 "$EXPLEVEL1" $CONFIGFILE + fi + + EXPLEVEL2=$(get_config_var explevel2 $CONFIGFILE) + EXPLEVEL2=$(whiptail --inputbox "Enter 0 to 47" 8 78 $EXPLEVEL2 --title "SET DATV EXPRESS OUTPUT LEVEL FOR THE 437 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var explevel2 "$EXPLEVEL2" $CONFIGFILE + fi + + EXPLEVEL3=$(get_config_var explevel3 $CONFIGFILE) + EXPLEVEL3=$(whiptail --inputbox "Enter 0 to 47" 8 78 $EXPLEVEL3 --title "SET DATV EXPRESS OUTPUT LEVEL FOR THE 1255 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var explevel3 "$EXPLEVEL3" $CONFIGFILE + fi } do_numbers() { -whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + + NUMBERS0=$(get_config_var numbers0 $CONFIGFILE) + NUMBERS0=$(whiptail --inputbox "Enter 4 digits" 8 78 $NUMBERS0 --title "SET CONTEST NUMBERS FOR THE 71 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var numbers0 "$NUMBERS0" $CONFIGFILE + fi + + NUMBERS1=$(get_config_var numbers1 $CONFIGFILE) + NUMBERS1=$(whiptail --inputbox "Enter 4 digits" 8 78 $NUMBERS1 --title "SET CONTEST NUMBERS FOR THE 146 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var numbers1 "$NUMBERS1" $CONFIGFILE + fi + + NUMBERS2=$(get_config_var numbers2 $CONFIGFILE) + NUMBERS2=$(whiptail --inputbox "Enter 4 digits" 8 78 $NUMBERS2 --title "SET CONTEST NUMBERS FOR THE 437 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var numbers2 "$NUMBERS2" $CONFIGFILE + fi + + NUMBERS3=$(get_config_var numbers3 $CONFIGFILE) + NUMBERS3=$(whiptail --inputbox "Enter 4 digits" 8 78 $NUMBERS3 --title "SET CONTEST NUMBERS FOR THE 1255 MHz BAND" 3>&1 1>&2 2>&3) + if [ $? -eq 0 ]; then + set_config_var numbers3 "$NUMBERS3" $CONFIGFILE + fi } do_vfinder() { -whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + + VFINDER=$(get_config_var vfinder $CONFIGFILE) + case "$VFINDER" in + on) + Radio1=ON + Radio2=OFF + ;; + off) + Radio1=OFF + Radio2=ON + esac + + VFINDER=$(whiptail --title "SET VIEWFINDER ON OR OFF" --radiolist \ + "Select one" 20 78 8 \ + "on" "Transmitted image displayed on Touchscreen" $Radio1 \ + "off" "Buttons displayed on touchscreen during transmit" $Radio2 \ + 3>&2 2>&1 1>&3) + + if [ $? -eq 0 ]; then ## If the selection has changed + set_config_var vfinder "$VFINDER" $CONFIGFILE + fi + + whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 +} + +do_beta() +{ + whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 + + BETA=$(get_config_var beta $CONFIGFILE) + case "$BETA" in + no) + Radio1=ON + Radio2=OFF + ;; + yes) + Radio1=OFF + Radio2=ON + esac + + BETA=$(whiptail --title "USE BETA (EXPERIMENTAL) ENCODING?" --radiolist \ + "Select one" 20 78 8 \ + "no" "Stable software with core features" $Radio1 \ + "yes" "Experimental software with new features" $Radio2 \ + 3>&2 2>&1 1>&3) + + if [ $? -eq 0 ]; then ## If the selection has changed + set_config_var beta "$BETA" $CONFIGFILE + fi + + whiptail --title "Not implemented yet" --msgbox "Not Implemented yet. Please press enter to continue" 8 78 } do_system_setup() @@ -960,7 +1144,8 @@ menuchoice=$(whiptail --title "$StrSystemTitle" --menu "$StrSystemContext" 16 78 "5 WiFi Off" "Turn the WiFi Off" \ "6 Enable DigiThin" "Not Implemented Yet" \ "7 Set-up EasyCap" "Set input socket and PAL/NTSC" \ - "8 Update" "Check for Updated rpidatv Software" \ + "8 Audio Input" "Select USB Dongle or EasyCap" \ + "9 Update" "Check for Updated rpidatv Software" \ 3>&2 2>&1 1>&3) case "$menuchoice" in 1\ *) do_autostart_setup ;; @@ -970,7 +1155,8 @@ menuchoice=$(whiptail --title "$StrSystemTitle" --menu "$StrSystemContext" 16 78 5\ *) do_WiFi_Off ;; 6\ *) do_Enable_DigiThin ;; 7\ *) do_EasyCap ;; - 8\ *) do_Update ;; + 8\ *) do_audio_switch;; + 9\ *) do_Update ;; esac } @@ -984,6 +1170,7 @@ menuchoice=$(whiptail --title "$StrSystemTitle" --menu "$StrSystemContext" 16 78 "5 DATV Express" "Configure Advanced DATV Express Settings" \ "6 Contest Numbers" "Set Contest Numbers for each band" \ "7 Viewfinder" "Disable or Enable Viewfinder on Touchscreen" \ + "8 Beta Software" "Choose whether to use experimental software" \ 3>&2 2>&1 1>&3) case "$menuchoice" in 1\ *) do_presets ;; @@ -993,7 +1180,8 @@ menuchoice=$(whiptail --title "$StrSystemTitle" --menu "$StrSystemContext" 16 78 5\ *) do_set_express ;; 6\ *) do_numbers ;; 7\ *) do_vfinder ;; - esac + 8\ *) do_beta ;; + esac } @@ -1068,7 +1256,7 @@ menuchoice=$(whiptail --title "Shutdown Menu" --menu "Select Choice" 16 78 7 \ "1 Shutdown now" "Immediate Shutdown" \ "2 Reboot now" "Immediate reboot" \ "3 Exit to Linux" "Exit menu to Command Prompt" \ - "4 Restore TouchScreen" "Exit Menu, restart LCD" \ + "4 Restore TouchScreen" "Exit to LCD. Use ctrl-C to return" \ "5 Button Enable" "Enable Shutdown Button" \ "6 Button Disable" "Disable Shutdown Button" \ 3>&2 2>&1 1>&3) @@ -1127,6 +1315,10 @@ fi display_splash status="0" +# Set Band (and Filter) Switching + +$PATHSCRIPT"/ctlfilter.sh" + # Check whether to go straight to transmit or display the menu if [ "$1" != "menu" ]; then # if tx on boot OnStartup # go straight to transmit @@ -1154,9 +1346,9 @@ while [ "$status" -eq 0 ] # Display main menu menuchoice=$(whiptail --title "$StrMainMenuTitle" --menu "$INFO" 16 82 9 \ - "0 Transmit" "Go to transmit" \ - "1 Source" "$StrMainMenuSource" \ - "2 Output" "$StrMainMenuOutput" \ + "0 Transmit" $FREQ_OUTPUT" Mhz, "$SYMBOLRATEK" KS, FEC "$FECNUM"/"$FECDEN"." \ + "1 Source" "$StrMainMenuSource"" ("$MODE_INPUT" selected)" \ + "2 Output" "$StrMainMenuOutput"" ("$MODE_OUTPUT" selected)" \ "3 Station" "$StrMainMenuCall" \ "4 Receive" "Receive via rtlsdr" \ "5 System" "$StrMainMenuSystem" \ diff --git a/scripts/rpidatvconfig.txt b/scripts/rpidatvconfig.txt index 6ed17f8..d249ffa 100644 --- a/scripts/rpidatvconfig.txt +++ b/scripts/rpidatvconfig.txt @@ -1,10 +1,10 @@ -modeinput=DESKTOP +modeinput=FILETS symbolrate=333 fec=7 freqoutput=437 rfpower=7 modeoutput=IQ -tsvideofile=/home/pi/rpidatv/video/f4day.ts +tsvideofile=/home/pi/rpidatv/video/G8GKQ_11_12_2016_12h50_24.TS call=BATC paternfile=/home/pi/rpidatv/video udpinaddr=230.0.0.2 @@ -23,3 +23,24 @@ analogcamname=/dev/video0 analogcaminput=0 analogcamstandard=6 startup=Console +pfreq1=71 +pfreq2=146.5 +pfreq3=437 +pfreq4=1249 +pfreq5=1255 +adfref=25000000 +adflevel0=0 +adflevel1=0 +adflevel2=0 +adflevel3=0 +explevel0=30 +explevel1=30 +explevel2=30 +explevel3=30 +numbers0=0000 +numbers1=1111 +numbers2=2222 +numbers3=3333 +audio=usb +vfinder=on +beta=no diff --git a/src/adf4351/adf4351.h b/src/adf4351/adf4351.h index 1370709..a423eb2 100644 --- a/src/adf4351/adf4351.h +++ b/src/adf4351/adf4351.h @@ -121,7 +121,7 @@ #define ADF4350_MAX_FREQ_45_PRESC 3000000000ULL /* Hz */ #define ADF4350_MAX_FREQ_PFD 32000000 /* Hz */ #define ADF4350_MAX_BANDSEL_CLK 125000 /* Hz */ -#define ADF4350_MAX_FREQ_REFIN 250000000 /* Hz */ +#define ADF4350_MAX_FREQ_REFIN 250010000 /* Hz reased to allow for adjustment*/ #define ADF4350_MAX_MODULUS 4095 #define ADF4350_MAX_R_CNT 1023 diff --git a/src/adf4351/ctladf4351.c b/src/adf4351/ctladf4351.c index 4b98e48..0f05e12 100644 --- a/src/adf4351/ctladf4351.c +++ b/src/adf4351/ctladf4351.c @@ -11,94 +11,105 @@ #include #include "adf4351.h" -adf4350_init_param MyAdf= -{.clkin=25000000, -.channel_spacing=5000, -.power_up_frequency=437000000, -.reference_div_factor=0, -.reference_doubler_enable=0, -.reference_div2_enable=0, - - // r2_user_settings -.phase_detector_polarity_positive_enable=1, -.lock_detect_precision_6ns_enable=0, -.lock_detect_function_integer_n_enable=0, -.charge_pump_current=7, // FixMe -.muxout_select=0, -.low_spur_mode_enable=1, - - // r3_user_settings -.cycle_slip_reduction_enable=1, -.charge_cancellation_enable=0, -.anti_backlash_3ns_enable=0, -.band_select_clock_mode_high_enable=1, -.clk_divider_12bit=0, -.clk_divider_mode=0, - - // r4_user_settings -.aux_output_enable=1, -.aux_output_fundamental_enable=1, -.mute_till_lock_enable=0, -.output_power=0,//-4dbm -.aux_output_power=0 - -}; uint32_t registers[6] = {0x4580A8, 0x80080C9, 0x4E42, 0x4B3, 0xBC803C, 0x580005}; -uint32_t power = 0; -//REG 0 -//REG1 1000000000001000000011001 001 -//REG2 100111001000 010 -//REG3 10010110 011 -//REG4 101111001000000000111 100 +//REG0 0100 0101 1000 0000 1010 1000 +//REG1 1000 0000 0000 1000 0000 1100 1001 +//REG2 0100 1110 0100 0010 +//REG3 0100 1011 0011 +//REG4 1011 1100 1000 0000 0011 1100 +//REG5 0101 1000 0000 0000 0000 0101 /***************************************************************************//** - * @brief Powers off or sets the Synth frequency. + * @brief Powers off or sets the Synth ref freq, output freq and power level. * - * @param "off" or freq in MHz (float). + * @param "off" or freq in MHz (float), optional ref freq in Hz and optional power 0 - 3 * * @return 0 or 1 if freq out of bounds *******************************************************************************/ int main(int argc, char *argv[]) { - if (wiringPiSetup() == -1); + // Kick Wiring Pi into life + if (wiringPiSetup() == -1); - if (strcmp(argv[1], "off") == 0) - { - // Turn VCO Off and return + // set parameter defaults + uint32_t adf4350_requested_frequency = 1255000000; + uint32_t adf4350_requested_ref_freq = 25000000; + uint16_t adf4350_requested_power = 0; - adf4350_out_altvoltage0_powerdown(1); + // Check first parameter + if (argc==1 || strcmp(argv[1], "off") == 0) + { + // No frequency specified or turnoff requested + // Turn VCO Off and return - return 0; - } - else if ( atof(argv[1])>=35 && atof(argv[1])<=4400 ) - { - // Valid freq, so set it - uint32_t adf4350_requested_frequency = 1000000 * atof(argv[1]); + adf4350_out_altvoltage0_powerdown(1); + return 0; + } - if (argc==3 && atof(argv[2])>=0 && atof(argv[2])<=3 ) - { - // VCO Power level specified, so set it - power = atof(argv[2]); - } - else - { - // VCO Power level not specified or invalid so set to default of 0 - power = 0; - } - // Set up the ADF - adf4350_setup(0,0,MyAdf); - // Turn it on - adf4350_out_altvoltage0_frequency(adf4350_requested_frequency); + else if ( atof(argv[1])>=35 && atof(argv[1])<=4400 ) + { + // Valid freq, so set it + adf4350_requested_frequency = 1000000 * atof(argv[1]); - return 0; - } - else - { - // Requested freq out of limits so print error and return 1 - printf("ERROR: Requested Frequency out of limits"); + // Check second parameter + if (argc>=3 && atof(argv[2])>=4995000 && atof(argv[2])<=25010000) + { + // valid reference osc freq, so set it + adf4350_requested_ref_freq = atof(argv[2]); + } - return 1; - } + // Check third parameter + if (argc>=4 && atof(argv[3])>=0 && atof(argv[3])<=3 ) + { + // Valid VCO Power level specified, so set it + adf4350_requested_power = atof(argv[3]); + } + + // Valid input so set parameters + adf4350_init_param MyAdf= + { + // Calculation inputs + .clkin=adf4350_requested_ref_freq, + .channel_spacing=5000, + .power_up_frequency=adf4350_requested_frequency, + .reference_div_factor=0, + .reference_doubler_enable=0, + .reference_div2_enable=0, + + // r2_user_settings + .phase_detector_polarity_positive_enable=1, + .lock_detect_precision_6ns_enable=0, + .lock_detect_function_integer_n_enable=0, + .charge_pump_current=7, // FixMe + .muxout_select=0, + .low_spur_mode_enable=1, + + // r3_user_settings + .cycle_slip_reduction_enable=1, + .charge_cancellation_enable=0, + .anti_backlash_3ns_enable=0, + .band_select_clock_mode_high_enable=1, + .clk_divider_12bit=0, + .clk_divider_mode=0, + + // r4_user_settings + .aux_output_enable=0, + .aux_output_fundamental_enable=1, + .mute_till_lock_enable=1, + .output_power=adf4350_requested_power, + .aux_output_power=0 + }; + + // Send the commands to the ADF4351 + adf4350_setup(0,0,MyAdf); + return 0; + } + else + { + // Requested freq out of limits so print error and return 1 + printf("ERROR: Requested Frequency out of limits"); + return 1; + } } diff --git a/src/gui/rpidatvtouch.c b/src/gui/rpidatvtouch.c index 304c77b..8a7aaec 100644 --- a/src/gui/rpidatvtouch.c +++ b/src/gui/rpidatvtouch.c @@ -454,6 +454,11 @@ void SelectFreq(int NoButton) //Frequency char Param[]="freqoutput"; printf("************** Set Frequency = %s\n",freqtxt); SetConfigParam(PATH_CONFIG,Param,freqtxt); + + // Set the Band (and filter) Switching + + system ("sudo /home/pi/rpidatv/scripts/ctlfilter.sh"); + } @@ -989,6 +994,10 @@ int main(int argc, char **argv) { if(strcmp(Value,"Waveshare")==0) Inversed=1; +// Set the Band (and filter) Switching + + system ("sudo /home/pi/rpidatv/scripts/ctlfilter.sh"); + // Determine if ReceiveDirect 2nd argument if(argc>2) ReceiveDirect=atoi(argv[2]);