diff --git a/receive.sh b/receive.sh index fe4c2a6..ef2aac2 100644 --- a/receive.sh +++ b/receive.sh @@ -9,12 +9,12 @@ fi # $4 = TLE File # $5 = EPOC start time # $6 = Time to capture -start=`date '+%d-%m-%Y %H:%M'` -timeout $6 rtl_fm -f ${2}M -s 60k -g 50 -p 55 -E wav -E deemp -F 9 - | sox -t raw -e signed -c 1 -b 16 -r 60000 - /home/pi/audio/$3.wav rate 11025 +START_DATE=$(date '+%d-%m-%Y %H:%M') +timeout "${6}" rtl_fm -f "${2}"M -s 60k -g 50 -p 55 -E wav -E deemp -F 9 - | sox -t raw -e signed -c 1 -b 16 -r 60000 - /home/pi/audio/"${3}".wav rate 11025 -PassStart=`expr $5 + 90` -/usr/local/bin/wxmap -T "${1}" -H $4 -p 0 -l 0 -o $PassStart /home/pi/map/${3}-map.png +PASS_START=$("$5" + 90) +/usr/local/bin/wxmap -T "${1}" -H "${4}" -p 0 -l 0 -o "${PASS_START}" /home/pi/map/"${3}"-map.png for i in ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT; do - /usr/local/bin/wxtoimg -o -m /home/pi/map/${3}-map.png -e $i /home/pi/audio/$3.wav /home/pi/image/$3-$i.png - /usr/bin/convert /home/pi/image/$3-$i.png -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "$1 $start" /home/pi/image/$3-$i.png + /usr/local/bin/wxtoimg -o -m /home/pi/map/"${3}"-map.png -e $i /home/pi/audio/"${3}".wav /home/pi/image/"${3}"-$i.png + /usr/bin/convert /home/pi/image/"${3}"-$i.png -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "$1 $START_DATE" /home/pi/image/"${3}"-$i.png done diff --git a/schedule.sh b/schedule.sh index 62c3b89..bd5803a 100644 --- a/schedule.sh +++ b/schedule.sh @@ -5,8 +5,7 @@ grep "NOAA 18" /home/pi/predict/weather.txt -A 2 >> /home/pi/predict/weather.tle grep "NOAA 19" /home/pi/predict/weather.txt -A 2 >> /home/pi/predict/weather.tle #Remove all AT jobs -for i in `atq | awk '{print $1}'`;do atrm $i;done - +for i in $(atq | awk '{print $1}');do atrm "$i";done #Schedule Satellite Passes: /home/pi/schedule_sat.sh "NOAA 19" 137.1000 diff --git a/schedule_sat.sh b/schedule_sat.sh index 5a9720d..6d1daf8 100644 --- a/schedule_sat.sh +++ b/schedule_sat.sh @@ -1,25 +1,25 @@ #!/bin/bash -PREDICTION_START=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" | head -1` -PREDICTION_END=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" | tail -1` +PREDICTION_START=$(/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" | head -1) +PREDICTION_END=$(/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" | tail -1) -var2=`echo $PREDICTION_END | cut -d " " -f 1` +var2=$(echo "$PREDICTION_END" | cut -d " " -f 1) -MAXELEV=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" | awk -v max=0 '{if($5>max){max=$5}}END{print max}'` +MAXELEV=$(/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" | awk -v max=0 '{if($5>max){max=$5}}END{print max}') -while [ `date --date="@${var2}" +%D` == `date +%D` ]; do - START_TIME=`echo $PREDICTION_START | cut -d " " -f 3-4` - var1=`echo $PREDICTION_START | cut -d " " -f 1` - var3=`echo $START_TIME | cut -d " " -f 2 | cut -d ":" -f 3` - TIMER=`expr $var2 - $var1 + $var3` - OUTDATE=`date --date="TZ=\"UTC\" $START_TIME" +%Y%m%d-%H%M%S` - if [ $MAXELEV -gt 19 ] - then - echo ${1//" "}${OUTDATE} $MAXELEV - echo "/home/pi/receive.sh \"${1}\" $2 ${1//" "}${OUTDATE} /home/pi/predict/weather.tle $var1 $TIMER" | at `date --date="TZ=\"UTC\" $START_TIME" +"%H:%M %D"` +while [ "$(date --date="@${var2}" +%D)" == "$(date +%D)" ]; do + START_TIME=$(echo "$PREDICTION_START" | cut -d " " -f 3-4) + var1=$(echo "$PREDICTION_START" | cut -d " " -f 1) + var3=$(echo "$START_TIME" | cut -d " " -f 2 | cut -d ":" -f 3) + TIMER=$("${var2}" - "${var1}" + "${var3}") + OUTDATE=$(date --date="TZ=\"UTC\" '${START_TIME}'" +%Y%m%d-%H%M%S) + if [ "${MAXELEV}" -gt 19 ] + then + echo "${1//" "}""${OUTDATE}" "$MAXELEV" + echo "/home/pi/receive.sh \"${1}\" $2 '${1//" "}'${OUTDATE} /home/pi/predict/weather.tle ${var1} '${TIMER}'" | at "$(date --date="TZ=\"UTC\" '${START_TIME}'" +"%H:%M %D")" fi - nextpredict=`expr $var2 + 60` - PREDICTION_START=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" $nextpredict | head -1` - PREDICTION_END=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" $nextpredict | tail -1` - MAXELEV=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" $nextpredict | awk -v max=0 '{if($5>max){max=$5}}END{print max}'` - var2=`echo $PREDICTION_END | cut -d " " -f 1` + nextpredict=$("${var2}" + 60) + PREDICTION_START=$(/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" "${nextpredict}" | head -1) + PREDICTION_END=$(/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" "${nextpredict}" | tail -1) + MAXELEV=$(/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" "${nextpredict}" | awk -v max=0 '{if($5>max){max=$5}}END{print max}') + var2=$(echo "${PREDICTION_END}" | cut -d " " -f 1) done