Fixed split rig offset bug during restore freq
This commit is contained in:
parent
c54dfbbcda
commit
1817e298b1
119
mainwindow.cpp
119
mainwindow.cpp
@ -2586,55 +2586,66 @@ 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
|
||||||
auto dial_frequency = dialFrequency();
|
qDebug() << "rx nominal" << m_freqNominal;
|
||||||
|
qDebug() << "tx nominal" << m_freqTxNominal;
|
||||||
|
qDebug() << "offset set to" << ui->RxFreqSpinBox->value() << ui->TxFreqSpinBox->value();
|
||||||
|
#endif
|
||||||
|
|
||||||
// lookup band
|
auto dial_frequency = dialFrequency();
|
||||||
auto const& band_name = m_config.bands ()->find (dial_frequency);
|
auto audio_frequency = currentFreqOffset();
|
||||||
if (m_lastBand != band_name){
|
|
||||||
cacheActivity(m_lastBand);
|
|
||||||
|
|
||||||
// only change this when necessary as we get called a lot and it
|
// lookup band
|
||||||
// would trash any user input to the band combo box line edit
|
auto const& band_name = m_config.bands ()->find (dial_frequency);
|
||||||
ui->bandComboBox->setCurrentText (band_name);
|
if (m_lastBand != band_name){
|
||||||
m_wideGraph->setRxBand (band_name);
|
cacheActivity(m_lastBand);
|
||||||
m_lastBand = band_name;
|
|
||||||
band_changed(dial_frequency);
|
|
||||||
|
|
||||||
clearActivity();
|
// only change this when necessary as we get called a lot and it
|
||||||
|
// would trash any user input to the band combo box line edit
|
||||||
|
ui->bandComboBox->setCurrentText (band_name);
|
||||||
|
m_wideGraph->setRxBand (band_name);
|
||||||
|
m_lastBand = band_name;
|
||||||
|
band_changed(dial_frequency);
|
||||||
|
|
||||||
restoreActivity(m_lastBand);
|
clearActivity();
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: jsherer - this doesn't validate anything else right? we are disabling this because as long as you're in a band, it's valid.
|
restoreActivity(m_lastBand);
|
||||||
/*
|
|
||||||
// search working frequencies for one we are within 10kHz of (1 Mhz
|
|
||||||
// of on VHF and up)
|
|
||||||
bool valid {false};
|
|
||||||
quint64 min_offset {99999999};
|
|
||||||
for (auto const& item : *m_config.frequencies ())
|
|
||||||
{
|
|
||||||
// we need to do specific checks for above and below here to
|
|
||||||
// ensure that we can use unsigned Radio::Frequency since we
|
|
||||||
// potentially use the full 64-bit unsigned range.
|
|
||||||
auto const& working_frequency = item.frequency_;
|
|
||||||
auto const& offset = dial_frequency > working_frequency ?
|
|
||||||
dial_frequency - working_frequency :
|
|
||||||
working_frequency - dial_frequency;
|
|
||||||
if (offset < min_offset) {
|
|
||||||
min_offset = offset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (min_offset < 10000u || (m_config.enable_VHF_features() && min_offset < 1000000u)) {
|
|
||||||
valid = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool valid = !band_name.isEmpty();
|
// TODO: jsherer - this doesn't validate anything else right? we are disabling this because as long as you're in a band, it's valid.
|
||||||
|
/*
|
||||||
|
// search working frequencies for one we are within 10kHz of (1 Mhz
|
||||||
|
// of on VHF and up)
|
||||||
|
bool valid {false};
|
||||||
|
quint64 min_offset {99999999};
|
||||||
|
for (auto const& item : *m_config.frequencies ())
|
||||||
|
{
|
||||||
|
// we need to do specific checks for above and below here to
|
||||||
|
// ensure that we can use unsigned Radio::Frequency since we
|
||||||
|
// potentially use the full 64-bit unsigned range.
|
||||||
|
auto const& working_frequency = item.frequency_;
|
||||||
|
auto const& offset = dial_frequency > working_frequency ?
|
||||||
|
dial_frequency - working_frequency :
|
||||||
|
working_frequency - dial_frequency;
|
||||||
|
if (offset < min_offset) {
|
||||||
|
min_offset = offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (min_offset < 10000u || (m_config.enable_VHF_features() && min_offset < 1000000u)) {
|
||||||
|
valid = true;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
update_dynamic_property (ui->labDialFreq, "oob", !valid);
|
bool valid = !band_name.isEmpty();
|
||||||
ui->labDialFreq->setText (Radio::pretty_frequency_MHz_string (dial_frequency));
|
|
||||||
|
update_dynamic_property (ui->labDialFreq, "oob", !valid);
|
||||||
|
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) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user