Parcourir la source

add receive iss

tags/v1.7
Nico Rey il y a 3 ans
Parent
révision
d60e7bfaf0
9 fichiers modifiés avec 70 ajouts et 28 suppressions
  1. +2
    -2
      receive.sh
  2. +42
    -3
      receive_iss.sh
  3. +1
    -1
      receive_meteor.sh
  4. +6
    -7
      schedule.sh
  5. +1
    -0
      schedule_iss.sh
  6. +1
    -0
      templates/noaa.conf
  7. +11
    -10
      templates/webpanel/Model/Conn.php
  8. +5
    -4
      templates/webpanel/Views/V_viewLastImages.php
  9. +1
    -1
      templates/webpanel_schema.sql

+ 2
- 2
receive.sh Voir le fichier

@@ -53,9 +53,9 @@ done
rm "${NOAA_HOME}/map/${3}-map.png"

if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, is_noaa) values ($5,\"$3\", 1,1);"
sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, sat_type) values ($5,\"$3\", 1,1);"
else
sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, is_noaa) values ($5,\"$3\", 0,1);"
sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, sat_type) values ($5,\"$3\", 0,1);"
fi

pass_id=$(sqlite3 /home/pi/raspberry-noaa/panel.db "select id from decoded_passes order by id desc limit 1;")


+ 42
- 3
receive_iss.sh Voir le fichier

@@ -1,3 +1,42 @@
#!/bin/sh
datetime=$(date +"%Y%m%d-%H%M%S")
timeout 660 /usr/local/bin/rtl_fm -M fm -f 145.8M -s 48k -g $GAIN -p 55 -E wav -E deemp -F 9 - | /usr/bin/sox -t raw -e signed -c 1 -b 16 -r 48000 - /usr/share/html/iss/iss-$datetime.wav rate 11025
#!/bin/bash

### Run as a normal user
if [ $EUID -eq 0 ]; then
echo "This script shouldn't be run as root."
exit 1
fi

## import common lib
. "$HOME/.noaa.conf"
. "$HOME/.tweepy.conf"
. "$NOAA_HOME/common.sh"

if pgrep "rtl_fm" > /dev/null
then
log "There is an already running rtl_fm instance but I dont care for now, I prefer this pass" "INFO"
pkill -9 -f rtl_fm
fi

# $1 = Satellite Name
# $2 = Frequency
# $3 = FileName base
# $4 = TLE File
# $5 = EPOC start time
# $6 = Time to capture
# $7 = Satellite max elevation

log "Starting rtl_fm record" "INFO"
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

if [ -f "/home/pi/raspberry-noaa/demod.py" ]; then
log "Decoding ISS pass" "INFO"
python3 /home/pi/raspberry-noaa/demod.py "${NOAA_OUTPUT}/audio/${3}.wav" "${NOAA_OUTPUT}/images/"
decoded_pictures="$(find ${NOAA_OUTPUT}/images/ -iname "${3}*png")"
img_count=0
for image in $decoded_pictures; do
((img_count++))
done
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);"
pass_id=$(sqlite3 /home/pi/raspberry-noaa/panel.db "select id from decoded_passes order by id desc limit 1;")
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);"
fi

+ 1
- 1
receive_meteor.sh Voir le fichier

@@ -82,7 +82,7 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then
rm "${METEOR_OUTPUT}/${3}.bmp"
rm "${METEOR_OUTPUT}/${3}.dec"

sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, is_noaa) values ($5,\"$3\", 1,0);"
sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, sat_type) values ($5,\"$3\", 1,0);"
pass_id=$(sqlite3 /home/pi/raspberry-noaa/panel.db "select id from decoded_passes order by id desc limit 1;")
if [ -n "$CONSUMER_KEY" ]; then
log "Posting to Twitter" "INFO"


+ 6
- 7
schedule.sh Voir le fichier

@@ -10,24 +10,23 @@ fi
. "$HOME/.noaa.conf"
. "$NOAA_HOME/common.sh"

### Run as a normal user
if [ $EUID -eq 0 ]; then
die "This script shouldn't be run as root."
fi

wget -qr http://www.celestrak.com/NORAD/elements/weather.txt -O "${NOAA_HOME}"/predict/weather.txt
wget -qr http://www.celestrak.com/NORAD/elements/amateur.txt -O "${NOAA_HOME}"/predict/amateur.txt
grep "NOAA 15" "${NOAA_HOME}"/predict/weather.txt -A 2 > "${NOAA_HOME}"/predict/weather.tle
grep "NOAA 18" "${NOAA_HOME}"/predict/weather.txt -A 2 >> "${NOAA_HOME}"/predict/weather.tle
grep "NOAA 19" "${NOAA_HOME}"/predict/weather.txt -A 2 >> "${NOAA_HOME}"/predict/weather.tle
grep "METEOR-M 2" "${NOAA_HOME}"/predict/weather.txt -A 2 >> "${NOAA_HOME}"/predict/weather.tle
# grep "ZARYA" "${NOAA_HOME}"/predict/amateur.txt -A 2 > "${NOAA_HOME}"/predict/amateur.tle
if [ "$SCHEDULE_ISS" == "true" ]; then
grep "ZARYA" "${NOAA_HOME}"/predict/amateur.txt -A 2 > "${NOAA_HOME}"/predict/amateur.tle
fi

#Remove all AT jobs
for i in $(atq | awk '{print $1}');do atrm "$i";done

#Schedule Satellite Passes:
#"${NOAA_HOME}"/schedule_iss.sh "ISS (ZARYA)" 145.8000
if [ "$SCHEDULE_ISS" == "true" ]; then
"${NOAA_HOME}"/schedule_iss.sh "ISS (ZARYA)" 145.8000
fi
"${NOAA_HOME}"/schedule_meteor.sh "METEOR-M 2" 137.1000
"${NOAA_HOME}"/schedule_sat.sh "NOAA 19" 137.1000
"${NOAA_HOME}"/schedule_sat.sh "NOAA 18" 137.9125


+ 1
- 0
schedule_iss.sh Voir le fichier

@@ -33,6 +33,7 @@ while [ "$(date --date="@${var2}" +%D)" = "$(date +%D)" ]; do
echo ${SATNAME} "${OUTDATE}" "$MAXELEV"
echo "${NOAA_HOME}/receive_iss.sh \"${1}\" $2 ISS${OUTDATE} "${NOAA_HOME}"/predict/amateur.tle \
${var1} ${TIMER} ${MAXELEV}" | at "$(date --date="TZ=\"UTC\" ${START_TIME}" +"%H:%M %D")"
sqlite3 /home/pi/raspberry-noaa/panel.db "insert or replace into predict_passes (sat_name,pass_start,pass_end,max_elev,is_active) values (\"$SATNAME\",$var1,$var2,$MAXELEV,1);"
fi
NEXTPREDICT=$(expr "${var2}" + 60)
PREDICTION_START=$(/usr/bin/predict -t "${NOAA_HOME}"/predict/amateur.tle -p "${1}" "${NEXTPREDICT}" | head -1)


+ 1
- 0
templates/noaa.conf Voir le fichier

@@ -12,3 +12,4 @@ BIAS_TEE="enable_bias_tee"
DELETE_AUDIO="true"
FLIP_METEOR_IMG="true"
GAIN=50
SCHEDULE_ISS="true"

+ 11
- 10
templates/webpanel/Model/Conn.php Voir le fichier

@@ -28,7 +28,7 @@
public function getImages($page, $img_per_page) {
$query = $this->con->prepare("SELECT decoded_passes.id, predict_passes.pass_start,
file_path, is_noaa, predict_passes.sat_name, predict_passes.max_elev
file_path, sat_type, predict_passes.sat_name, predict_passes.max_elev
FROM decoded_passes INNER JOIN predict_passes
ON predict_passes.pass_start = decoded_passes.pass_start
ORDER BY decoded_passes.pass_start DESC LIMIT ? OFFSET ?;");
@@ -45,19 +45,20 @@
}
public function getEnhacements($id) {
$query = $this->con->prepare('SELECT daylight_pass, is_noaa
$query = $this->con->prepare('SELECT daylight_pass, sat_type
FROM decoded_passes WHERE id = ?;');
$query->bindValue(1, $id);
$result = $query->execute();
$pass = $result->fetchArray();
if ($pass['is_noaa'] == 0) {
$enhacements = ['-122-rectified.jpg'];
} else {
if ($pass['daylight_pass'] == 1) {
$enhacements = ['-ZA.jpg','-MCIR.jpg','-MCIR-precip.jpg','-MSA.jpg','-MSA-precip.jpg','-HVC.jpg','-HVC-precip.jpg','-HVCT.jpg','-HVCT-precip.jpg'];
} else {
$enhacements = ['-ZA.jpg','-MCIR.jpg','-MCIR-precip.jpg'];
}
switch($pass['sat_type']) {
case 0:
$ending = "-122-rectified.jpg";
case 1:
if ($pass['daylight_pass'] == 1) {
$enhacements = ['-ZA.jpg','-MCIR.jpg','-MCIR-precip.jpg','-MSA.jpg','-MSA-precip.jpg','-HVC.jpg','-HVC-precip.jpg','-HVCT.jpg','-HVCT-precip.jpg'];
} else {
$enhacements = ['-ZA.jpg','-MCIR.jpg','-MCIR-precip.jpg'];
}
}
return $enhacements;
}


+ 5
- 4
templates/webpanel/Views/V_viewLastImages.php Voir le fichier

@@ -20,10 +20,11 @@
echo "<tr>";
$col_count=1;
}
if ($image['is_noaa'] == true) {
$ending = "-MCIR.jpg";
} else {
$ending = "-122-rectified.jpg";
switch($image['sat_type']) {
case 0:
$ending = "-122-rectified.jpg";
case 1:
$ending = "-MCIR.jpg";
}
echo "<td><div id =\"satimgdiv\"><a href=". "detail.php?id=" . $image['id'] ."><img id=\"satimg\" src=". $baseurl . "thumb/" . $image['file_path'] . $ending ."></img></a></div>";
echo "<ul><li>". $image['sat_name'] ."</li>";


+ 1
- 1
templates/webpanel_schema.sql Voir le fichier

@@ -10,5 +10,5 @@ CREATE TABLE decoded_passes(
id integer primary key autoincrement,
pass_start integer,
file_path text not null,
daylight_pass boolean, is_noaa boolean,
daylight_pass boolean, is_noaa boolean, sat_type integer, img_count integer,
foreign key(pass_start) references passes(pass_start));

Chargement…
Annuler
Enregistrer