mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-31 13:10:19 -04:00 
			
		
		
		
	First steps to enable user control of phase calibration.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7504 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									1135c33f33
								
							
						
					
					
						commit
						c3d83a207a
					
				| @ -1,5 +1,5 @@ | ||||
| subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144,bcontest,  & | ||||
|      brxequal,ingain,mycall,hiscall,bshmsg,bswl,green,s,jh,line1,mygrid) | ||||
|      brxequal,btrain,ingain,mycall,hiscall,bshmsg,bswl,green,s,jh,line1,mygrid) | ||||
| 
 | ||||
| ! Input: | ||||
| !  k         pointer to the most recent new data | ||||
| @ -9,6 +9,7 @@ subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144,bcontest,  & | ||||
| !  ntol      Decoding range is +/- ntol | ||||
| !  bmsk144   Boolean, true if in MSK144 mode | ||||
| !  brxequal  Boolean, turns on equalization in MSK144 mode | ||||
| !  btrain    Boolean, turns on training in MSK144 mode | ||||
| !  ingain    Relative gain for spectra | ||||
| 
 | ||||
| ! Output: | ||||
| @ -21,7 +22,7 @@ subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144,bcontest,  & | ||||
|   character*12 mycall,hiscall | ||||
|   character*6 mygrid | ||||
|   integer*2 id2(0:120*12000-1) | ||||
|   logical*1 bmsk144,bcontest,bshmsg,brxequal,bswl | ||||
|   logical*1 bmsk144,bcontest,bshmsg,brxequal,btrain,bswl | ||||
|   real green(0:JZ-1) | ||||
|   real s(0:63,0:JZ-1) | ||||
|   real x(512) | ||||
| @ -84,7 +85,7 @@ subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144,bcontest,  & | ||||
|         tt2=sum(float(abs(id2(k0:k0+3583)))) | ||||
|         if(tt1.ne.0.0 .and. tt2.ne.0) then | ||||
|            call mskrtd(id2(k-7168+1:k),nutc0,tsec,ntol,nrxfreq,ndepth,   & | ||||
|                 mycall,mygrid,hiscall,bshmsg,bcontest,brxequal,bswl,line1) | ||||
|                 mycall,mygrid,hiscall,bshmsg,bcontest,brxequal,btrain,bswl,line1) | ||||
|         endif | ||||
|      endif | ||||
|   endif | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
|   subroutine msk144signalquality(cframe,snr,freq,t0,softbits,msg,dxcall,       & | ||||
|        brxequal,nbiterrors,eyeopening,trained,pcoeffs) | ||||
|        btrain,nbiterrors,eyeopening,trained,pcoeffs) | ||||
| 
 | ||||
|   character*22 msg,msgsent | ||||
|   character*12 dxcall | ||||
| @ -23,7 +23,7 @@ | ||||
|   integer values(8) | ||||
| 
 | ||||
|   logical*1 bcontest | ||||
|   logical*1 brxequal | ||||
|   logical*1 btrain | ||||
|   logical*1 first | ||||
|   logical*1 currently_training | ||||
|   logical*1 trained | ||||
| @ -77,7 +77,7 @@ write(*,*) 'reset to untrained state ' | ||||
|   indx_dxcall=index(msg,trim(dxcall)) | ||||
|   msg_has_dxcall = indx_dxcall .ge. 4 | ||||
| 
 | ||||
|   if( brxequal .and. msg_has_dxcall .and. (.not. trained) .and.               & | ||||
|   if( btrain .and. msg_has_dxcall .and. (.not. trained) .and.               & | ||||
|       .not. currently_training ) then | ||||
|     currently_training=.true. | ||||
|     training_dxcall=trim(dxcall) | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall,   & | ||||
|      bshmsg,bcontest,brxequal,bswl,line) | ||||
|      bshmsg,bcontest,brxequal,btrain,bswl,line) | ||||
| 
 | ||||
| ! Real-time decoder for MSK144.   | ||||
| ! Analysis block size = NZ = 7168 samples, t_block = 0.597333 s  | ||||
| @ -38,12 +38,13 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall,   & | ||||
|   real xmc(NPATTERNS) | ||||
|   real pcoeffs(3) | ||||
| 
 | ||||
|   logical*1 bshmsg,bcontest,brxequal,bswl | ||||
|   logical*1 bshmsg,bcontest,brxequal,btrain,bswl | ||||
|   logical*1 first | ||||
|   logical*1 trained  | ||||
|   logical*1 bshdecode | ||||
|   logical*1 seenb4 | ||||
|   logical*1 bflag | ||||
|   logical*1 bvar | ||||
|   | ||||
|   data first/.true./ | ||||
|   data iavpatterns/ & | ||||
| @ -96,7 +97,9 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall,   & | ||||
|   fac=1.0/rms | ||||
|   d(1:NZ)=fac*d(1:NZ) | ||||
|   d(NZ+1:NFFT1)=0. | ||||
|   call analytic(d,NZ,NFFT1,cdat,pcoeffs,brxequal,.false.)  ! never apply dynamic coeffs | ||||
|   bvar=brxequal | ||||
|   if( btrain ) bvar=.false.   ! if training, turn off rx eq | ||||
|   call analytic(d,NZ,NFFT1,cdat,pcoeffs,bvar,.false.)  ! never apply dynamic coeffs | ||||
| 
 | ||||
| ! Calculate average power for each frame and for the entire block. | ||||
| ! If decode is successful, largest power will be taken as signal+noise. | ||||
| @ -186,7 +189,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall,   & | ||||
| 
 | ||||
|   if(.not. bshdecode) then | ||||
|     call msk144signalquality(ct,snr0,fest,tdec,softbits,msgreceived,hiscall,   & | ||||
|                              brxequal,ncorrected,eyeopening,trained,pcoeffs) | ||||
|                              btrain,ncorrected,eyeopening,trained,pcoeffs) | ||||
|   endif | ||||
| 
 | ||||
|   decsym=' & ' | ||||
|  | ||||
| @ -66,9 +66,10 @@ extern "C" { | ||||
|                 int* minw, float* px, float s[], float* df3, int* nhsym, int* npts8); | ||||
| 
 | ||||
|   void hspec_(short int d2[], int* k, int* nutc0, int* ntrperiod, int* nrxfreq, int* ntol, | ||||
|               bool* bmsk144, bool* bcontest, bool* brxequalize, int* ingain, char mycall[], | ||||
|               char hiscall[], bool* bshmsg, bool* bswl, float green[], float s[], int* jh, | ||||
|               char line[], char mygrid[], int len1, int len2, int len3, int len4); | ||||
|               bool* bmsk144, bool* bcontest, bool* brxequalize, bool* btrain, int* ingain,  | ||||
|               char mycall[], char hiscall[], bool* bshmsg, bool* bswl, float green[],  | ||||
|               float s[], int* jh, char line[], char mygrid[], | ||||
|               int len1, int len2, int len3, int len4); | ||||
| 
 | ||||
|   void gen4_(char* msg, int* ichk, char* msgsent, int itone[], | ||||
|                int* itext, int len1, int len2); | ||||
| @ -256,6 +257,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, | ||||
|   m_bDoubleClickAfterCQnnn {false}, | ||||
|   m_bRefSpec {false}, | ||||
|   m_bClearRefSpec {false}, | ||||
|   m_bTrain {false}, | ||||
|   m_ihsym {0}, | ||||
|   m_nzap {0}, | ||||
|   m_px {0.0}, | ||||
| @ -1344,11 +1346,12 @@ void MainWindow::fastSink(qint64 frames) | ||||
|   bool bshmsg=ui->cbShMsgs->isChecked(); | ||||
|   bool bcontest=m_config.contestMode(); | ||||
|   bool brxequalize=m_config.rxEqualize(); | ||||
|   bool btrain=m_bTrain;  | ||||
|   bool bswl=ui->cbSWL->isChecked(); | ||||
|   strncpy(dec_data.params.hiscall,(hisCall + "            ").toLatin1 ().constData (), 12); | ||||
|   strncpy(dec_data.params.mygrid, (m_config.my_grid()+"      ").toLatin1(),6); | ||||
|   hspec_(dec_data.d2,&k,&nutc0,&nTRpDepth,&RxFreq,&m_Ftol,&bmsk144,&bcontest,&brxequalize, | ||||
|          &m_inGain,&dec_data.params.mycall[0],&dec_data.params.hiscall[0],&bshmsg,&bswl, | ||||
|    &btrain,&m_inGain,&dec_data.params.mycall[0],&dec_data.params.hiscall[0],&bshmsg,&bswl, | ||||
|          fast_green,fast_s,&fast_jh,&line[0],&dec_data.params.mygrid[0],12,12,80,6); | ||||
|   float px = fast_green[fast_jh]; | ||||
|   QString t; | ||||
| @ -1951,6 +1954,11 @@ void MainWindow::on_stopButton_clicked()                       //stopButton | ||||
|   if(m_bRefSpec) { | ||||
|     MessageBox::information_message (this, tr ("Reference spectrum saved")); | ||||
|     m_bRefSpec=false; | ||||
|     m_bTrain=false; | ||||
|   } | ||||
|   if(m_bTrain) { | ||||
|     MessageBox::information_message (this, tr ("Phase Training Disabled")); | ||||
|     m_bTrain=false; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| @ -6109,6 +6117,15 @@ void MainWindow::on_actionMeasure_reference_spectrum_triggered() | ||||
|   m_bRefSpec=true; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_actionMeasure_phase_response_triggered() | ||||
| { | ||||
|   if(m_bTrain) {  | ||||
|     m_bTrain=false; | ||||
|   } else { | ||||
|     m_bTrain=true; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_actionErase_reference_spectrum_triggered() | ||||
| { | ||||
|   m_bClearRefSpec=true; | ||||
|  | ||||
| @ -250,6 +250,7 @@ private slots: | ||||
|   void fast_decode_done(); | ||||
|   void on_actionMeasure_reference_spectrum_triggered(); | ||||
|   void on_actionErase_reference_spectrum_triggered(); | ||||
|   void on_actionMeasure_phase_response_triggered(); | ||||
|   void on_sbTR_valueChanged(int index); | ||||
|   void on_sbFtol_valueChanged(int index); | ||||
|   void on_cbFast9_clicked(bool b); | ||||
| @ -426,6 +427,7 @@ private: | ||||
|   bool    m_bDoubleClickAfterCQnnn; | ||||
|   bool    m_bRefSpec; | ||||
|   bool    m_bClearRefSpec; | ||||
|   bool    m_bTrain; | ||||
|   bool    m_bUseRef; | ||||
|   bool    m_bFastDone; | ||||
|   bool    m_bAltV; | ||||
|  | ||||
| @ -2461,6 +2461,7 @@ QPushButton[state="ok"] { | ||||
|      <string>Tools</string> | ||||
|     </property> | ||||
|     <addaction name="actionMeasure_reference_spectrum"/> | ||||
|     <addaction name="actionMeasure_phase_response"/> | ||||
|     <addaction name="actionErase_reference_spectrum"/> | ||||
|     <addaction name="actionFrequency_calibration"/> | ||||
|    </widget> | ||||
| @ -2963,6 +2964,11 @@ QPushButton[state="ok"] { | ||||
|     <string>Measure reference spectrum</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionMeasure_phase_response"> | ||||
|    <property name="text"> | ||||
|     <string>Measure phase response</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionErase_reference_spectrum"> | ||||
|    <property name="text"> | ||||
|     <string>Erase reference spectrum</string> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user