Fixed idle timer for idle watchdog
This commit is contained in:
parent
7da30200f5
commit
d076eedeb8
@ -631,7 +631,7 @@ text message.</string>
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="heartbeat_spin_box">
|
<widget class="QSpinBox" name="heartbeat_spin_box">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Number of minutes between unattended pings</p></body></html></string>
|
<string><html><head/><body><p>Number of minutes between unattended heartbeat transmissions.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> minutes</string>
|
<string> minutes</string>
|
||||||
@ -670,10 +670,7 @@ text message.</string>
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="tx_watchdog_spin_box">
|
<widget class="QSpinBox" name="tx_watchdog_spin_box">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Number of minutes before unattended transmissions are aborted (pings, auto-replies, etc).</p></body></html></string>
|
<string><html><head/><body><p>Number of minutes before unattended heartbeat transmissions are aborted.</p></body></html></string>
|
||||||
</property>
|
|
||||||
<property name="specialValueText">
|
|
||||||
<string>Disabled</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> minutes</string>
|
<string> minutes</string>
|
||||||
@ -682,7 +679,7 @@ text message.</string>
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>1440</number>
|
<number>1440</number>
|
||||||
|
@ -1498,8 +1498,10 @@ void MainWindow::initializeDummyData(){
|
|||||||
|
|
||||||
displayActivity(true);
|
displayActivity(true);
|
||||||
|
|
||||||
|
ui->heartbeatButton->click();
|
||||||
QTimer::singleShot(10000, this, [this](){
|
QTimer::singleShot(10000, this, [this](){
|
||||||
tx_watchdog(true);
|
m_idleMinutes = 61;
|
||||||
|
scheduleHeartbeat(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1535,9 +1537,10 @@ void MainWindow::on_the_minute ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_config.watchdog () && !m_mode.startsWith ("WSPR"))
|
if (m_config.watchdog ())
|
||||||
{
|
{
|
||||||
++m_idleMinutes;
|
++m_idleMinutes;
|
||||||
|
qDebug() << "idle" << m_idleMinutes << "minutes";
|
||||||
update_watchdog_label ();
|
update_watchdog_label ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4079,10 +4082,10 @@ void MainWindow::guiUpdate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// watchdog!
|
// watchdog!
|
||||||
if (m_config.watchdog() && !m_mode.startsWith ("WSPR")
|
// if (m_config.watchdog() && !m_mode.startsWith ("WSPR")
|
||||||
&& m_idleMinutes >= m_config.watchdog ()) {
|
// && m_idleMinutes >= m_config.watchdog ()) {
|
||||||
tx_watchdog (true); // disable transmit
|
// tx_watchdog (true); // disable transmit
|
||||||
}
|
// }
|
||||||
|
|
||||||
float fTR=float((ms%(1000*m_TRperiod)))/(1000*m_TRperiod);
|
float fTR=float((ms%(1000*m_TRperiod)))/(1000*m_TRperiod);
|
||||||
|
|
||||||
@ -4261,7 +4264,8 @@ void MainWindow::guiUpdate()
|
|||||||
auto const& current_message = QString::fromLatin1 (msgsent);
|
auto const& current_message = QString::fromLatin1 (msgsent);
|
||||||
if(m_config.watchdog () && !m_mode.startsWith ("WSPR")
|
if(m_config.watchdog () && !m_mode.startsWith ("WSPR")
|
||||||
&& current_message != m_msgSent0) {
|
&& current_message != m_msgSent0) {
|
||||||
tx_watchdog (false); // in case we are auto sequencing
|
// new messages don't reset the idle timer :|
|
||||||
|
// tx_watchdog (false); // in case we are auto sequencing
|
||||||
m_msgSent0 = current_message;
|
m_msgSent0 = current_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4334,7 +4338,10 @@ void MainWindow::guiUpdate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(m_monitoring) {
|
} else if(m_monitoring) {
|
||||||
if (!m_tx_watchdog) {
|
if (m_tx_watchdog) {
|
||||||
|
tx_status_label.setStyleSheet ("QLabel{background-color: #ff0000}");
|
||||||
|
tx_status_label.setText ("Idle watchdog");
|
||||||
|
} else {
|
||||||
tx_status_label.setStyleSheet("QLabel{background-color: #00ff00}");
|
tx_status_label.setStyleSheet("QLabel{background-color: #00ff00}");
|
||||||
QString t;
|
QString t;
|
||||||
t="Receiving";
|
t="Receiving";
|
||||||
@ -4425,9 +4432,11 @@ void MainWindow::guiUpdate()
|
|||||||
|
|
||||||
void MainWindow::startTx()
|
void MainWindow::startTx()
|
||||||
{
|
{
|
||||||
|
#if IDLE_BLOCKS_TX
|
||||||
if(m_tx_watchdog){
|
if(m_tx_watchdog){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(!prepareNextMessageFrame()){
|
if(!prepareNextMessageFrame()){
|
||||||
return;
|
return;
|
||||||
@ -4481,7 +4490,11 @@ void MainWindow::stopTx()
|
|||||||
tx_status_label.setText("");
|
tx_status_label.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if IDLE_BLOCKS_TX
|
||||||
bool shouldContinue = !m_tx_watchdog && prepareNextMessageFrame();
|
bool shouldContinue = !m_tx_watchdog && prepareNextMessageFrame();
|
||||||
|
#else
|
||||||
|
bool shouldContinue = prepareNextMessageFrame();
|
||||||
|
#endif
|
||||||
if(!shouldContinue){
|
if(!shouldContinue){
|
||||||
// TODO: jsherer - split this up...
|
// TODO: jsherer - split this up...
|
||||||
ui->extFreeTextMsgEdit->setReadOnly(false);
|
ui->extFreeTextMsgEdit->setReadOnly(false);
|
||||||
@ -5509,6 +5522,12 @@ void MainWindow::pauseHeartbeat(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// unpausePing
|
||||||
|
void MainWindow::unpauseHeartbeat(){
|
||||||
|
ui->heartbeatButton->setChecked(true);
|
||||||
|
scheduleHeartbeat(false);
|
||||||
|
}
|
||||||
|
|
||||||
// checkPing
|
// checkPing
|
||||||
void MainWindow::checkHeartbeat(){
|
void MainWindow::checkHeartbeat(){
|
||||||
if(!ui->heartbeatButton->isChecked()){
|
if(!ui->heartbeatButton->isChecked()){
|
||||||
@ -5525,6 +5544,12 @@ void MainWindow::checkHeartbeat(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// idle heartbeat watchdog!
|
||||||
|
if (m_config.watchdog() && m_idleMinutes >= m_config.watchdog ()){
|
||||||
|
tx_watchdog (true); // disable transmit
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
prepareHeartbeat();
|
prepareHeartbeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8983,9 +9008,11 @@ void MainWindow::processSpots() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::processTxQueue(){
|
void MainWindow::processTxQueue(){
|
||||||
|
#if IDLE_BLOCKS_TX
|
||||||
if(m_tx_watchdog){
|
if(m_tx_watchdog){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(m_txMessageQueue.isEmpty()){
|
if(m_txMessageQueue.isEmpty()){
|
||||||
return;
|
return;
|
||||||
@ -10148,12 +10175,13 @@ void MainWindow::tx_watchdog (bool triggered)
|
|||||||
tx_status_label.setStyleSheet ("QLabel{background-color: #ff0000}");
|
tx_status_label.setStyleSheet ("QLabel{background-color: #ff0000}");
|
||||||
tx_status_label.setText ("Idle watchdog");
|
tx_status_label.setText ("Idle watchdog");
|
||||||
|
|
||||||
MessageBox::warning_message(this, QString("You have been idle for more than %1 minutes.").arg(m_config.watchdog()));
|
pauseHeartbeat();
|
||||||
|
MessageBox::warning_message(this, QString("Attempting to transmit heartbeat, but you have been idle for more than %1 minutes.").arg(m_config.watchdog()));
|
||||||
|
unpauseHeartbeat();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_idleMinutes = 0;
|
// m_idleMinutes = 0;
|
||||||
update_watchdog_label ();
|
update_watchdog_label ();
|
||||||
}
|
}
|
||||||
if (prior != triggered) statusUpdate ();
|
if (prior != triggered) statusUpdate ();
|
||||||
|
@ -303,6 +303,7 @@ private slots:
|
|||||||
int findFreeFreqOffset(int fmin, int fmax, int bw);
|
int findFreeFreqOffset(int fmin, int fmax, int bw);
|
||||||
void scheduleHeartbeat(bool first=false);
|
void scheduleHeartbeat(bool first=false);
|
||||||
void pauseHeartbeat();
|
void pauseHeartbeat();
|
||||||
|
void unpauseHeartbeat();
|
||||||
void checkHeartbeat();
|
void checkHeartbeat();
|
||||||
void prepareHeartbeat();
|
void prepareHeartbeat();
|
||||||
QString calculateDistance(QString const& grid, int *pDistance=nullptr);
|
QString calculateDistance(QString const& grid, int *pDistance=nullptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user