Fixed split rig offset bug during restore freq

This commit is contained in:
Jordan Sherer 2018-09-16 11:30:13 -04:00
parent c54dfbbcda
commit 1817e298b1

View File

@ -2586,9 +2586,15 @@ Radio::Frequency MainWindow::dialFrequency() {
m_rigState.tx_frequency () : m_rigState.frequency ()}; m_rigState.tx_frequency () : m_rigState.frequency ()};
} }
void MainWindow::displayDialFrequency () void MainWindow::displayDialFrequency (){
{ #if 0
qDebug() << "rx nominal" << m_freqNominal;
qDebug() << "tx nominal" << m_freqTxNominal;
qDebug() << "offset set to" << ui->RxFreqSpinBox->value() << ui->TxFreqSpinBox->value();
#endif
auto dial_frequency = dialFrequency(); auto dial_frequency = dialFrequency();
auto audio_frequency = currentFreqOffset();
// lookup band // lookup band
auto const& band_name = m_config.bands ()->find (dial_frequency); auto const& band_name = m_config.bands ()->find (dial_frequency);
@ -2635,6 +2641,11 @@ void MainWindow::displayDialFrequency ()
update_dynamic_property (ui->labDialFreq, "oob", !valid); update_dynamic_property (ui->labDialFreq, "oob", !valid);
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency)); ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency));
if(m_splitMode && m_transmitting){
audio_frequency -= m_XIT;
}
ui->labDialFreqOffset->setText(QString("%1 Hz").arg(audio_frequency));
} }
void MainWindow::statusChanged() void MainWindow::statusChanged()
@ -4234,6 +4245,9 @@ void MainWindow::guiUpdate()
// Don't transmit another mode in the 30 m WSPR sub-band // Don't transmit another mode in the 30 m WSPR sub-band
Frequency onAirFreq = m_freqNominal + ui->TxFreqSpinBox->value(); Frequency onAirFreq = m_freqNominal + ui->TxFreqSpinBox->value();
//qDebug() << "transmitting on" << onAirFreq;
if ((onAirFreq > 10139900 and onAirFreq < 10140320) and if ((onAirFreq > 10139900 and onAirFreq < 10140320) and
!m_mode.startsWith ("WSPR")) { !m_mode.startsWith ("WSPR")) {
m_bTxTime=false; m_bTxTime=false;
@ -4857,7 +4871,9 @@ void MainWindow::stopTx()
tx_status_label.setText(""); tx_status_label.setText("");
} }
if(!m_tx_watchdog && prepareNextMessageFrame()){ bool shouldContinue = !m_tx_watchdog && prepareNextMessageFrame();
if(shouldContinue){
continueTx(); continueTx();
} else { } else {
// TODO: jsherer - split this up... // TODO: jsherer - split this up...
@ -6217,6 +6233,7 @@ void MainWindow::createMessageTransmitQueue(QString const& text){
m_txFrameCount = frames.length(); m_txFrameCount = frames.length();
int freq = currentFreqOffset(); int freq = currentFreqOffset();
qDebug() << "creating message for freq" << freq;
QStringList lines; QStringList lines;
foreach(auto frame, frames){ foreach(auto frame, frames){
@ -8291,12 +8308,10 @@ bool MainWindow::tryRestoreFreqOffset(){
} }
setFreqOffsetForRestore(m_previousFreq, false); setFreqOffsetForRestore(m_previousFreq, false);
return true; return true;
} }
void MainWindow::setFreq4(int rxFreq, int txFreq) void MainWindow::setFreq4(int rxFreq, int txFreq) {
{
// don't allow QSY if we've already queued a transmission, unless we have that functionality enabled. // don't allow QSY if we've already queued a transmission, unless we have that functionality enabled.
if(isMessageQueuedForTransmit() && !m_config.tx_qsy_allowed()){ if(isMessageQueuedForTransmit() && !m_config.tx_qsy_allowed()){
return; return;
@ -8310,9 +8325,12 @@ void MainWindow::setFreq4(int rxFreq, int txFreq)
txFreq = max(500, txFreq); txFreq = max(500, txFreq);
m_previousFreq = currentFreqOffset(); m_previousFreq = currentFreqOffset();
ui->RxFreqSpinBox->setValue(rxFreq);
ui->TxFreqSpinBox->setValue(txFreq);
if (ui->RxFreqSpinBox->isEnabled ()) ui->RxFreqSpinBox->setValue(rxFreq); displayDialFrequency();
ui->labDialFreqOffset->setText(QString("%1 Hz").arg(rxFreq));
#if 0
if(m_mode.startsWith ("WSPR")) { if(m_mode.startsWith ("WSPR")) {
ui->WSPRfreqSpinBox->setValue(txFreq); ui->WSPRfreqSpinBox->setValue(txFreq);
} else { } else {
@ -8329,13 +8347,12 @@ void MainWindow::setFreq4(int rxFreq, int txFreq)
setXIT (ui->TxFreqSpinBox->value ()); setXIT (ui->TxFreqSpinBox->value ());
} }
} }
#endif
} }
void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const& s) void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const& s)
{ {
// qDebug () << "MainWindow::handle_transceiver_update:" << s; //qDebug () << "MainWindow::handle_transceiver_update:" << s;
Transceiver::TransceiverState old_state {m_rigState}; Transceiver::TransceiverState old_state {m_rigState};
//transmitDisplay (s.ptt ()); //transmitDisplay (s.ptt ());
if (s.ptt () && !m_rigState.ptt ()) // safe to start audio if (s.ptt () && !m_rigState.ptt ()) // safe to start audio
@ -10115,7 +10132,7 @@ void MainWindow::displayBandActivity() {
} }
bool isDirectedAllCall = false; bool isDirectedAllCall = false;
qDebug() << "style" << (text.last().contains(Radio::base_callsign(m_config.my_callsign()))) << text.last();
// TODO: jsherer - there's a potential here for a previous allcall o poison the highlight. // TODO: jsherer - there's a potential here for a previous allcall o poison the highlight.
if ( if (
(isDirectedOffset(offset, &isDirectedAllCall) && !isDirectedAllCall) || (isDirectedOffset(offset, &isDirectedAllCall) && !isDirectedAllCall) ||