Initial stab at band switching...broken
This commit is contained in:
parent
c0cfac10dc
commit
330eb3a57e
12
Bands.cpp
12
Bands.cpp
@ -87,6 +87,18 @@ int Bands::find (QString const& band) const
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Bands::findFreq(QString const& band, Radio::Frequency *pFreq) const {
|
||||
int row = find(band);
|
||||
if(row == -1){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(pFreq) *pFreq = ADIF_bands[row].lower_bound_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QString const& Bands::oob ()
|
||||
{
|
||||
return oob_name;
|
||||
|
@ -56,6 +56,8 @@ public:
|
||||
//
|
||||
QString find (Frequency) const; // find band Frequency is in
|
||||
int find (QString const&) const; // find row of band (-1 if not valid)
|
||||
bool findFreq(QString const& band, Radio::Frequency *pFreq) const;
|
||||
|
||||
static QString const& oob ();
|
||||
|
||||
// Iterators
|
||||
|
@ -161,6 +161,7 @@
|
||||
#include <QColorDialog>
|
||||
#include <QSerialPortInfo>
|
||||
#include <QScopedPointer>
|
||||
#include <QDateTimeEdit>
|
||||
|
||||
#include "pimpl_impl.hpp"
|
||||
#include "qt_helpers.hpp"
|
||||
@ -260,14 +261,18 @@ public:
|
||||
: QDialog {parent}
|
||||
, filtered_bands_ {new CandidateKeyFilter {bands, stations, 0, 0}}
|
||||
{
|
||||
setWindowTitle (QApplication::applicationName () + " - " + tr ("Add Station"));
|
||||
setWindowTitle (QApplication::applicationName () + " - " + tr ("Add Schedule"));
|
||||
|
||||
band_.setModel (filtered_bands_.data ());
|
||||
|
||||
switch_at_.setTimeSpec(Qt::UTC);
|
||||
switch_at_.setDisplayFormat("hh:mm");
|
||||
|
||||
auto form_layout = new QFormLayout ();
|
||||
form_layout->addRow (tr ("&Band:"), &band_);
|
||||
form_layout->addRow (tr ("&Offset (MHz):"), &delta_);
|
||||
form_layout->addRow (tr ("&Antenna:"), &description_);
|
||||
form_layout->addRow (tr ("&Frequency (MHz):"), &freq_);
|
||||
form_layout->addRow (tr ("&Switch at (UTC)):"), &switch_at_);
|
||||
//form_layout->addRow (tr ("&Antenna:"), &description_);
|
||||
|
||||
auto main_layout = new QVBoxLayout (this);
|
||||
main_layout->addLayout (form_layout);
|
||||
@ -277,16 +282,11 @@ public:
|
||||
|
||||
connect (button_box, &QDialogButtonBox::accepted, this, &StationDialog::accept);
|
||||
connect (button_box, &QDialogButtonBox::rejected, this, &StationDialog::reject);
|
||||
|
||||
if (delta_.text ().isEmpty ())
|
||||
{
|
||||
delta_.setText ("0");
|
||||
}
|
||||
}
|
||||
|
||||
StationList::Station station () const
|
||||
{
|
||||
return {band_.currentText (), delta_.frequency_delta (), description_.text ()};
|
||||
return {band_.currentText (), freq_.frequency(), QDateTime(QDate(2000, 1, 1), switch_at_.time(), Qt::UTC), description_.text ()};
|
||||
}
|
||||
|
||||
int exec () override
|
||||
@ -299,7 +299,8 @@ private:
|
||||
QScopedPointer<CandidateKeyFilter> filtered_bands_;
|
||||
|
||||
QComboBox band_;
|
||||
FrequencyDeltaLineEdit delta_;
|
||||
FrequencyLineEdit freq_;
|
||||
QTimeEdit switch_at_;
|
||||
QLineEdit description_;
|
||||
};
|
||||
|
||||
@ -501,8 +502,7 @@ private:
|
||||
FrequencyList_v2 next_frequencies_;
|
||||
StationList stations_;
|
||||
StationList next_stations_;
|
||||
FrequencyDelta current_offset_;
|
||||
FrequencyDelta current_tx_offset_;
|
||||
bool auto_switch_bands_;
|
||||
|
||||
QAction * frequency_delete_action_;
|
||||
QAction * frequency_insert_action_;
|
||||
@ -706,6 +706,7 @@ Bands * Configuration::bands () {return &m_->bands_;}
|
||||
Bands const * Configuration::bands () const {return &m_->bands_;}
|
||||
StationList * Configuration::stations () {return &m_->stations_;}
|
||||
StationList const * Configuration::stations () const {return &m_->stations_;}
|
||||
bool Configuration::auto_switch_bands() const { return &m_->auto_switch_bands_; }
|
||||
IARURegions::Region Configuration::region () const {return m_->region_;}
|
||||
FrequencyList_v2 * Configuration::frequencies () {return &m_->frequencies_;}
|
||||
FrequencyList_v2 const * Configuration::frequencies () const {return &m_->frequencies_;}
|
||||
@ -724,7 +725,7 @@ void Configuration::set_calibration (CalibrationParams params)
|
||||
|
||||
void Configuration::enable_calibration (bool on)
|
||||
{
|
||||
auto target_frequency = m_->remove_calibration (m_->cached_rig_state_.frequency ()) - m_->current_offset_;
|
||||
auto target_frequency = m_->remove_calibration (m_->cached_rig_state_.frequency ());
|
||||
m_->frequency_calibration_disabled_ = !on;
|
||||
transceiver_frequency (target_frequency);
|
||||
}
|
||||
@ -910,8 +911,6 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
|
||||
, next_frequencies_ {&bands_}
|
||||
, stations_ {&bands_}
|
||||
, next_stations_ {&bands_}
|
||||
, current_offset_ {0}
|
||||
, current_tx_offset_ {0}
|
||||
, frequency_dialog_ {new FrequencyDialog {®ions_, &modes_, this}}
|
||||
, station_dialog_ {new StationDialog {&next_stations_, &bands_, this}}
|
||||
, last_port_type_ {TransceiverFactory::Capabilities::none}
|
||||
@ -1112,6 +1111,7 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
|
||||
|
||||
ui_->stations_table_view->setModel (&next_stations_);
|
||||
ui_->stations_table_view->sortByColumn (StationList::band_column, Qt::AscendingOrder);
|
||||
connect(ui_->auto_switch_bands_check_box, &QCheckBox::clicked, ui_->stations_table_view, &QTableView::setEnabled);
|
||||
|
||||
// delegates
|
||||
auto stations_item_delegate = new QStyledItemDelegate {this};
|
||||
@ -1230,6 +1230,8 @@ void Configuration::impl::initialize_models ()
|
||||
ui_->monitor_off_check_box->setChecked (monitor_off_at_startup_);
|
||||
ui_->monitor_last_used_check_box->setChecked (monitor_last_used_);
|
||||
ui_->log_as_RTTY_check_box->setChecked (log_as_RTTY_);
|
||||
ui_->auto_switch_bands_check_box->setChecked(auto_switch_bands_);
|
||||
ui_->stations_table_view->setEnabled(ui_->auto_switch_bands_check_box->isChecked());
|
||||
ui_->report_in_comments_check_box->setChecked (report_in_comments_);
|
||||
ui_->prompt_to_log_check_box->setChecked (prompt_to_log_);
|
||||
ui_->insert_blank_check_box->setChecked (insert_blank_);
|
||||
@ -1308,6 +1310,7 @@ void Configuration::impl::initialize_models ()
|
||||
next_frequencies_.frequency_list (frequencies_.frequency_list ());
|
||||
next_stations_.station_list (stations_.station_list ());
|
||||
|
||||
|
||||
set_rig_invariants ();
|
||||
}
|
||||
|
||||
@ -1457,6 +1460,7 @@ void Configuration::impl::read_settings ()
|
||||
}
|
||||
|
||||
stations_.station_list (settings_->value ("stations").value<StationList::Stations> ());
|
||||
auto_switch_bands_ = settings_->value("AutoSwitchBands", false).toBool();
|
||||
|
||||
log_as_RTTY_ = settings_->value ("toRTTY", false).toBool ();
|
||||
report_in_comments_ = settings_->value("dBtoComments", false).toBool ();
|
||||
@ -1571,6 +1575,7 @@ void Configuration::impl::write_settings ()
|
||||
settings_->setValue ("Macros", macros_.stringList ());
|
||||
settings_->setValue ("FrequenciesForRegionModes", QVariant::fromValue (frequencies_.frequency_list ()));
|
||||
settings_->setValue ("stations", QVariant::fromValue (stations_.station_list ()));
|
||||
settings_->setValue ("AutoSwitchBands", auto_switch_bands_);
|
||||
settings_->setValue ("toRTTY", log_as_RTTY_);
|
||||
settings_->setValue ("dBtoComments", report_in_comments_);
|
||||
settings_->setValue ("Rig", rig_params_.rig_name);
|
||||
@ -1993,6 +1998,7 @@ void Configuration::impl::accept ()
|
||||
autoreply_off_at_startup_ = ui_->autoreply_off_check_box->isChecked ();
|
||||
monitor_off_at_startup_ = ui_->monitor_off_check_box->isChecked ();
|
||||
monitor_last_used_ = ui_->monitor_last_used_check_box->isChecked ();
|
||||
auto_switch_bands_ = ui_->auto_switch_bands_check_box->isChecked();
|
||||
type_2_msg_gen_ = static_cast<Type2MsgGen> (ui_->type_2_msg_gen_combo_box->currentIndex ());
|
||||
log_as_RTTY_ = ui_->log_as_RTTY_check_box->isChecked ();
|
||||
report_in_comments_ = ui_->report_in_comments_check_box->isChecked ();
|
||||
@ -2467,16 +2473,24 @@ void Configuration::impl::delete_stations ()
|
||||
selection_model->select (selection_model->selection (), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||
next_stations_.removeDisjointRows (selection_model->selectedRows ());
|
||||
ui_->stations_table_view->resizeColumnToContents (StationList::band_column);
|
||||
ui_->stations_table_view->resizeColumnToContents (StationList::offset_column);
|
||||
ui_->stations_table_view->resizeColumnToContents (StationList::frequency_column);
|
||||
}
|
||||
|
||||
void Configuration::impl::insert_station ()
|
||||
{
|
||||
if (QDialog::Accepted == station_dialog_->exec ())
|
||||
{
|
||||
ui_->stations_table_view->setCurrentIndex (next_stations_.add (station_dialog_->station ()));
|
||||
auto station = station_dialog_->station ();
|
||||
if(station.frequency_ == 0){
|
||||
Frequency f;
|
||||
if(bands_.findFreq(station.band_name_, &f)){
|
||||
station.frequency_ = f;
|
||||
}
|
||||
}
|
||||
|
||||
ui_->stations_table_view->setCurrentIndex (next_stations_.add (station));
|
||||
ui_->stations_table_view->resizeColumnToContents (StationList::band_column);
|
||||
ui_->stations_table_view->resizeColumnToContents (StationList::offset_column);
|
||||
ui_->stations_table_view->resizeColumnToContents (StationList::frequency_column);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2640,8 +2654,7 @@ void Configuration::impl::transceiver_frequency (Frequency f)
|
||||
// cannot absolutely determine if the offset should apply but by
|
||||
// simply picking an offset when the Rx frequency is set and
|
||||
// sticking to it we get sane behaviour
|
||||
current_offset_ = stations_.offset (f);
|
||||
cached_rig_state_.frequency (apply_calibration (f + current_offset_));
|
||||
cached_rig_state_.frequency (apply_calibration (f));
|
||||
|
||||
Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_);
|
||||
}
|
||||
@ -2664,8 +2677,7 @@ void Configuration::impl::transceiver_tx_frequency (Frequency f)
|
||||
// rig, we cannot absolutely determine if the offset should
|
||||
// apply but by simply picking an offset when the Rx
|
||||
// frequency is set and sticking to it we get sane behaviour
|
||||
current_tx_offset_ = stations_.offset (f);
|
||||
cached_rig_state_.tx_frequency (apply_calibration (f + current_tx_offset_));
|
||||
cached_rig_state_.tx_frequency (apply_calibration (f));
|
||||
}
|
||||
|
||||
Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_);
|
||||
@ -2732,12 +2744,12 @@ void Configuration::impl::handle_transceiver_update (TransceiverState const& sta
|
||||
{
|
||||
TransceiverState reported_state {state};
|
||||
// take off calibration & offset
|
||||
reported_state.frequency (remove_calibration (reported_state.frequency ()) - current_offset_);
|
||||
reported_state.frequency (remove_calibration (reported_state.frequency ()));
|
||||
|
||||
if (reported_state.tx_frequency ())
|
||||
{
|
||||
// take off calibration & offset
|
||||
reported_state.tx_frequency (remove_calibration (reported_state.tx_frequency ()) - current_tx_offset_);
|
||||
reported_state.tx_frequency (remove_calibration (reported_state.tx_frequency ()));
|
||||
}
|
||||
|
||||
Q_EMIT self_->transceiver_update (reported_state);
|
||||
|
@ -162,6 +162,7 @@ public:
|
||||
FrequencyList_v2 const * frequencies () const;
|
||||
StationList * stations ();
|
||||
StationList const * stations () const;
|
||||
bool auto_switch_bands() const;
|
||||
QStringListModel * macros ();
|
||||
QStringListModel const * macros () const;
|
||||
QDir save_directory () const;
|
||||
|
555
Configuration.ui
555
Configuration.ui
@ -556,15 +556,15 @@
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Periodic CW ID Inter&val:</string>
|
||||
</property>
|
||||
@ -578,15 +578,15 @@
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Send a CW ID periodically every few minutes.
|
||||
This might be required under your countries licence regulations.
|
||||
@ -2339,11 +2339,21 @@ for assessing propagation and system performance.</string>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Station Information</string>
|
||||
<string>Frequency Schedule</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="auto_switch_bands_check_box">
|
||||
<property name="text">
|
||||
<string>Automatically switch bands / frequencies at specific times of day</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="stations_table_view">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
@ -2693,268 +2703,267 @@ Right click for insert and delete options.</string>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" native="true">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_9">
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Miscellaneous</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_10">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Degrade S/N of .wav file: </string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbDegrade</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="sbDegrade">
|
||||
<property name="toolTip">
|
||||
<string>For offline sensitivity tests</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> dB</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Receiver bandwidth:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbBandwidth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="sbBandwidth">
|
||||
<property name="toolTip">
|
||||
<string>For offline sensitivity tests</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> Hz</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>6000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Tx delay:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbTxDelay</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="sbTxDelay">
|
||||
<property name="toolTip">
|
||||
<string>Minimum delay between assertion of PTT and start of Tx audio.</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> s</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>0.500000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="cbx2ToneSpacing">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Generate Tx audio with twice the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-2 before generating RF.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>x 2 Tone Spacing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="cbx4ToneSpacing">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Generate Tx audio with four times the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-4 before generating RF.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>x 4 Tone Spacing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>User-selectable parameters for JT65 VHF/UHF/Microwave decoding.</p></body></html></string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>JT65 VHF/UHF/Microwave decoding parameters</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_11">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Random erasure patterns:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbNtrials</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="sbNtrials">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Maximum number of erasure patterns for stochastic soft-decision Reed Solomon decoder is 10^(n/2).</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Aggressive decoding level:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbAggressive</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="sbAggressive">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Higher levels will increase the probability of decoding, but will also increase probability of a false decode.</p></body></html></string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="cbTwoPass">
|
||||
<property name="text">
|
||||
<string>Two-pass decoding</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>FT8 DXpedition mode</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>10</y>
|
||||
<width>231</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbFox">
|
||||
<property name="toolTip">
|
||||
<string>Fox is the DXpedition station</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> Fox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbHound">
|
||||
<property name="toolTip">
|
||||
<string>Everybody else is a Hound</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hound</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_9">
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Miscellaneous</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_10">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Degrade S/N of .wav file: </string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbDegrade</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="sbDegrade">
|
||||
<property name="toolTip">
|
||||
<string>For offline sensitivity tests</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> dB</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Receiver bandwidth:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbBandwidth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="sbBandwidth">
|
||||
<property name="toolTip">
|
||||
<string>For offline sensitivity tests</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> Hz</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>6000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Tx delay:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbTxDelay</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="sbTxDelay">
|
||||
<property name="toolTip">
|
||||
<string>Minimum delay between assertion of PTT and start of Tx audio.</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> s</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>0.500000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="cbx2ToneSpacing">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Generate Tx audio with twice the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-2 before generating RF.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>x 2 Tone Spacing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="cbx4ToneSpacing">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Generate Tx audio with four times the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-4 before generating RF.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>x 4 Tone Spacing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>User-selectable parameters for JT65 VHF/UHF/Microwave decoding.</p></body></html></string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>JT65 VHF/UHF/Microwave decoding parameters</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_11">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Random erasure patterns:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbNtrials</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="sbNtrials">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Maximum number of erasure patterns for stochastic soft-decision Reed Solomon decoder is 10^(n/2).</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Aggressive decoding level:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbAggressive</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="sbAggressive">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Higher levels will increase the probability of decoding, but will also increase probability of a false decode.</p></body></html></string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="cbTwoPass">
|
||||
<property name="text">
|
||||
<string>Two-pass decoding</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>FT8 DXpedition mode</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>10</y>
|
||||
<width>231</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbFox">
|
||||
<property name="toolTip">
|
||||
<string>Fox is the DXpedition station</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> Fox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbHound">
|
||||
<property name="toolTip">
|
||||
<string>Everybody else is a Hound</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hound</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -3135,11 +3144,11 @@ soundcard changes</string>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="TX_audio_source_button_group"/>
|
||||
<buttongroup name="TX_mode_button_group"/>
|
||||
<buttongroup name="CAT_handshake_button_group"/>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="PTT_method_button_group"/>
|
||||
<buttongroup name="CAT_stop_bits_button_group"/>
|
||||
<buttongroup name="CAT_handshake_button_group"/>
|
||||
<buttongroup name="CAT_data_bits_button_group"/>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="CAT_stop_bits_button_group"/>
|
||||
<buttongroup name="TX_mode_button_group"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
113
StationList.cpp
113
StationList.cpp
@ -28,7 +28,8 @@ QDebug operator << (QDebug debug, StationList::Station const& station)
|
||||
QDebugStateSaver saver {debug};
|
||||
debug.nospace () << "Station("
|
||||
<< station.band_name_ << ", "
|
||||
<< station.offset_ << ", "
|
||||
<< station.frequency_ << ", "
|
||||
<< station.switch_at_ << ", "
|
||||
<< station.antenna_description_ << ')';
|
||||
return debug;
|
||||
}
|
||||
@ -37,14 +38,16 @@ QDebug operator << (QDebug debug, StationList::Station const& station)
|
||||
QDataStream& operator << (QDataStream& os, StationList::Station const& station)
|
||||
{
|
||||
return os << station.band_name_
|
||||
<< station.offset_
|
||||
<< station.frequency_
|
||||
<< station.switch_at_
|
||||
<< station.antenna_description_;
|
||||
}
|
||||
|
||||
QDataStream& operator >> (QDataStream& is, StationList::Station& station)
|
||||
{
|
||||
return is >> station.band_name_
|
||||
>> station.offset_
|
||||
>> station.frequency_
|
||||
>> station.switch_at_
|
||||
>> station.antenna_description_;
|
||||
}
|
||||
|
||||
@ -172,12 +175,6 @@ bool StationList::removeDisjointRows (QModelIndexList rows)
|
||||
return result;
|
||||
}
|
||||
|
||||
auto StationList::offset (Frequency f) const -> FrequencyDelta
|
||||
{
|
||||
return m_->offset (f);
|
||||
}
|
||||
|
||||
|
||||
auto StationList::impl::station_list (Stations stations) -> Stations
|
||||
{
|
||||
beginResetModel ();
|
||||
@ -203,6 +200,7 @@ QModelIndex StationList::impl::add (Station s)
|
||||
return QModelIndex {};
|
||||
}
|
||||
|
||||
#if 0
|
||||
auto StationList::impl::offset (Frequency f) const -> FrequencyDelta
|
||||
{
|
||||
// Lookup band for frequency
|
||||
@ -214,12 +212,13 @@ auto StationList::impl::offset (Frequency f) const -> FrequencyDelta
|
||||
{
|
||||
if (stations_[i].band_name_ == band)
|
||||
{
|
||||
return stations_[i].offset_;
|
||||
return stations_[i].frequency_;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0; // no offset
|
||||
}
|
||||
#endif
|
||||
|
||||
int StationList::impl::rowCount (QModelIndex const& parent) const
|
||||
{
|
||||
@ -300,9 +299,9 @@ QVariant StationList::impl::data (QModelIndex const& index, int role) const
|
||||
}
|
||||
break;
|
||||
|
||||
case offset_column:
|
||||
case frequency_column:
|
||||
{
|
||||
auto frequency_offset = stations_.at (row).offset_;
|
||||
auto frequency_offset = stations_.at (row).frequency_;
|
||||
switch (role)
|
||||
{
|
||||
case SortRole:
|
||||
@ -317,7 +316,7 @@ QVariant StationList::impl::data (QModelIndex const& index, int role) const
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
item = tr ("Frequency offset");
|
||||
item = tr ("Frequency");
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
@ -327,27 +326,48 @@ QVariant StationList::impl::data (QModelIndex const& index, int role) const
|
||||
}
|
||||
break;
|
||||
|
||||
case description_column:
|
||||
switch (role)
|
||||
{
|
||||
case SortRole:
|
||||
case Qt::EditRole:
|
||||
case Qt::DisplayRole:
|
||||
case Qt::AccessibleTextRole:
|
||||
item = stations_.at (row).antenna_description_;
|
||||
break;
|
||||
case switch_column:
|
||||
switch (role)
|
||||
{
|
||||
case SortRole:
|
||||
case Qt::EditRole:
|
||||
case Qt::DisplayRole:
|
||||
case Qt::AccessibleTextRole:
|
||||
item = stations_.at (row).switch_at_.toUTC().time().toString("hh:mm");
|
||||
break;
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
item = tr ("Antenna description");
|
||||
break;
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
item = tr ("Switch at this time");
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
item = Qt::AlignLeft + Qt::AlignVCenter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Qt::TextAlignmentRole:
|
||||
item = Qt::AlignCenter + Qt::AlignVCenter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case description_column:
|
||||
switch (role)
|
||||
{
|
||||
case SortRole:
|
||||
case Qt::EditRole:
|
||||
case Qt::DisplayRole:
|
||||
case Qt::AccessibleTextRole:
|
||||
item = stations_.at (row).antenna_description_;
|
||||
break;
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
item = tr ("Antenna description");
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
item = Qt::AlignLeft + Qt::AlignVCenter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
@ -362,7 +382,8 @@ QVariant StationList::impl::headerData (int section, Qt::Orientation orientation
|
||||
switch (section)
|
||||
{
|
||||
case band_column: header = tr ("Band"); break;
|
||||
case offset_column: header = tr ("Offset"); break;
|
||||
case frequency_column: header = tr ("Freq. (MHz)"); break;
|
||||
case switch_column: header = tr ("Switch at (UTC)"); break;
|
||||
case description_column: header = tr ("Antenna Description"); break;
|
||||
}
|
||||
}
|
||||
@ -402,21 +423,33 @@ bool StationList::impl::setData (QModelIndex const& model_index, QVariant const&
|
||||
}
|
||||
break;
|
||||
|
||||
case offset_column:
|
||||
case frequency_column:
|
||||
{
|
||||
if (value.canConvert<FrequencyDelta> ())
|
||||
if (value.canConvert<Frequency> ())
|
||||
{
|
||||
FrequencyDelta offset {qvariant_cast<Radio::FrequencyDelta> (value)};
|
||||
if (offset != stations_[row].offset_)
|
||||
Frequency offset {qvariant_cast<Radio::Frequency> (value)};
|
||||
|
||||
if(offset == 0){
|
||||
Frequency f;
|
||||
if(bands_->findFreq(stations_[row].band_name_, &f)){
|
||||
offset = f;
|
||||
}
|
||||
}
|
||||
|
||||
if (offset != stations_[row].frequency_)
|
||||
{
|
||||
stations_[row].offset_ = offset;
|
||||
stations_[row].frequency_ = offset;
|
||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case switch_column:
|
||||
stations_[row].switch_at_ = value.toDateTime();
|
||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||
changed = true;
|
||||
break;
|
||||
case description_column:
|
||||
stations_[row].antenna_description_ = value.toString ();
|
||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||
@ -527,7 +560,7 @@ bool StationList::impl::dropMimeData (QMimeData const * data, Qt::DropAction act
|
||||
, [&band] (Station const& s) {return s.band_name_ == band;}))
|
||||
{
|
||||
// not found so add it
|
||||
add (Station {band, 0, QString {}});
|
||||
add (Station {band, 0, QDateTime::currentDateTimeUtc(), QString {}});
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define STATION_LIST_HPP__
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
@ -52,13 +53,14 @@ public:
|
||||
struct Station
|
||||
{
|
||||
QString band_name_;
|
||||
FrequencyDelta offset_;
|
||||
Frequency frequency_;
|
||||
QDateTime switch_at_;
|
||||
QString antenna_description_;
|
||||
};
|
||||
|
||||
using Stations = QList<Station>;
|
||||
|
||||
enum Column {band_column, offset_column, description_column};
|
||||
enum Column {band_column, frequency_column, switch_column, description_column};
|
||||
|
||||
explicit StationList (Bands const * bands, QObject * parent = nullptr);
|
||||
explicit StationList (Bands const * bands, Stations, QObject * parent = nullptr);
|
||||
@ -74,7 +76,6 @@ public:
|
||||
QModelIndex add (Station); // Add a new Station
|
||||
bool remove (Station); // Remove a Station
|
||||
bool removeDisjointRows (QModelIndexList); // Remove one or more stations
|
||||
FrequencyDelta offset (Frequency) const; // Return the offset to be used for a Frequency
|
||||
|
||||
// Custom sort role.
|
||||
static int constexpr SortRole = Qt::UserRole;
|
||||
@ -88,9 +89,10 @@ private:
|
||||
inline
|
||||
bool operator == (StationList::Station const& lhs, StationList::Station const& rhs)
|
||||
{
|
||||
return lhs.band_name_ == rhs.band_name_
|
||||
&& lhs.offset_ == rhs.offset_
|
||||
&& lhs.antenna_description_ == rhs.antenna_description_;
|
||||
return lhs.band_name_ == rhs.band_name_ &&
|
||||
//lhs.antenna_description_ == rhs.antenna_description_ &&
|
||||
lhs.frequency_ == rhs.frequency_ &&
|
||||
lhs.switch_at_ == rhs.switch_at_;
|
||||
}
|
||||
|
||||
QDataStream& operator << (QDataStream&, StationList::Station const&);
|
||||
|
@ -1348,6 +1348,33 @@ void MainWindow::on_the_minute ()
|
||||
{
|
||||
tx_watchdog (false);
|
||||
}
|
||||
|
||||
// see if we need to hop bands...
|
||||
auto now = QDateTime::currentDateTimeUtc().time();
|
||||
Frequency dial_frequency {m_rigState.ptt () && m_rigState.split () ?
|
||||
m_rigState.tx_frequency () : m_rigState.frequency ()};
|
||||
auto const& band_name = m_config.bands ()->find (dial_frequency);
|
||||
auto stations = m_config.stations()->station_list();
|
||||
qSort(stations.begin(), stations.end(), [](StationList::Station const &a, StationList::Station const &b){
|
||||
return a.switch_at_ < b.switch_at_;
|
||||
});
|
||||
|
||||
StationList::Station prev;
|
||||
foreach(auto station, stations){
|
||||
if(station == stations.first()){
|
||||
prev = station;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(prev.switch_at_.time() <= now && now < station.switch_at_.time()){
|
||||
qDebug() << "switch to" << station.band_name_ << station.frequency_;
|
||||
}
|
||||
|
||||
prev = station;
|
||||
}
|
||||
if(prev.switch_at_.time() <= now && now < QTime(11, 59)){
|
||||
qDebug() << "switch to" << prev.band_name_ << prev.frequency_;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------- MainWindow destructor
|
||||
|
Loading…
Reference in New Issue
Block a user