More work on FreqCal mode. Some of this code is temporary!

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7451 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2017-01-05 18:35:26 +00:00
parent fcaff0b9d1
commit 6d64eaa37b
5 changed files with 67 additions and 30 deletions

View File

@ -1,10 +1,10 @@
subroutine freqcal(id2,k,nfreq,ntol,line)
subroutine freqcal(id2,k,nkhz,noffset,ntol,line)
parameter (NZ=30*12000,NFFT=55296,NH=NFFT/2)
integer*2 id2(0:NZ-1)
real x(0:NFFT-1)
real s(NH)
character line*27
character line*80,cflag*1
complex cx(0:NH)
equivalence (x,cx)
data n/0/,k0/9999999/
@ -16,8 +16,8 @@ subroutine freqcal(id2,k,nfreq,ntol,line)
x=0.001*id2(k-NFFT:k-1)
call four2a(x,NFFT,1,-1,0) !Compute spectrum, r2c
df=12000.0/NFFT
ia=nint((nfreq-ntol)/df)
ib=nint((nfreq+ntol)/df)
ia=nint((noffset-ntol)/df)
ib=nint((noffset+ntol)/df)
smax=0.
s=0.
do i=ia,ib
@ -39,13 +39,20 @@ subroutine freqcal(id2,k,nfreq,ntol,line)
endif
enddo
ave=sum/nsum
pave=db(ave) + 8.0
snr=db(smax/ave)
! if(snr.lt.20.0) cflag='*'
pave=db(ave) + 8.0
cflag=' '
if(snr.lt.20.0) cflag='*'
n=n+1
write(line,1100) fpeak,snr
1100 format(2f8.1)
line(27:27)=char(0)
nsec=mod(time(),86400)
nhr=nsec/3600
nmin=mod(nsec/60,60)
nsec=mod(nsec,60)
ncal=1
ferr=fpeak-noffset
write(line,1100) nhr,nmin,nsec,nkhz,ncal,noffset,fpeak,ferr,pave, &
snr,callsign,cflag,char(0)
1100 format(i2.2,':',i2.2,':',i2.2,i7,i3,i6,2f10.3,2f7.1,2x,a6,2x,a1,a1)
return
end subroutine freqcal

View File

@ -119,7 +119,8 @@ extern "C" {
void refspectrum_(short int d2[], bool* bclearrefspec, bool* brefspec,
bool* buseref, const char* c_fname, int len);
void freqcal_(short d2[], int* k, int* nfreq, int* ntol, char line[], int len);
void freqcal_(short d2[], int* k, int* nkhz,int* noffset, int* ntol,
char line[], int len);
}
int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
@ -1095,7 +1096,7 @@ void MainWindow::fixStop()
void MainWindow::dataSink(qint64 frames)
{
static float s[NSMAX];
char line[27];
char line[80];
int k (frames);
QString fname {QDir::toNativeSeparators(m_dataDir.absoluteFilePath ("refspec.dat"))};
@ -1141,7 +1142,8 @@ void MainWindow::dataSink(qint64 frames)
fixStop();
if(m_mode=="FreqCal" and m_ihsym>=16 and m_ihsym%8==0) {
m_RxFreq=ui->RxFreqSpinBox->value ();
freqcal_(&dec_data.d2[0],&k,&m_RxFreq,&m_Ftol,&line[0],27);
int nkhz=(m_freqNominal+m_RxFreq)/1000;
freqcal_(&dec_data.d2[0],&k,&nkhz,&m_RxFreq,&m_Ftol,&line[0],80);
QString t=QString::fromLatin1(line);
DecodedText decodedtext;
@ -4541,8 +4543,10 @@ void MainWindow::on_actionFreqCal_triggered()
m_FFTSize = m_nsps / 2;
Q_EMIT FFTSize (m_FFTSize);
m_hsymStop=100;
ui->RxFreqSpinBox->setValue(1500);
setup_status_bar (true);
ui->decodedTextLabel->setText(" Freq S/N");
// 18:15:47 0 1 1500 1550.349 0.100 3.5 10.2
ui->decodedTextLabel->setText(" UTC Freq CAL Offset fMeas DF Level S/N");
}
void MainWindow::switch_mode (Mode mode)
@ -6068,17 +6072,27 @@ void MainWindow::fastPick(int x0, int x1, int y)
}
}
void MainWindow::on_actionSave_reference_spectrum_triggered()
void MainWindow::on_actionMeasure_reference_spectrum_triggered()
{
if(!m_monitoring) on_monitorButton_clicked (true);
m_bRefSpec=true;
}
void MainWindow::on_actionClear_reference_spectrum_triggered()
void MainWindow::on_actionErase_reference_spectrum_triggered()
{
m_bClearRefSpec=true;
}
void MainWindow::on_actionFrequency_calibration_triggered()
{
static int n=-1;
double fMHz[]={0.660,0.880,1.210,2.500,3.330,5.000,
7.850,10.000,14.670,15.000,20.000};
m_freqNominal=1000000.0*fMHz[++n] - m_RxFreq + 0.5;
if(n>=10) n=-1;
on_bandComboBox_activated(-1);
}
void MainWindow::on_sbCQTxFreq_valueChanged(int)
{
setXIT (ui->TxFreqSpinBox->value ());

View File

@ -246,8 +246,9 @@ private slots:
void on_actionFast_Graph_triggered();
void on_actionHide_Controls_triggered();
void fast_decode_done();
void on_actionSave_reference_spectrum_triggered();
void on_actionClear_reference_spectrum_triggered();
void on_actionMeasure_reference_spectrum_triggered();
void on_actionErase_reference_spectrum_triggered();
void on_actionFrequency_calibration_triggered();
void on_sbTR_valueChanged(int index);
void on_sbFtol_valueChanged(int index);
void on_cbFast9_clicked(bool b);

View File

@ -2376,9 +2376,6 @@ QPushButton[state="ok"] {
<addaction name="actionOpen_next_in_directory"/>
<addaction name="actionDecode_remaining_files_in_directory"/>
<addaction name="separator"/>
<addaction name="actionSave_reference_spectrum"/>
<addaction name="actionClear_reference_spectrum"/>
<addaction name="separator"/>
<addaction name="actionDelete_all_wav_files_in_SaveDir"/>
<addaction name="actionErase_ALL_TXT"/>
<addaction name="actionErase_wsjtx_log_adi"/>
@ -2459,12 +2456,21 @@ QPushButton[state=&quot;ok&quot;] {
<string>Configurations</string>
</property>
</widget>
<widget class="QMenu" name="menuTools">
<property name="title">
<string>Tools</string>
</property>
<addaction name="actionMeasure_reference_spectrum"/>
<addaction name="actionErase_reference_spectrum"/>
<addaction name="actionFrequency_calibration"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuConfig"/>
<addaction name="menuView"/>
<addaction name="menuMode"/>
<addaction name="menuDecode"/>
<addaction name="menuSave"/>
<addaction name="menuTools"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusBar"/>
@ -2893,11 +2899,6 @@ QPushButton[state=&quot;ok&quot;] {
<string>F9</string>
</property>
</action>
<action name="actionSave_reference_spectrum">
<property name="text">
<string>Measure reference spectrum</string>
</property>
</action>
<action name="download_samples_action">
<property name="text">
<string>&amp;Download Samples ...</string>
@ -2938,11 +2939,6 @@ QPushButton[state=&quot;ok&quot;] {
<string/>
</property>
</action>
<action name="actionClear_reference_spectrum">
<property name="text">
<string>Clear reference spectrum</string>
</property>
</action>
<action name="actionHide_Controls">
<property name="text">
<string>Hide menus and labels</string>
@ -2962,6 +2958,24 @@ QPushButton[state=&quot;ok&quot;] {
<string>FreqCal</string>
</property>
</action>
<action name="actionMeasure_reference_spectrum">
<property name="text">
<string>Measure reference spectrum</string>
</property>
</action>
<action name="actionErase_reference_spectrum">
<property name="text">
<string>Erase reference spectrum</string>
</property>
</action>
<action name="actionFrequency_calibration">
<property name="text">
<string>Frequency calibration</string>
</property>
<property name="shortcut">
<string>Ctrl+F10</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View File

@ -7,6 +7,7 @@
<tr><td><b>Alt+F4 </b></td><td>Exit program</td></tr>
<tr><td><b>F5 </b></td><td>Display special mouse commands</td></tr>
<tr><td><b>F6 </b></td><td>Open next file in directory</td></tr>
<tr><td><b>F7 </b></td><td>Display Message Averaging window</td></tr>
<tr><td><b>Shift+F6 </b></td><td>Decode all remaining files in directrory</td></tr>
<tr><td><b>F11 </b></td><td>Move Rx frequency down 1 Hz</td></tr>
<tr><td><b>Ctrl+F11 </b></td><td>Move Rx and Tx frequencies down 1 Hz</td></tr>