diff --git a/Configuration.cpp b/Configuration.cpp index b1cab5b..65a42d0 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -560,6 +560,7 @@ private: bool miles_; bool quick_call_; bool disable_TX_on_73_; + int beacon_; int watchdog_; bool TX_messages_; bool enable_VHF_features_; @@ -661,6 +662,7 @@ bool Configuration::clear_DX () const {return m_->clear_DX_;} bool Configuration::miles () const {return m_->miles_;} bool Configuration::quick_call () const {return m_->quick_call_;} bool Configuration::disable_TX_on_73 () const {return m_->disable_TX_on_73_;} +int Configuration::beacon () const {return m_->beacon_;} int Configuration::watchdog () const {return m_->watchdog_;} bool Configuration::TX_messages () const {return m_->TX_messages_;} bool Configuration::enable_VHF_features () const {return m_->enable_VHF_features_;} @@ -1149,6 +1151,7 @@ void Configuration::impl::initialize_models () ui_->miles_check_box->setChecked (miles_); ui_->quick_call_check_box->setChecked (quick_call_); ui_->disable_TX_on_73_check_box->setChecked (disable_TX_on_73_); + ui_->beacon_spin_box->setValue (beacon_); ui_->tx_watchdog_spin_box->setValue (watchdog_); ui_->TX_messages_check_box->setChecked (TX_messages_); ui_->enable_VHF_features_check_box->setChecked(enable_VHF_features_); @@ -1386,6 +1389,7 @@ void Configuration::impl::read_settings () miles_ = settings_->value ("Miles", false).toBool (); quick_call_ = settings_->value ("QuickCall", false).toBool (); disable_TX_on_73_ = settings_->value ("73TxDisable", false).toBool (); + beacon_ = settings_->value ("TxBeacon", 5).toInt (); watchdog_ = settings_->value ("TxWatchdog", 6).toInt (); TX_messages_ = settings_->value ("Tx2QSO", true).toBool (); enable_VHF_features_ = settings_->value("VHFUHF",false).toBool (); @@ -1484,6 +1488,7 @@ void Configuration::impl::write_settings () settings_->setValue ("Miles", miles_); settings_->setValue ("QuickCall", quick_call_); settings_->setValue ("73TxDisable", disable_TX_on_73_); + settings_->setValue ("TxBeacon", beacon_); settings_->setValue ("TxWatchdog", watchdog_); settings_->setValue ("Tx2QSO", TX_messages_); settings_->setValue ("CATForceDTR", rig_params_.force_dtr); @@ -1891,6 +1896,7 @@ void Configuration::impl::accept () miles_ = ui_->miles_check_box->isChecked (); quick_call_ = ui_->quick_call_check_box->isChecked (); disable_TX_on_73_ = ui_->disable_TX_on_73_check_box->isChecked (); + beacon_ = ui_->beacon_spin_box->value (); watchdog_ = ui_->tx_watchdog_spin_box->value (); TX_messages_ = ui_->TX_messages_check_box->isChecked (); data_mode_ = static_cast (ui_->TX_mode_button_group->checkedId ()); diff --git a/Configuration.hpp b/Configuration.hpp index 886bed0..696604c 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -119,6 +119,7 @@ public: bool miles () const; bool quick_call () const; bool disable_TX_on_73 () const; + int beacon () const; int watchdog () const; bool TX_messages () const; bool split_mode () const; diff --git a/Configuration.ui b/Configuration.ui index 099edae..a9babaf 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -6,8 +6,8 @@ 0 0 - 534 - 530 + 785 + 647 @@ -81,18 +81,18 @@ - - - - - Check to allow grid changes from external programs - - - AutoGrid - - - - + + + + + Check to allow grid changes from external programs + + + AutoGrid + + + + @@ -292,14 +292,46 @@ + + + + Beacon every: + + + beacon_spin_box + + + + + + + <html><head/><body><p>Number of minutes between unattended beacons</p></body></html> + + + minutes + + + + + + 1 + + + 5 + + + Qt::Horizontal + + QSizePolicy::Fixed + - 0 + 40 0 @@ -2768,12 +2800,12 @@ soundcard changes - - - - - + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 49e9f7e..b176bf2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -222,6 +222,17 @@ namespace widget->removeRow(i); } } + + int roundUp(int numToRound, int multiple) + { + if(multiple == 0) + { + return numToRound; + } + + int roundDown = ( (int) (numToRound) / multiple) * multiple; + return roundDown + multiple; + } } //--------------------------------------------------- MainWindow constructor @@ -5384,7 +5395,7 @@ void MainWindow::scheduleBeacon(bool first){ // round to 15 second increment int secondsSinceEpoch = (timestamp.toMSecsSinceEpoch()/1000); - int delta = roundUp(secondsSinceEpoch, 15) + 1 + (first ? m_txFirst ? 15 : 30 : 300) - secondsSinceEpoch; + int delta = roundUp(secondsSinceEpoch, 15) + 1 + (first ? m_txFirst ? 15 : 30 : qMax(1, m_config.beacon()) * 60) - secondsSinceEpoch; timestamp = timestamp.addSecs(delta); // set the next beacon timestamp and timer diff --git a/mainwindow.h b/mainwindow.h index c97ece0..320cd68 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -797,18 +797,6 @@ protected: } }; - -static int roundUp(int numToRound, int multiple) -{ - if(multiple == 0) - { - return numToRound; - } - - int roundDown = ( (int) (numToRound) / multiple) * multiple; - return roundDown + multiple; -} - extern int killbyname(const char* progName); extern void getDev(int* numDevices,char hostAPI_DeviceName[][50], int minChan[], int maxChan[],