mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-31 04:50:34 -04:00 
			
		
		
		
	Add helper_functions.cpp with a function tx_duration().
This commit is contained in:
		
							parent
							
								
									a891220b9e
								
							
						
					
					
						commit
						df86257119
					
				| @ -169,6 +169,7 @@ set (fort_qt_CXXSRCS | |||||||
|   ) |   ) | ||||||
| 
 | 
 | ||||||
| set (wsjt_qt_CXXSRCS | set (wsjt_qt_CXXSRCS | ||||||
|  |   helper_functions.cpp | ||||||
|   qt_helpers.cpp |   qt_helpers.cpp | ||||||
|   widgets/MessageBox.cpp |   widgets/MessageBox.cpp | ||||||
|   MetaDataRegistry.cpp |   MetaDataRegistry.cpp | ||||||
|  | |||||||
							
								
								
									
										33
									
								
								helper_functions.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								helper_functions.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,33 @@ | |||||||
|  | #include "helper_functions.h" | ||||||
|  | 
 | ||||||
|  | double tx_duration(QString mode, double trPeriod, int nsps, bool bFast9) | ||||||
|  | { | ||||||
|  |   double txt=0.0; | ||||||
|  |   if(mode=="FT4")  txt=1.0 + 105*576/12000.0;      // FT4
 | ||||||
|  |   if(mode=="FT8")  txt=1.0 + 79*1920/12000.0;      // FT8
 | ||||||
|  |   if(mode=="JT4")  txt=1.0 + 207.0*2520/11025.0;   // JT4
 | ||||||
|  |   if(mode=="JT9")  txt=1.0 + 85.0*nsps/12000.0;  // JT9
 | ||||||
|  |   if(mode=="JT65") txt=1.0 + 126*4096/11025.0;     // JT65
 | ||||||
|  |   if(mode=="Q65")  {                                      // Q65
 | ||||||
|  |     if(trPeriod==15) txt=0.5 + 85*1800/12000.0; | ||||||
|  |     if(trPeriod==30) txt=0.5 + 85*3600/12000.0; | ||||||
|  |     if(trPeriod==60) txt=1.0 + 85*7200/12000.0; | ||||||
|  |     if(trPeriod==120) txt=1.0 + 85*16000/12000.0; | ||||||
|  |     if(trPeriod==300) txt=1.0 + 85*41472/12000.0; | ||||||
|  |   } | ||||||
|  |   if(mode=="WSPR") txt=2.0 + 162*8192/12000.0;     // WSPR
 | ||||||
|  |   if(mode=="FST4" or mode=="FST4W") {               //FST4, FST4W
 | ||||||
|  |     if(trPeriod==15)  txt=1.0 + 160*720/12000.0; | ||||||
|  |     if(trPeriod==30)  txt=1.0 + 160*1680/12000.0; | ||||||
|  |     if(trPeriod==60)  txt=1.0 + 160*3888/12000.0; | ||||||
|  |     if(trPeriod==120) txt=1.0 + 160*8200/12000.0; | ||||||
|  |     if(trPeriod==300) txt=1.0 + 160*21504/12000.0; | ||||||
|  |     if(trPeriod==900) txt=1.0 + 160*66560/12000.0; | ||||||
|  |     if(trPeriod==1800) txt=1.0 + 160*134400/12000.0; | ||||||
|  |   } | ||||||
|  |   if(mode=="MSK144" or bFast9) { | ||||||
|  |     txt=trPeriod-0.25; // JT9-fast, MSK144
 | ||||||
|  |   } | ||||||
|  |   if(mode=="Echo") txt=2.4; | ||||||
|  |   return txt; | ||||||
|  | } | ||||||
							
								
								
									
										7
									
								
								helper_functions.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								helper_functions.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | #ifndef HELPER_FUNCTIONS_H | ||||||
|  | #define HELPER_FUNCTIONS_H | ||||||
|  | #include <QString> | ||||||
|  | 
 | ||||||
|  | double tx_duration(QString mode, double trPeriod, int nsps, bool bFast9); | ||||||
|  | 
 | ||||||
|  | #endif // HELPER_FUNCTIONS_H
 | ||||||
| @ -45,6 +45,7 @@ | |||||||
| #include <QRandomGenerator> | #include <QRandomGenerator> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #include "helper_functions.h" | ||||||
| #include "revision_utils.hpp" | #include "revision_utils.hpp" | ||||||
| #include "qt_helpers.hpp" | #include "qt_helpers.hpp" | ||||||
| #include "Network/NetworkAccessManager.hpp" | #include "Network/NetworkAccessManager.hpp" | ||||||
| @ -1031,6 +1032,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, | |||||||
| 
 | 
 | ||||||
| void MainWindow::not_GA_warning_message () | void MainWindow::not_GA_warning_message () | ||||||
| { | { | ||||||
|  |   /*
 | ||||||
|   MessageBox::critical_message (this, |   MessageBox::critical_message (this, | ||||||
|                                 "This is a pre-release version of WSJT-X 2.5.0 made\n" |                                 "This is a pre-release version of WSJT-X 2.5.0 made\n" | ||||||
|                                 "available for testing purposes.  By design it will\n" |                                 "available for testing purposes.  By design it will\n" | ||||||
| @ -1039,6 +1041,7 @@ void MainWindow::not_GA_warning_message () | |||||||
|   if (now >= QDateTime {{2021, 8, 31}, {23, 59, 59, 999}, Qt::UTC}) { |   if (now >= QDateTime {{2021, 8, 31}, {23, 59, 59, 999}, Qt::UTC}) { | ||||||
|     Q_EMIT finished (); |     Q_EMIT finished (); | ||||||
|   } |   } | ||||||
|  |   */ | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWindow::initialize_fonts () | void MainWindow::initialize_fonts () | ||||||
| @ -2203,7 +2206,7 @@ void MainWindow::keyPressEvent (QKeyEvent * e) | |||||||
|     break; |     break; | ||||||
|   case Qt::Key_X: |   case Qt::Key_X: | ||||||
|     if(e->modifiers() & Qt::AltModifier) { |     if(e->modifiers() & Qt::AltModifier) { | ||||||
| //      qDebug() << "Alt-X" << WSPR_message();
 |       qDebug() << "Alt-X" << revision(); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @ -3858,6 +3861,9 @@ void MainWindow::guiUpdate() | |||||||
|     if(m_transmitting) m_bEchoTxed=true; |     if(m_transmitting) m_bEchoTxed=true; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   Q_ASSERT(txDuration == tx_duration(m_mode,m_TRperiod,m_nsps,m_bFast9)); | ||||||
|  |   Q_ASSERT(m_mode==m_modeTx); | ||||||
|  | 
 | ||||||
|   if(m_mode=="WSPR" or m_mode=="FST4W") { |   if(m_mode=="WSPR" or m_mode=="FST4W") { | ||||||
|     if(m_nseq==0 and m_ntr==0) {                   //Decide whether to Tx or Rx
 |     if(m_nseq==0 and m_ntr==0) {                   //Decide whether to Tx or Rx
 | ||||||
|       m_tuneup=false;                              //This is not an ATU tuneup
 |       m_tuneup=false;                              //This is not an ATU tuneup
 | ||||||
| @ -4381,6 +4387,7 @@ void MainWindow::guiUpdate() | |||||||
| //Once per second (onesec)
 | //Once per second (onesec)
 | ||||||
|   if(nsec != m_sec0) { |   if(nsec != m_sec0) { | ||||||
| //    qDebug() << "AAA" << nsec;
 | //    qDebug() << "AAA" << nsec;
 | ||||||
|  | 
 | ||||||
|     if(m_mode=="FST4") chk_FST4_freq_range(); |     if(m_mode=="FST4") chk_FST4_freq_range(); | ||||||
|     m_currentBand=m_config.bands()->find(m_freqNominal); |     m_currentBand=m_config.bands()->find(m_freqNominal); | ||||||
|     if( SpecOp::HOUND == m_config.special_op_id() ) { |     if( SpecOp::HOUND == m_config.special_op_id() ) { | ||||||
|  | |||||||
| @ -65,6 +65,7 @@ SOURCES += \ | |||||||
|   getfile.cpp \ |   getfile.cpp \ | ||||||
|   WFPalette.cpp \ |   WFPalette.cpp \ | ||||||
|   WsprTxScheduler.cpp \ |   WsprTxScheduler.cpp \ | ||||||
|  |   helper_functions.cpp \ | ||||||
|   main.cpp decodedtext.cpp wsprnet.cpp \ |   main.cpp decodedtext.cpp wsprnet.cpp \ | ||||||
|   WSPRBandHopping.cpp MessageAggregator.cpp SampleDownloader.cpp qt_helpers.cpp\ |   WSPRBandHopping.cpp MessageAggregator.cpp SampleDownloader.cpp qt_helpers.cpp\ | ||||||
|   MultiSettings.cpp PhaseEqualizationDialog.cpp \ |   MultiSettings.cpp PhaseEqualizationDialog.cpp \ | ||||||
| @ -72,6 +73,7 @@ SOURCES += \ | |||||||
|   LotWUsers.cpp TraceFile.cpp |   LotWUsers.cpp TraceFile.cpp | ||||||
| 
 | 
 | ||||||
| HEADERS  += qt_helpers.hpp qt_db_helpers.hpp \ | HEADERS  += qt_helpers.hpp qt_db_helpers.hpp \ | ||||||
|  |   helper_functions.h \ | ||||||
|   pimpl_h.hpp pimpl_impl.hpp \ |   pimpl_h.hpp pimpl_impl.hpp \ | ||||||
|   ExceptionCatchingApplication.hpp Logger.hpp WSJTXLogging.hpp \ |   ExceptionCatchingApplication.hpp Logger.hpp WSJTXLogging.hpp \ | ||||||
|   Radio.hpp NetworkServerLookup.hpp revision_utils.hpp \ |   Radio.hpp NetworkServerLookup.hpp revision_utils.hpp \ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user