Fixed bug in configuring band hopping

This commit is contained in:
Jordan Sherer 2018-08-11 09:39:02 -04:00
parent 8b07b56250
commit a5b6984ede
3 changed files with 7 additions and 10 deletions

View File

@ -298,8 +298,8 @@ public:
return {
band,
freq_.frequency(),
qMin(a, b),
qMax(a, b),
a,
b,
description_.text ()};
}

View File

@ -490,9 +490,8 @@ bool StationList::impl::setData (QModelIndex const& model_index, QVariant const&
auto t = QTime::fromString(s);
auto at = QDateTime(QDate(2000,1,1), t, Qt::UTC);
auto until = stations_[row].switch_until_;
stations_[row].switch_at_ = qMin(at, until);
stations_[row].switch_until_ = qMax(at, until);
stations_[row].switch_at_ = at;
stations_[row].switch_until_ = until;
Q_EMIT dataChanged (model_index, model_index, roles);
@ -511,9 +510,8 @@ bool StationList::impl::setData (QModelIndex const& model_index, QVariant const&
auto t = QTime::fromString(s);
auto until = QDateTime(QDate(2000,1,1), t, Qt::UTC);
auto at = stations_[row].switch_at_;
stations_[row].switch_at_ = qMin(at, until);
stations_[row].switch_until_ = qMax(at, until);
stations_[row].switch_at_ = at;
stations_[row].switch_until_ = until;
Q_EMIT dataChanged (model_index, model_index, roles);

View File

@ -1339,8 +1339,7 @@ void MainWindow::tryBandHop(){
// 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
bool canSwitch = (
station.switch_at_ <= d &&
d <= station.switch_until_ &&
(station.switch_at_ <= d || d <= station.switch_until_) &&
(m_bandHopped || (!m_bandHopped && station.frequency_ != m_bandHoppedFreq)) &&
station.frequency_ != dialFreq
);