Updated configuration for beacon interval

This commit is contained in:
Jordan Sherer 2018-07-06 20:01:38 -04:00
parent f58ce3aec0
commit 145bc8d292
5 changed files with 71 additions and 33 deletions

View File

@ -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<DataMode> (ui_->TX_mode_button_group->checkedId ());

View File

@ -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;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>534</width>
<height>530</height>
<width>785</width>
<height>647</height>
</rect>
</property>
<property name="windowTitle">
@ -81,18 +81,18 @@
</layout>
</item>
<item>
<layout class="QFormLayout" name="formLayout_21">
<item row="0" column="0">
<widget class="QCheckBox" name="use_dynamic_grid">
<property name="toolTip">
<string>Check to allow grid changes from external programs</string>
</property>
<property name="text">
<string>AutoGrid</string>
</property>
</widget>
</item>
</layout>
<layout class="QFormLayout" name="formLayout_21">
<item row="0" column="0">
<widget class="QCheckBox" name="use_dynamic_grid">
<property name="toolTip">
<string>Check to allow grid changes from external programs</string>
</property>
<property name="text">
<string>AutoGrid</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="formLayout_2">
@ -292,14 +292,46 @@
<layout class="QGridLayout" name="gridLayout_8">
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="beacon_label_10">
<property name="text">
<string>Beacon every:</string>
</property>
<property name="buddy">
<cstring>beacon_spin_box</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="beacon_spin_box">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of minutes between unattended beacons&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="suffix">
<string> minutes</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<width>40</width>
<height>0</height>
</size>
</property>
@ -2768,12 +2800,12 @@ soundcard changes</string>
</connection>
</connections>
<buttongroups>
<buttongroup name="CAT_data_bits_button_group"/>
<buttongroup name="PTT_method_button_group"/>
<buttongroup name="TX_audio_source_button_group"/>
<buttongroup name="split_mode_button_group"/>
<buttongroup name="CAT_stop_bits_button_group"/>
<buttongroup name="CAT_handshake_button_group"/>
<buttongroup name="TX_mode_button_group"/>
<buttongroup name="PTT_method_button_group"/>
<buttongroup name="CAT_data_bits_button_group"/>
<buttongroup name="split_mode_button_group"/>
<buttongroup name="CAT_handshake_button_group"/>
<buttongroup name="TX_audio_source_button_group"/>
</buttongroups>
</ui>

View File

@ -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

View File

@ -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[],