Added autoreply button in conjuntion with beacon button

This commit is contained in:
Jordan Sherer 2018-07-24 16:46:04 -04:00
parent 0bf2afa5f8
commit f415b0c94f
6 changed files with 556 additions and 339 deletions

View File

@ -554,6 +554,7 @@ private:
bool id_after_73_;
bool tx_QSY_allowed_;
bool spot_to_psk_reporter_;
bool autoreply_off_at_startup_;
bool monitor_off_at_startup_;
bool monitor_last_used_;
bool log_as_RTTY_;
@ -664,6 +665,7 @@ void Configuration::set_spot_to_psk_reporter (bool spot)
}
}
bool Configuration::autoreply_off_at_startup () const {return m_->autoreply_off_at_startup_;}
bool Configuration::monitor_off_at_startup () const {return m_->monitor_off_at_startup_;}
bool Configuration::monitor_last_used () const {return m_->rig_is_dummy_ || m_->monitor_last_used_;}
bool Configuration::log_as_RTTY () const {return m_->log_as_RTTY_;}
@ -1179,6 +1181,7 @@ void Configuration::impl::initialize_models ()
ui_->CW_id_after_73_check_box->setChecked (id_after_73_);
ui_->tx_QSY_check_box->setChecked (tx_QSY_allowed_);
ui_->psk_reporter_check_box->setChecked (spot_to_psk_reporter_);
ui_->autoreply_off_check_box->setChecked (autoreply_off_at_startup_);
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_);
@ -1376,6 +1379,7 @@ void Configuration::impl::read_settings ()
type_2_msg_gen_ = settings_->value ("Type2MsgGen", QVariant::fromValue (Configuration::type_2_msg_3_full)).value<Configuration::Type2MsgGen> ();
autoreply_off_at_startup_ = settings_->value ("AutoreplyOFF", false).toBool ();
monitor_off_at_startup_ = settings_->value ("MonitorOFF", false).toBool ();
monitor_last_used_ = settings_->value ("MonitorLastUsed", false).toBool ();
spot_to_psk_reporter_ = settings_->value ("PSKReporter", false).toBool ();
@ -1511,6 +1515,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("AudioInputChannel", AudioDevice::toString (audio_input_channel_));
settings_->setValue ("AudioOutputChannel", AudioDevice::toString (audio_output_channel_));
settings_->setValue ("Type2MsgGen", QVariant::fromValue (type_2_msg_gen_));
settings_->setValue ("AutoreplyOFF", autoreply_off_at_startup_);
settings_->setValue ("MonitorOFF", monitor_off_at_startup_);
settings_->setValue ("MonitorLastUsed", monitor_last_used_);
settings_->setValue ("PSKReporter", spot_to_psk_reporter_);
@ -1937,6 +1942,7 @@ void Configuration::impl::accept ()
RxBandwidth_ = ui_->sbBandwidth->value ();
id_after_73_ = ui_->CW_id_after_73_check_box->isChecked ();
tx_QSY_allowed_ = ui_->tx_QSY_check_box->isChecked ();
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 ();
type_2_msg_gen_ = static_cast<Type2MsgGen> (ui_->type_2_msg_gen_combo_box->currentIndex ());

View File

@ -112,6 +112,7 @@ public:
bool tx_QSY_allowed () const;
bool spot_to_psk_reporter () const;
void set_spot_to_psk_reporter (bool);
bool autoreply_off_at_startup () const;
bool monitor_off_at_startup () const;
bool monitor_last_used () const;
bool log_as_RTTY () const;

View File

@ -314,6 +314,13 @@
<string>Behavior</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="autoreply_off_check_box">
<property name="text">
<string>Autoreply off at startup</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="monitor_off_check_box">
<property name="toolTip">
@ -329,6 +336,9 @@
</item>
<item>
<widget class="QCheckBox" name="monitor_last_used_check_box">
<property name="visible">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Check this if you wish to automatically return to the last monitored frequency when monitor is enabled, leave it unchecked if you wish to have the current rig frequency maintained.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>

View File

@ -4176,7 +4176,7 @@ void MainWindow::guiUpdate()
ui->labUTC->setText(utc);
auto delta = t.secsTo(m_nextBeacon);
auto beacon = ui->beaconButton->isChecked() ? delta > 0 ? QString("%1 s").arg(delta) : "queued!" : "disabled";
auto beacon = ui->beaconButton->isChecked() ? delta > 0 ? QString("%1 s").arg(delta) : "queued!" : m_nextBeaconPaused ? "paused" : "disabled";
ui->labBeacon->setText(QString("Next Beacon: %1").arg(beacon));
if(!m_monitoring and !m_diskData) {
@ -5765,7 +5765,7 @@ bool MainWindow::prepareNextMessageFrame()
if(ui->beaconButton->isChecked()){
// bump beacon
scheduleBeacon(true);
scheduleBacon(true);
}
return true;
@ -5828,7 +5828,8 @@ int MainWindow::findFreeFreqOffset(int fmin, int fmax, int bw){
return 0;
}
void MainWindow::scheduleBeacon(bool first){
// scheduleBeacon
void MainWindow::scheduleBacon(bool first){
auto timestamp = QDateTime::currentDateTimeUtc();
auto orig = timestamp;
@ -5851,13 +5852,22 @@ void MainWindow::scheduleBeacon(bool first){
setBaconTimer(timestamp);
}
// setBeaconTimer
void MainWindow::setBaconTimer(QDateTime timestamp){
// set the next beacon timestamp and timer
beaconTimer.stop();
m_nextBeacon = timestamp;
m_nextBeaconPaused = false;
beaconTimer.start(QDateTime::currentDateTimeUtc().msecsTo(m_nextBeacon) - 2*1000);
}
// pauseBeacon
void MainWindow::pauseBacon(){
ui->beaconButton->setChecked(false);
beaconTimer.stop();
m_nextBeaconPaused = true;
}
// prepareBeacon
void MainWindow::prepareBacon(){
if(!ui->beaconButton->isChecked()){
@ -5882,7 +5892,7 @@ void MainWindow::prepareBacon(){
m_lastTxTime.secsTo(QDateTime::currentDateTimeUtc()) < 30
){
if(ui->beaconButton->isChecked()){
scheduleBeacon(true);
scheduleBacon(true);
}
return;
}
@ -5924,7 +5934,7 @@ void MainWindow::prepareBacon(){
ui->startTxButton->setChecked(true);
scheduleBeacon();
scheduleBacon();
}
@ -7454,7 +7464,7 @@ void MainWindow::on_pbT2R_clicked()
void MainWindow::on_beaconButton_clicked()
{
if(ui->beaconButton->isChecked()){
scheduleBeacon(true);
scheduleBacon(true);
}
}
@ -7590,6 +7600,8 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
{
// initializing
on_monitorButton_clicked (!m_config.monitor_off_at_startup ());
ui->autoReplyButton->setChecked(!m_config.autoreply_off_at_startup());
}
if (s.frequency () != old_state.frequency () || s.split () != m_splitMode)
{
@ -8483,8 +8495,6 @@ void MainWindow::displayActivity(bool force){
ui->tableWidgetCalls->resizeColumnToContents(2);
ui->tableWidgetCalls->resizeColumnToContents(3);
// Recently Directed Activity
while(!m_rxFrameQueue.isEmpty()){
RXDetail d = m_rxFrameQueue.dequeue();
@ -8518,6 +8528,9 @@ void MainWindow::displayActivity(bool force){
bool processed = false;
// TODO: jsherer - should we if we have _any_ directed messages, pause the beacon??
// pauseBacon();
while(!m_rxCommandQueue.isEmpty()){
auto d = m_rxCommandQueue.dequeue();
@ -8601,17 +8614,8 @@ void MainWindow::displayActivity(bool force){
processed = true;
}
if(processed){
// if we have beacon turned on, and it's more than 15 seconds away, automatically reply now, and bump the beacon
if(QDateTime::currentDateTimeUtc().secsTo(m_nextBeacon) >= 15){
setFreqForRestore(f, true);
ui->startTxButton->setChecked(true);
if(ui->beaconButton->isChecked()){
scheduleBeacon(false);
}
}
if(processed && ui->autoReplyButton->isChecked()){
toggleTx(true);
}
}

View File

@ -261,8 +261,9 @@ private slots:
bool prepareNextMessageFrame();
bool isFreqOffsetFree(int f, int bw);
int findFreeFreqOffset(int fmin, int fmax, int bw);
void scheduleBeacon(bool first=false);
void scheduleBacon(bool first=false);
void setBaconTimer(QDateTime timestamp);
void pauseBacon();
void prepareBacon();
QString calculateDistance(QString const& grid);
void on_rptSpinBox_valueChanged(int n);
@ -707,6 +708,7 @@ private:
QQueue<QString> m_foxRR73Queue;
QQueue<qint64> m_foxRateQueue;
bool m_nextBeaconPaused = false;
QDateTime m_nextBeacon;
QDateTime m_dateTimeQSOOn;
QDateTime m_dateTimeLastTX;

File diff suppressed because it is too large Load Diff