mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-31 13:10:19 -04:00 
			
		
		
		
	Added "Tune" button.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3168 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									2277827bb3
								
							
						
					
					
						commit
						fa29bab31d
					
				| @ -38,12 +38,6 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) : | |||||||
|         "QLabel { background-color : black; color : yellow; }"); |         "QLabel { background-color : black; color : yellow; }"); | ||||||
|   ui->labDialFreq->setStyleSheet( \ |   ui->labDialFreq->setStyleSheet( \ | ||||||
|         "QLabel { background-color : black; color : yellow; }"); |         "QLabel { background-color : black; color : yellow; }"); | ||||||
| /*
 |  | ||||||
|   ui->labTol1->setStyleSheet( \ |  | ||||||
|         "QLabel { background-color : white; color : black; }"); |  | ||||||
|   ui->labTol1->setFrameStyle(QFrame::Panel | QFrame::Sunken); |  | ||||||
|   ui->dxStationGroupBox->setStyleSheet("QFrame{border: 5px groove red}"); |  | ||||||
| */ |  | ||||||
|   QActionGroup* paletteGroup = new QActionGroup(this); |   QActionGroup* paletteGroup = new QActionGroup(this); | ||||||
|   ui->actionCuteSDR->setActionGroup(paletteGroup); |   ui->actionCuteSDR->setActionGroup(paletteGroup); | ||||||
|   ui->actionLinrad->setActionGroup(paletteGroup); |   ui->actionLinrad->setActionGroup(paletteGroup); | ||||||
| @ -181,6 +175,7 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) : | |||||||
|   m_msErase=0; |   m_msErase=0; | ||||||
|   m_sent73=false; |   m_sent73=false; | ||||||
|   m_watchdogLimit=5; |   m_watchdogLimit=5; | ||||||
|  |   m_tune=false; | ||||||
|   decodeBusy(false); |   decodeBusy(false); | ||||||
| 
 | 
 | ||||||
|   ui->xThermo->setFillBrush(Qt::green); |   ui->xThermo->setFillBrush(Qt::green); | ||||||
| @ -222,6 +217,10 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) : | |||||||
|   m_pbAutoOn_style="QPushButton{background-color: red; \
 |   m_pbAutoOn_style="QPushButton{background-color: red; \
 | ||||||
|       border-style: outset; border-width: 1px; border-radius: 5px; \ |       border-style: outset; border-width: 1px; border-radius: 5px; \ | ||||||
|       border-color: black; min-width: 5em; padding: 3px;}"; |       border-color: black; min-width: 5em; padding: 3px;}"; | ||||||
|  |   m_pbTune_style="QPushButton{background-color: red; \
 | ||||||
|  |       border-style: outset; border-width: 1px; border-radius: 5px; \ | ||||||
|  |       border-color: black; min-width: 5em; padding: 3px;}"; | ||||||
|  | 
 | ||||||
|   genStdMsgs(m_rpt); |   genStdMsgs(m_rpt); | ||||||
|   on_actionWide_Waterfall_triggered();                   //###
 |   on_actionWide_Waterfall_triggered();                   //###
 | ||||||
|   g_pWideGraph->setTxFreq(m_txFreq); |   g_pWideGraph->setTxFreq(m_txFreq); | ||||||
| @ -710,6 +709,7 @@ void MainWindow::on_autoButton_clicked()                     //Auto | |||||||
| 
 | 
 | ||||||
| void MainWindow::on_stopTxButton_clicked()                    //Stop Tx
 | void MainWindow::on_stopTxButton_clicked()                    //Stop Tx
 | ||||||
| { | { | ||||||
|  |   if(m_tune) on_tuneButton_clicked(); | ||||||
|   if(m_auto) on_autoButton_clicked(); |   if(m_auto) on_autoButton_clicked(); | ||||||
|   btxok=false; |   btxok=false; | ||||||
| } | } | ||||||
| @ -1386,9 +1386,9 @@ void MainWindow::guiUpdate() | |||||||
|   int nsec=ms/1000; |   int nsec=ms/1000; | ||||||
|   double tsec=0.001*ms; |   double tsec=0.001*ms; | ||||||
|   double t2p=fmod(tsec,2*m_TRperiod); |   double t2p=fmod(tsec,2*m_TRperiod); | ||||||
|   bool bTxTime = (t2p >= tx1) && (t2p < tx2); |   bool bTxTime = ((t2p >= tx1) and (t2p < tx2)) or m_tune; | ||||||
| 
 | 
 | ||||||
|   if(m_auto) { |   if(m_auto or m_tune) { | ||||||
| 
 | 
 | ||||||
|     QFile f("txboth"); |     QFile f("txboth"); | ||||||
|     if(f.exists() and fmod(tsec,m_TRperiod) < (1.0 + 85.0*m_nsps/12000.0)) { |     if(f.exists() and fmod(tsec,m_TRperiod) < (1.0 + 85.0*m_nsps/12000.0)) { | ||||||
| @ -1396,7 +1396,8 @@ void MainWindow::guiUpdate() | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     float fTR=float((nsec%m_TRperiod))/m_TRperiod; |     float fTR=float((nsec%m_TRperiod))/m_TRperiod; | ||||||
|     if(bTxTime and m_iptt==0 and !btxMute and fTR<0.4) { | //    if(bTxTime and m_iptt==0 and !btxMute and fTR<0.4) {
 | ||||||
|  |     if(m_iptt==0 and ((bTxTime and !btxMute and fTR<0.4) or m_tune )) { | ||||||
|       icw[0]=m_ncw; |       icw[0]=m_ncw; | ||||||
| 
 | 
 | ||||||
|       //Raise PTT
 |       //Raise PTT
 | ||||||
| @ -1439,6 +1440,7 @@ void MainWindow::guiUpdate() | |||||||
|     genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1); |     genjt9_(message,&ichk,msgsent,itone,&itext,len1,len1); | ||||||
|     msgsent[22]=0; |     msgsent[22]=0; | ||||||
|     QString t=QString::fromAscii(msgsent); |     QString t=QString::fromAscii(msgsent); | ||||||
|  |     if(m_tune) t="TUNE"; | ||||||
|     lab5->setText("Last Tx:  " + t); |     lab5->setText("Last Tx:  " + t); | ||||||
|     if(m_restart) { |     if(m_restart) { | ||||||
|       QFile f("ALL.TXT"); |       QFile f("ALL.TXT"); | ||||||
| @ -1519,7 +1521,7 @@ void MainWindow::guiUpdate() | |||||||
|     out << QDateTime::currentDateTimeUtc().toString("hhmm") |     out << QDateTime::currentDateTimeUtc().toString("hhmm") | ||||||
|         << "  Transmitting:  " << t << endl; |         << "  Transmitting:  " << t << endl; | ||||||
|     f.close(); |     f.close(); | ||||||
|     if(m_tx2QSO) displayTxMsg(t); |     if(m_tx2QSO and !m_tune) displayTxMsg(t); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   if(!btxok && btxok0 && m_iptt==1) stopTx(); |   if(!btxok && btxok0 && m_iptt==1) stopTx(); | ||||||
| @ -1594,11 +1596,11 @@ void MainWindow::guiUpdate() | |||||||
|     m_hsym0=khsym; |     m_hsym0=khsym; | ||||||
|     m_sec0=nsec; |     m_sec0=nsec; | ||||||
| 
 | 
 | ||||||
| //###
 |     if(m_catEnabled) { | ||||||
|     m_cmnd=rig_command() + " f"; |       m_cmnd=rig_command() + " f"; | ||||||
|     p3.start(m_cmnd); |       p3.start(m_cmnd); | ||||||
|     p3.waitForFinished(); |       p3.waitForFinished(); | ||||||
| //###
 |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   iptt0=m_iptt; |   iptt0=m_iptt; | ||||||
| @ -2538,3 +2540,16 @@ void MainWindow::on_actionTx2QSO_triggered(bool checked) | |||||||
| { | { | ||||||
|   m_tx2QSO=checked; |   m_tx2QSO=checked; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | void MainWindow::on_tuneButton_clicked() | ||||||
|  | { | ||||||
|  |   m_tune=!m_tune; | ||||||
|  |   soundOutThread.setTune(m_tune); | ||||||
|  |   if(m_tune) { | ||||||
|  |     ui->tuneButton->setStyleSheet(m_pbTune_style); | ||||||
|  |   } else { | ||||||
|  |     btxok=false; | ||||||
|  |     ui->tuneButton->setStyleSheet(""); | ||||||
|  |     on_monitorButton_clicked(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | |||||||
| @ -151,6 +151,7 @@ private slots: | |||||||
|   void on_actionRunaway_Tx_watchdog_triggered(bool checked); |   void on_actionRunaway_Tx_watchdog_triggered(bool checked); | ||||||
|   void on_actionTx2QSO_triggered(bool checked); |   void on_actionTx2QSO_triggered(bool checked); | ||||||
|   void killFile(); |   void killFile(); | ||||||
|  |   void on_tuneButton_clicked(); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     Ui::MainWindow *ui; |     Ui::MainWindow *ui; | ||||||
| @ -245,6 +246,7 @@ private: | |||||||
|     bool    m_sent73; |     bool    m_sent73; | ||||||
|     bool    m_runaway; |     bool    m_runaway; | ||||||
|     bool    m_tx2QSO; |     bool    m_tx2QSO; | ||||||
|  |     bool    m_tune; | ||||||
| 
 | 
 | ||||||
|     char    m_decoded[80]; |     char    m_decoded[80]; | ||||||
| 
 | 
 | ||||||
| @ -281,6 +283,7 @@ private: | |||||||
|     QString m_pbdecoding_style1; |     QString m_pbdecoding_style1; | ||||||
|     QString m_pbmonitor_style; |     QString m_pbmonitor_style; | ||||||
|     QString m_pbAutoOn_style; |     QString m_pbAutoOn_style; | ||||||
|  |     QString m_pbTune_style; | ||||||
|     QString m_myCall; |     QString m_myCall; | ||||||
|     QString m_myGrid; |     QString m_myGrid; | ||||||
|     QString m_baseCall; |     QString m_baseCall; | ||||||
|  | |||||||
| @ -458,6 +458,13 @@ p, li { white-space: pre-wrap; } | |||||||
|           </property> |           </property> | ||||||
|          </widget> |          </widget> | ||||||
|         </item> |         </item> | ||||||
|  |         <item> | ||||||
|  |          <widget class="QPushButton" name="tuneButton"> | ||||||
|  |           <property name="text"> | ||||||
|  |            <string>&Tune</string> | ||||||
|  |           </property> | ||||||
|  |          </widget> | ||||||
|  |         </item> | ||||||
|         <item> |         <item> | ||||||
|          <widget class="QPushButton" name="autoButton"> |          <widget class="QPushButton" name="autoButton"> | ||||||
|           <property name="sizePolicy"> |           <property name="sizePolicy"> | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								soundout.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								soundout.cpp
									
									
									
									
									
								
							| @ -22,6 +22,7 @@ typedef struct   //Parameters sent to or received from callback function | |||||||
|   int    ncall; |   int    ncall; | ||||||
|   bool   txMute; |   bool   txMute; | ||||||
|   bool   bRestart; |   bool   bRestart; | ||||||
|  |   bool   btune; | ||||||
| } paUserData; | } paUserData; | ||||||
| 
 | 
 | ||||||
| //--------------------------------------------------------------- d2aCallback
 | //--------------------------------------------------------------- d2aCallback
 | ||||||
| @ -57,6 +58,7 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer, | |||||||
|     srand(mstr);                                //Initialize random seed
 |     srand(mstr);                                //Initialize random seed
 | ||||||
|   } |   } | ||||||
|   isym=ic/(4*udata->nsps);                      //Actual fsample=48000
 |   isym=ic/(4*udata->nsps);                      //Actual fsample=48000
 | ||||||
|  |   if(udata->btune) isym=0;                      //If tuning, send pure tone
 | ||||||
|   if(udata->txsnrdb < 0.0) { |   if(udata->txsnrdb < 0.0) { | ||||||
|     snr=pow(10.0,0.05*(udata->txsnrdb-6.0)); |     snr=pow(10.0,0.05*(udata->txsnrdb-6.0)); | ||||||
|     fac=3000.0; |     fac=3000.0; | ||||||
| @ -100,6 +102,10 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer, | |||||||
|   amp=32767.0; |   amp=32767.0; | ||||||
|   int i0=84.983*4.0*udata->nsps; |   int i0=84.983*4.0*udata->nsps; | ||||||
|   int i1=85*4*udata->nsps; |   int i1=85*4*udata->nsps; | ||||||
|  |   if(udata->btune) {                           //If tuning, no ramp down
 | ||||||
|  |     i0=999*udata->nsps; | ||||||
|  |     i1=i0; | ||||||
|  |   } | ||||||
|   for(uint i=0 ; i<framesToProcess; i++ )  { |   for(uint i=0 ; i<framesToProcess; i++ )  { | ||||||
|     phi += dphi; |     phi += dphi; | ||||||
|     if(phi>twopi) phi -= twopi; |     if(phi>twopi) phi -= twopi; | ||||||
| @ -154,6 +160,7 @@ void SoundOutThread::run() | |||||||
|   udata.ncall=0; |   udata.ncall=0; | ||||||
|   udata.txMute=m_txMute; |   udata.txMute=m_txMute; | ||||||
|   udata.bRestart=true; |   udata.bRestart=true; | ||||||
|  |   udata.btune=m_tune; | ||||||
| 
 | 
 | ||||||
|   paerr=Pa_OpenStream(&outStream,           //Output stream
 |   paerr=Pa_OpenStream(&outStream,           //Output stream
 | ||||||
|         NULL,                               //No input parameters
 |         NULL,                               //No input parameters
 | ||||||
| @ -219,6 +226,11 @@ void SoundOutThread::setTxSNR(double snr) | |||||||
|   m_txsnrdb=snr; |   m_txsnrdb=snr; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void SoundOutThread::setTune(bool b) | ||||||
|  | { | ||||||
|  |   m_tune=b; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| double SoundOutThread::samFacOut() | double SoundOutThread::samFacOut() | ||||||
| { | { | ||||||
|   return m_SamFacOut; |   return m_SamFacOut; | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ public: | |||||||
|   void setPeriod(int ntrperiod, int nsps); |   void setPeriod(int ntrperiod, int nsps); | ||||||
|   void setTxFreq(int n); |   void setTxFreq(int n); | ||||||
|   void setTxSNR(double snr); |   void setTxSNR(double snr); | ||||||
|  |   void setTune(bool b); | ||||||
|   double samFacOut(); |   double samFacOut(); | ||||||
|   bool quitExecution;           //If true, thread exits gracefully
 |   bool quitExecution;           //If true, thread exits gracefully
 | ||||||
| 
 | 
 | ||||||
| @ -41,6 +42,7 @@ private: | |||||||
|   qint32  m_txFreq; |   qint32  m_txFreq; | ||||||
|   bool    m_txOK;               //Enable Tx audio
 |   bool    m_txOK;               //Enable Tx audio
 | ||||||
|   bool    m_txMute;             //Mute temporarily
 |   bool    m_txMute;             //Mute temporarily
 | ||||||
|  |   bool    m_tune; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user