Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

receive.sh 2.4 KiB

4 år sedan
6 år sedan
6 år sedan
6 år sedan
4 år sedan
4 år sedan
6 år sedan
4 år sedan
4 år sedan
6 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  2. ## import common lib
  3. . "$HOME/.noaa.conf"
  4. . "$HOME/.tweepy.conf"
  5. . "$NOAA_HOME/common.sh"
  6. ## pass start timestamp and sun elevation
  7. PASS_START=$(expr "$5" + 90)
  8. SUN_ELEV=$(python3 "$NOAA_HOME"/sun.py "$PASS_START")
  9. if pgrep "rtl_fm" > /dev/null
  10. then
  11. log "There is an existing rtl_fm instance running, I quit" "ERROR"
  12. exit 1
  13. fi
  14. # $1 = Satellite Name
  15. # $2 = Frequency
  16. # $3 = FileName base
  17. # $4 = TLE File
  18. # $5 = EPOC start time
  19. # $6 = Time to capture
  20. # $7 = Satellite max elevation
  21. log "Starting rtl_fm record" "INFO"
  22. timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -f "${2}"M -s 60k -g 50 -p 55 -E wav -E deemp -F 9 - | /usr/bin/sox -t raw -e signed -c 1 -b 16 -r 60000 - "${RAMFS_AUDIO}/audio/${3}.wav" rate 11025
  23. if [ ! -d "{NOAA_OUTPUT}/image/${FOLDER_DATE}" ]; then
  24. mkdir -m 775 -p "${NOAA_OUTPUT}/image/${FOLDER_DATE}"
  25. fi
  26. if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
  27. ENHANCEMENTS="ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT"
  28. else
  29. ENHANCEMENTS="ZA MCIR MCIR-precip"
  30. fi
  31. log "Bulding pass map" "INFO"
  32. /usr/local/bin/wxmap -T "${1}" -H "${4}" -p 0 -l 0 -o "${PASS_START}" "${NOAA_HOME}/map/${3}-map.png"
  33. for i in $ENHANCEMENTS; do
  34. log "Decoding image" "INFO"
  35. /usr/local/bin/wxtoimg -o -m "${NOAA_HOME}/map/${3}-map.png" -e "$i" "${RAMFS_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.png"
  36. /usr/bin/convert "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.png" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} $i ${START_DATE} Elevation: $7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.png"
  37. done
  38. if [ -n "$CONSUMER_KEY" ]; then
  39. log "Posting to Twitter" "INFO"
  40. if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
  41. python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.png" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MSA-precip.png" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVC-precip.png" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVCT-precip.png"
  42. else
  43. python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.png" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR.png"
  44. fi
  45. fi
  46. rm "${NOAA_HOME}/map/${3}-map.png"
  47. if [ "$DELETE_AUDIO" = true ]; then
  48. log "Deleting audio files" "INFO"
  49. rm "${RAMFS_AUDIO}/audio/${3}.wav"
  50. else
  51. log "Moving audio files out of the SD card" "INFO"
  52. mv "${RAMFS_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/audio/${3}.wav"
  53. fi