1. Enable CW ID for fast modes.

2. Correct several more flaws in making GUI controls visible or invisible.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7170 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-10-13 16:19:24 +00:00
parent 19a25a42ff
commit 1cc278cce6
4 changed files with 98 additions and 91 deletions

View File

@ -79,8 +79,8 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol,
unsigned mstr = ms0 % (1000 * m_period); // ms in period
m_ic = (mstr / 1000) * m_frameRate; // we start exactly N seconds
if(m_bFastMode) m_ic=0;
// into period where N is the next whole second
if(m_bFastMode) m_ic=0;
m_silentFrames = 0;
// calculate number of silent frames to send
@ -165,19 +165,33 @@ qint64 Modulator::readData (char * data, qint64 maxSize)
{
unsigned int isym=0;
if(!m_tuning) isym=m_ic/(4.0*m_nsps); // Actual fsample=48000
if (isym >= m_symbolsLength && icw[0] > 0) { // start CW condition
// Output the CW ID
m_dphi = m_twoPi * m_frequency / m_frameRate;
unsigned const ic0 = m_symbolsLength * 4 * m_nsps;
unsigned j (0);
bool slowCwId=((isym >= m_symbolsLength) && (icw[0] > 0)) && (!m_bFastMode);
bool fastCwId=false;
static bool bCwId=false;
qint64 ms = QDateTime::currentMSecsSinceEpoch();
float tsec=0.001*(ms % (1000*m_TRperiod));
if(m_bFastMode and (icw[0]>0) and (tsec>(m_TRperiod-5.0))) fastCwId=true;
if(!m_bFastMode) m_nspd=2560; // 22.5 WPM
if(slowCwId or fastCwId) { // Transmit CW ID?
m_dphi = m_twoPi*m_frequency/m_frameRate;
if(m_bFastMode and !bCwId) {
m_frequency=1500; // Set params for CW ID
m_symbolsLength=126;
m_nsps=4096.0*12000.0/11025.0;
m_ic=2246949;
m_nspd=2560; // 22.5 WPM
if(icw[0]*m_nspd/48000.0 > 4.1) m_nspd=4.1*48000/icw[0]; //Faster CW for long calls
}
bCwId=true;
unsigned ic0 = m_symbolsLength * 4 * m_nsps;
unsigned j(0);
while (samples != end) {
j = (m_ic - ic0) / m_nspd + 1; // symbol of this sample
j = (m_ic - ic0)/m_nspd + 1; // symbol of this sample
bool level {bool (icw[j])};
m_phi += m_dphi;
if (m_phi > m_twoPi) m_phi -= m_twoPi;
qint16 sample=0;
float amp=32767.0;
if(m_ramp!=0) {
@ -188,30 +202,27 @@ qint64 Modulator::readData (char * data, qint64 maxSize)
}
sample=round(amp*x);
}
if (int (j) <= icw[0] && j < NUM_CW_SYMBOLS) // stop condition
{
samples = load (postProcessSample (sample), samples);
++framesGenerated;
++m_ic;
}
else
{
Q_EMIT stateChanged ((m_state = Idle));
return framesGenerated * bytesPerFrame ();
}
if (int (j) <= icw[0] && j < NUM_CW_SYMBOLS) { // stop condition
samples = load (postProcessSample (sample), samples);
++framesGenerated;
++m_ic;
} else {
Q_EMIT stateChanged ((m_state = Idle));
return framesGenerated * bytesPerFrame ();
}
// adjust ramp
if ((m_ramp != 0 && m_ramp != std::numeric_limits<qint16>::min ()) || level != m_cwLevel)
{
// either ramp has terminated at max/min or direction has changed
m_ramp += RAMP_INCREMENT; // ramp
}
if ((m_ramp != 0 && m_ramp != std::numeric_limits<qint16>::min ()) || level != m_cwLevel) {
// either ramp has terminated at max/min or direction has changed
m_ramp += RAMP_INCREMENT; // ramp
}
m_cwLevel = level;
}
return framesGenerated * bytesPerFrame ();
}
} else {
bCwId=false;
} //End of code for CW ID
double const baud (12000.0 / m_nsps);
// fade out parameters (no fade out for tuning)

View File

@ -59,7 +59,7 @@ private:
unsigned m_symbolsLength;
static double constexpr m_twoPi = 2.0 * 3.141592653589793238462;
static unsigned constexpr m_nspd = 2048 + 512; // CW ID WPM factor = 22.5 WPM
unsigned m_nspd = 2048 + 512; // CW ID WPM factor = 22.5 WPM
double m_phi;
double m_dphi;

View File

@ -118,8 +118,8 @@ extern "C" {
}
int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
struct dec_data dec_data; // for sharing with Fortran
int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
struct dec_data dec_data; // for sharing with Fortran
int outBufSize;
int rc;
@ -488,8 +488,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
ui->actionQuickDecode->setActionGroup(DepthGroup);
ui->actionMediumDecode->setActionGroup(DepthGroup);
ui->actionDeepestDecode->setActionGroup(DepthGroup);
// ui->actionInclude_averaging->setActionGroup(DepthGroup);
// ui->actionInclude_correlation->setActionGroup(DepthGroup);
connect (ui->download_samples_action, &QAction::triggered, [this, network_manager] () {
if (!m_sampleDownloader)
@ -1392,52 +1390,45 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
// things that might change that we need know about
auto callsign = m_config.my_callsign ();
if (QDialog::Accepted == m_config.exec ())
{
if (m_config.my_callsign () != callsign)
{
m_baseCall = Radio::base_callsign (m_config.my_callsign ());
morse_(const_cast<char *> (m_config.my_callsign ().toLatin1().constData())
, const_cast<int *> (icw)
, &m_ncw
, m_config.my_callsign ().length());
}
on_dxGridEntry_textChanged (m_hisGrid); // recalculate distances in case of units change
enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook
if(m_config.spot_to_psk_reporter ()) {
pskSetLocal ();
}
if(m_config.restart_audio_input ()) {
Q_EMIT startAudioInputStream (m_config.audio_input_device (),
m_framesAudioInputBuffered, m_detector,
m_downSampleFactor,
m_config.audio_input_channel ());
}
if(m_config.restart_audio_output ()) {
Q_EMIT initializeAudioOutputStream (m_config.audio_output_device (),
AudioDevice::Mono == m_config.audio_output_channel () ? 1 : 2,
m_msAudioOutputBuffered);
}
auto_tx_label.setText (m_config.quick_call () ? "Auto-Tx-Enable Armed" :
"Auto-Tx-Enable Disarmed");
displayDialFrequency ();
bool vhf {m_config.enable_VHF_features ()};
if (!vhf) ui->sbSubmode->setValue (0);
setup_status_bar (vhf);
bool b = vhf && (m_mode=="JT4" or m_mode=="JT65" or m_mode=="ISCAT" or
m_mode=="JT9" or m_mode=="MSK144");
if(b) {
VHF_features_enabled(b);
VHF_controls_visible(b);
}
if(m_mode=="MSK144" or (m_mode=="JT9" and m_nSubMode<4)) ui->cbFast9->setVisible(false);
if (QDialog::Accepted == m_config.exec ()) {
if (m_config.my_callsign () != callsign) {
m_baseCall = Radio::base_callsign (m_config.my_callsign ());
morse_(const_cast<char *> (m_config.my_callsign ().toLatin1().constData()),
const_cast<int *> (icw), &m_ncw, m_config.my_callsign ().length());
}
on_dxGridEntry_textChanged (m_hisGrid); // recalculate distances in case of units change
enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook
if(m_config.spot_to_psk_reporter ()) pskSetLocal ();
if(m_config.restart_audio_input ()) {
Q_EMIT startAudioInputStream (m_config.audio_input_device (),
m_framesAudioInputBuffered, m_detector, m_downSampleFactor,
m_config.audio_input_channel ());
}
if(m_config.restart_audio_output ()) {
Q_EMIT initializeAudioOutputStream (m_config.audio_output_device (),
AudioDevice::Mono == m_config.audio_output_channel () ? 1 : 2,
m_msAudioOutputBuffered);
}
auto_tx_label.setText (m_config.quick_call () ? "Auto-Tx-Enable Armed" :
"Auto-Tx-Enable Disarmed");
displayDialFrequency ();
bool vhf {m_config.enable_VHF_features ()};
if (!vhf) ui->sbSubmode->setValue (0);
setup_status_bar (vhf);
bool b = vhf && (m_mode=="JT4" or m_mode=="JT65" or m_mode=="ISCAT" or
m_mode=="JT9" or m_mode=="MSK144");
if(b) {
VHF_features_enabled(b);
VHF_controls_visible(b);
}
if(m_mode=="MSK144" or (m_mode=="JT9" and m_nSubMode<4)) ui->cbFast9->setVisible(false);
}
m_config.transceiver_online ();
if(!m_bFastMode) setXIT (ui->TxFreqSpinBox->value ());
if(m_config.single_decode() or m_mode=="JT4") {
@ -2631,10 +2622,10 @@ void MainWindow::guiUpdate()
if(m_mode=="ISCAT" or m_mode=="MSK144" or m_bFast9) {
txDuration=m_TRperiod-0.25; // ISCAT, JT9-fast, MSK144
}
//### if(m_mode=="WSPR-15") tx2=...
double tx1=0.0;
double tx2=txDuration + + icw[0]*2560.0/48000.0; //Full length including CW ID
double tx2=txDuration;
if((icw[0]>0) and (!m_bFast9)) tx2 += icw[0]*2560.0/48000.0; //Full length including CW ID
if(!m_txFirst and !m_mode.startsWith ("WSPR")) {
tx1 += m_TRperiod;
tx2 += m_TRperiod;
@ -2859,7 +2850,7 @@ void MainWindow::guiUpdate()
auto const& message = tr ("Cannot open \"%1\" for append: %2")
.arg (f.fileName ()).arg (f.errorString ());
#if QT_VERSION >= 0x050400
QTimer::singleShot (0, [=] { // don't block guiUpdate
QTimer::singleShot (0, [=] { // don't block guiUpdate
MessageBox::warning_message (this, tr ("Log File Error"), message);
});
#else
@ -2881,7 +2872,8 @@ void MainWindow::guiUpdate()
&& !message_is_73 (m_lastMessageType, m_lastMessageSent.split (' ', QString::SkipEmptyParts));
if (m_sentFirst73) {
m_qsoStop=t2;
if(m_config.id_after_73 () and (!m_bFastMode)) {
// if(m_config.id_after_73 () and (!m_bFastMode)) {
if(m_config.id_after_73 ()) {
icw[0] = m_ncw;
}
if (m_config.prompt_to_log () && !m_tune) {
@ -2892,7 +2884,8 @@ void MainWindow::guiUpdate()
auto_tx_mode (false);
}
if(m_config.id_interval () >0 and (!m_bFastMode)) {
// if(m_config.id_interval () >0 and (!m_bFastMode)) {
if(m_config.id_interval () >0) {
int nmin=(m_sec0-m_secID)/60;
if(nmin >= m_config.id_interval ()) {
icw[0]=m_ncw;
@ -3988,7 +3981,6 @@ void MainWindow::on_actionJT9_triggered()
}
ui->cbShMsgs->setVisible(false);
ui->cbTx6->setVisible(false);
// ui->sbSubmode->setVisible(true);
ui->sbSubmode->setVisible(bVHF);
ui->sbSubmode->setMaximum(7);
fast_config(m_bFastMode);
@ -4036,7 +4028,7 @@ void MainWindow::on_actionMSK144_triggered()
ui->cbTx6->setVisible(false);
ui->sbSubmode->setVisible(false);
m_bFastMode=true;
m_bFast9=true;
m_bFast9=false;
fast_config(true);
m_TRperiod=ui->sbTR->cleanText().toInt();
m_wideGraph->hide();
@ -4089,6 +4081,8 @@ void MainWindow::on_actionQRA64_triggered()
ui->sbSubmode->setMaximum(4);
ui->sbSubmode->setValue(m_nSubMode);
ui->cbTxLock->setEnabled(true);
ui->actionInclude_averaging->setEnabled(false);
ui->actionInclude_correlation->setEnabled(false);
ui->sbSubmode->setVisible(true);
ui->sbFtol->setVisible(true);
ui->cbFast9->setVisible(false);
@ -4133,6 +4127,7 @@ void MainWindow::on_actionJT65_triggered()
VHF_controls_visible(bVHF);
ui->cbFast9->setVisible(false);
ui->cbShMsgs->setVisible(true);
ui->cbAutoSeq->setVisible(false);
fast_config(false);
ui->sbSubmode->setMaximum(2);
if(bVHF) {
@ -4222,6 +4217,7 @@ void MainWindow::on_actionJT4_triggered()
ui->cbTx6->setVisible(true);
ui->sbTR->setVisible(false);
ui->sbSubmode->setVisible(true);
ui->cbAutoSeq->setVisible(false);
ui->sbSubmode->setMaximum(6);
ui->label_6->setText("Single-Period Decodes");
ui->label_7->setText("Average Decodes");
@ -5209,8 +5205,8 @@ void::MainWindow::VHF_controls_visible(bool b)
{
ui->VHFControls_widget->setVisible (b);
ui->cbFast9->setVisible(b);
ui->sbSubmode->setVisible(b);
ui->sbFtol->setVisible(b);
ui->sbSubmode->setVisible(b && (m_mode!="MSK144"));
ui->syncSpinBox->setVisible(b && (m_mode!="MSK144"));
}

View File

@ -2368,18 +2368,18 @@ QPushButton[state=&quot;ok&quot;] {
<property name="title">
<string>Mode</string>
</property>
<addaction name="actionJT9"/>
<addaction name="actionJT65"/>
<addaction name="actionJT9_JT65"/>
<addaction name="actionJT4"/>
<addaction name="actionJT9"/>
<addaction name="actionJT9_JT65"/>
<addaction name="actionJT65"/>
<addaction name="actionQRA64"/>
<addaction name="separator"/>
<addaction name="actionISCAT"/>
<addaction name="actionMSK144"/>
<addaction name="separator"/>
<addaction name="actionWSPR_2"/>
<addaction name="separator"/>
<addaction name="actionEcho"/>
<addaction name="separator"/>
<addaction name="actionISCAT"/>
<addaction name="actionMSK144"/>
<addaction name="actionQRA64"/>
</widget>
<widget class="QMenu" name="menuConfig">
<property name="title">