-
Notifications
You must be signed in to change notification settings - Fork 2
/
wspr-server
executable file
·94 lines (83 loc) · 3.28 KB
/
wspr-server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
#
# Scheduling script, that times recording of wspr transmissions
#
# Copyright (C) 2016-present Clemens Heese / PA7T <pa7t@wsprlive.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# check if unsubmitted wspr spots are stored on sd-card
if [ -e /opt/redpitaya/www/apps/sdr_wspr/ALL_WSPR.TXT ]; then
echo "Unsubmitted ALL_WSPR.TXT found!"
cp /opt/redpitaya/www/apps/sdr_wspr/ALL_WSPR.TXT /dev/shm/
rw
rm /opt/redpitaya/www/apps/sdr_wspr/ALL_WSPR.TXT
ro
fi
# start server operation
MAC_LAST=`ip addr show eth0 | sed -n "s/.*ether \([^ ]*\).*/\1/p" | sed -n "s/://pg" | sed 's/.*\(.\{6\}\)/\1/'`
while true
do sleep 1
#echo `date`" Sleeping ..."
. /opt/redpitaya/www/apps/sdr_wspr/wspr-vars.sh
cp /opt/redpitaya/www/apps/sdr_wspr/write-c2-files*.cfg /dev/shm
# OPTION: measure PPM deviation via 1pps signal on DIO3_N
if [ "$ENABLE_PPM_PPS" == true ] ; then
CORR=`/opt/redpitaya/www/apps/sdr_wspr/measure-corr 30` || exit
for file in /dev/shm/write-c2-files*.cfg
do
sed -i "/^corr/s/=.*/= $CORR;/" $file
done
fi
# wait till next decode finishes: second 53
SECONDS=`date +%S`
if [ $(( `date +%M | sed 's/^0//'` % 2)) -eq 0 ]
then
#echo 'Sleeping for '`expr 120 - $SECONDS`' s'
sleep `expr 120 - 7 - $SECONDS`
else
#echo 'Sleeping for '`expr 60 - $SECONDS`' s'
sleep `expr 60 - 7 - $SECONDS`
fi
# OPTION: measure PPM deviation to external reference
if [ "$ENABLE_PPM_CORR_GPS" == true ] ; then
cat /opt/redpitaya/www/apps/sdr_wspr/rez_counter.bit > /dev/xdevcfg # load reziprocal counter bitstream
rw
/opt/redpitaya/www/apps/sdr_wspr/update_ppm_ext.sh >> /opt/redpitaya/www/apps/sdr_wspr/ppm_$MAC_LAST.log
cat /opt/redpitaya/www/apps/sdr_wspr/sdr_transceiver_wspr.bit > /dev/xdevcfg # load sdr_wspr bitstream
fi
# wait till beginn of next minute
SECONDS=`date +%S`
if [ $(( `date +%M | sed 's/^0//'` % 2)) -eq 0 ]
then
#echo 'Sleeping for '`expr 120 - $SECONDS`' s'
sleep `expr 120 - $SECONDS`
else
#echo 'Sleeping for '`expr 60 - $SECONDS`' s'
sleep `expr 60 - $SECONDS`
fi
#echo "Starting recording with nohup in background"
nohup sh /opt/redpitaya/www/apps/sdr_wspr/decode-wspr-parallel.sh >> /dev/shm/sdr-wspr.log 2>&1 &
# OPTION: record temperature during wspr receiption and correct ppm value
#sleep 10 # wait till fpga is heating oscillator constantly
if [ "$ENABLE_PPM_CORR" == true ] ; then
sh -c '/opt/redpitaya/www/apps/sdr_wspr/update_ppm.sh 110' # record PPM during wspr receiption and correct ppm value
fi
# copy unsubmitted wspr receiptions to sd-card every hour
if [ $(( `date +%M | sed 's/^0//'` )) -eq 0 ]
then
rw
cp /dev/shm/ALL_WSPR.TXT /opt/redpitaya/www/apps/sdr_wspr/
ro
fi
done