Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

receive_iss.sh 1.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. ### Run as a normal user
  3. if [ $EUID -eq 0 ]; then
  4. echo "This script shouldn't be run as root."
  5. exit 1
  6. fi
  7. ## import common lib
  8. . "$HOME/.noaa.conf"
  9. . "$HOME/.tweepy.conf"
  10. . "$NOAA_HOME/common.sh"
  11. if pgrep "rtl_fm" > /dev/null
  12. then
  13. log "There is an already running rtl_fm instance but I dont care for now, I prefer this pass" "INFO"
  14. pkill -9 -f rtl_fm
  15. fi
  16. # $1 = Satellite Name
  17. # $2 = Frequency
  18. # $3 = FileName base
  19. # $4 = TLE File
  20. # $5 = EPOC start time
  21. # $6 = Time to capture
  22. # $7 = Satellite max elevation
  23. log "Starting rtl_fm record" "INFO"
  24. timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -M fm -f 145.8M -s 48k -g $GAIN -E dc -E wav -E deemp -F 9 - | sox -t raw -r 48k -c 1 -b 16 -e s - -t wav "${NOAA_OUTPUT}/audio/${3}.wav" rate 11025
  25. if [ -f "/home/pi/raspberry-noaa/demod.py" ]; then
  26. log "Decoding ISS pass" "INFO"
  27. python3 /home/pi/raspberry-noaa/demod.py "${NOAA_OUTPUT}/audio/${3}.wav" "${NOAA_OUTPUT}/images/"
  28. decoded_pictures="$(find ${NOAA_OUTPUT}/images/ -iname "${3}*png")"
  29. img_count=0
  30. for image in $decoded_pictures; do
  31. ((img_count++))
  32. done
  33. sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, sat_type, img_count) values ($5,\"$3\", 1,0, 2, $img_count);"
  34. pass_id=$(sqlite3 /home/pi/raspberry-noaa/panel.db "select id from decoded_passes order by id desc limit 1;")
  35. sqlite3 /home/pi/raspberry-noaa/panel.db "update predict_passes set is_active = 0 where (predict_passes.pass_start) in (select predict_passes.pass_start from predict_passes inner join decoded_passes on predict_passes.pass_start = decoded_passes.pass_start where decoded_passes.id = $pass_id);"
  36. fi