Fixed bug in saving of band hopping information
This commit is contained in:
parent
e51cc6c3b5
commit
af913532c5
@ -273,7 +273,6 @@ public:
|
|||||||
switch_until_.setDisplayFormat("hh:mm");
|
switch_until_.setDisplayFormat("hh:mm");
|
||||||
|
|
||||||
auto form_layout = new QFormLayout ();
|
auto form_layout = new QFormLayout ();
|
||||||
//form_layout->addRow (tr ("&Band:"), &band_);
|
|
||||||
form_layout->addRow (tr ("&Frequency (MHz):"), &freq_);
|
form_layout->addRow (tr ("&Frequency (MHz):"), &freq_);
|
||||||
form_layout->addRow (tr ("&Switch at (UTC):"), &switch_at_);
|
form_layout->addRow (tr ("&Switch at (UTC):"), &switch_at_);
|
||||||
form_layout->addRow (tr ("&Until (UTC):"), &switch_until_);
|
form_layout->addRow (tr ("&Until (UTC):"), &switch_until_);
|
||||||
@ -2092,7 +2091,7 @@ void Configuration::impl::accept ()
|
|||||||
if (stations_.station_list () != next_stations_.station_list ())
|
if (stations_.station_list () != next_stations_.station_list ())
|
||||||
{
|
{
|
||||||
stations_.station_list(next_stations_.station_list ());
|
stations_.station_list(next_stations_.station_list ());
|
||||||
stations_.sort (StationList::band_column);
|
stations_.sort (StationList::switch_at_column);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui_->use_dynamic_grid->isChecked() && !use_dynamic_grid_ )
|
if (ui_->use_dynamic_grid->isChecked() && !use_dynamic_grid_ )
|
||||||
|
@ -467,13 +467,15 @@ bool StationList::impl::setData (QModelIndex const& model_index, QVariant const&
|
|||||||
|
|
||||||
if (offset != stations_[row].frequency_)
|
if (offset != stations_[row].frequency_)
|
||||||
{
|
{
|
||||||
|
stations_[row].frequency_ = offset;
|
||||||
|
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||||
|
|
||||||
auto band = bands_->find(offset);
|
auto band = bands_->find(offset);
|
||||||
if(band != stations_[row].band_name_){
|
if(band != stations_[row].band_name_){
|
||||||
stations_[row].band_name_ = band;
|
stations_[row].band_name_ = band;
|
||||||
|
auto band_index = model_index.model()->index(row, band_column, model_index);
|
||||||
|
Q_EMIT dataChanged (band_index, band_index, roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
stations_[row].frequency_ = offset;
|
|
||||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -493,6 +495,10 @@ bool StationList::impl::setData (QModelIndex const& model_index, QVariant const&
|
|||||||
stations_[row].switch_until_ = qMax(at, until);
|
stations_[row].switch_until_ = qMax(at, until);
|
||||||
|
|
||||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||||
|
|
||||||
|
auto switch_until_index = model_index.model()->index(row, switch_until_column, model_index);
|
||||||
|
Q_EMIT dataChanged (switch_until_index, switch_until_index, roles);
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -510,6 +516,10 @@ bool StationList::impl::setData (QModelIndex const& model_index, QVariant const&
|
|||||||
stations_[row].switch_until_ = qMax(at, until);
|
stations_[row].switch_until_ = qMax(at, until);
|
||||||
|
|
||||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||||
|
|
||||||
|
auto switch_at_index = model_index.model()->index(row, switch_at_column, model_index);
|
||||||
|
Q_EMIT dataChanged (switch_at_index, switch_at_index, roles);
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -91,9 +91,10 @@ inline
|
|||||||
bool operator == (StationList::Station const& lhs, StationList::Station const& rhs)
|
bool operator == (StationList::Station const& lhs, StationList::Station const& rhs)
|
||||||
{
|
{
|
||||||
return lhs.band_name_ == rhs.band_name_ &&
|
return lhs.band_name_ == rhs.band_name_ &&
|
||||||
//lhs.antenna_description_ == rhs.antenna_description_ &&
|
lhs.description_ == rhs.description_ &&
|
||||||
lhs.frequency_ == rhs.frequency_ &&
|
lhs.frequency_ == rhs.frequency_ &&
|
||||||
lhs.switch_at_ == rhs.switch_at_;
|
lhs.switch_at_ == rhs.switch_at_ &&
|
||||||
|
lhs.switch_until_ == rhs.switch_until_;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream& operator << (QDataStream&, StationList::Station const&);
|
QDataStream& operator << (QDataStream&, StationList::Station const&);
|
||||||
|
@ -1356,8 +1356,6 @@ void MainWindow::tryBandHop(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Checking for automatic band hop";
|
|
||||||
|
|
||||||
// get the current band
|
// get the current band
|
||||||
Frequency dialFreq {m_rigState.ptt () && m_rigState.split () ?
|
Frequency dialFreq {m_rigState.ptt () && m_rigState.split () ?
|
||||||
m_rigState.tx_frequency () : m_rigState.frequency ()};
|
m_rigState.tx_frequency () : m_rigState.frequency ()};
|
||||||
@ -1379,22 +1377,28 @@ void MainWindow::tryBandHop(){
|
|||||||
// see if we can find a needed band switch...
|
// see if we can find a needed band switch...
|
||||||
foreach(auto station, stations){
|
foreach(auto station, stations){
|
||||||
// we can switch to this frequency if we're in the time range, inclusive of switch_at, exclusive of switch_until
|
// we can switch to this frequency if we're in the time range, inclusive of switch_at, exclusive of switch_until
|
||||||
// and if we are switching within 30 seconds of the switch_at time. this allows us to switch bands at that time,
|
// and if we are switching to a different frequency than the last hop. this allows us to switch bands at that time,
|
||||||
// but then later we can later switch to a different band if needed without the automatic band switching to take over
|
// but then later we can later switch to a different band if needed without the automatic band switching to take over
|
||||||
bool canSwitch = station.switch_at_ <= d && d <= station.switch_until_ && station.switch_at_.secsTo(d) <= 30;
|
bool canSwitch = (
|
||||||
|
station.switch_at_ <= d &&
|
||||||
|
d <= station.switch_until_ &&
|
||||||
|
(m_bandHopped || (!m_bandHopped && station.frequency_ != m_bandHoppedFreq))
|
||||||
|
);
|
||||||
|
|
||||||
//qDebug() << "Can switch to" << station.band_name_ << "=" << canSwitch << station.switch_at_.time().toString("hh:mm") << "<=" << d.time().toString("hh:mm") << "<=" << station.switch_until_.time().toString("hh:mm");
|
//qDebug() << "Can switch to" << station.band_name_ << "=" << canSwitch << station.switch_at_.time().toString("hh:mm") << "<=" << d.time().toString("hh:mm") << "<=" << station.switch_until_.time().toString("hh:mm") << m_bandHopped << m_bandHoppedFreq;
|
||||||
|
|
||||||
// switch, if we can and the band is different than our current band
|
// switch, if we can and the band is different than our current band
|
||||||
if(canSwitch && station.band_name_ != currentBand){
|
if(canSwitch){
|
||||||
|
|
||||||
qDebug() << "Automatic band hop from" << currentBand << "to" << station.band_name_ << "at" << Radio::frequency_MHz_string(station.frequency_);
|
qDebug() << "Automatic band hop from" << currentBand << "to" << station.band_name_ << "at" << Radio::frequency_MHz_string(station.frequency_);
|
||||||
|
|
||||||
|
// cache the frequency set by bandHop...
|
||||||
|
m_bandHopped = true;
|
||||||
|
m_bandHoppedFreq = station.frequency_;
|
||||||
|
|
||||||
// TODO: jsherer - is this the right way to switch the rig freq?
|
// TODO: jsherer - is this the right way to switch the rig freq?
|
||||||
setRig(station.frequency_);
|
setRig(station.frequency_);
|
||||||
|
|
||||||
// TODO: jsherer - potentially cache the fact that we switched and mark it as an override, so we don't revert back?
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7601,8 +7605,14 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
|
|||||||
if (m_lastDialFreq != m_freqNominal &&
|
if (m_lastDialFreq != m_freqNominal &&
|
||||||
(m_mode != "MSK144"
|
(m_mode != "MSK144"
|
||||||
|| !(ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked()))) {
|
|| !(ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked()))) {
|
||||||
|
|
||||||
m_lastDialFreq = m_freqNominal;
|
m_lastDialFreq = m_freqNominal;
|
||||||
m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
|
m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
|
||||||
|
|
||||||
|
if(m_freqNominal != m_bandHoppedFreq){
|
||||||
|
m_bandHopped = false;
|
||||||
|
}
|
||||||
|
|
||||||
if(s.frequency () < 30000000u && !m_mode.startsWith ("WSPR")) {
|
if(s.frequency () < 30000000u && !m_mode.startsWith ("WSPR")) {
|
||||||
// Write freq changes to ALL.TXT only below 30 MHz.
|
// Write freq changes to ALL.TXT only below 30 MHz.
|
||||||
QFile f2 {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")};
|
QFile f2 {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")};
|
||||||
|
@ -730,6 +730,8 @@ private:
|
|||||||
QSet<QString> m_callSeenBeacon; // call
|
QSet<QString> m_callSeenBeacon; // call
|
||||||
int m_previousFreq;
|
int m_previousFreq;
|
||||||
bool m_shouldRestoreFreq;
|
bool m_shouldRestoreFreq;
|
||||||
|
bool m_bandHopped;
|
||||||
|
Frequency m_bandHoppedFreq;
|
||||||
|
|
||||||
struct FoxQSO //Everything we need to know about QSOs in progress (or recently logged).
|
struct FoxQSO //Everything we need to know about QSOs in progress (or recently logged).
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user