Fixed #23: idle watchdog should prevent all types of automated transmissions
This commit is contained in:
parent
90858f8964
commit
29f759dafe
@ -5706,13 +5706,25 @@ bool MainWindow::ensureSelcalCallsignSelected(bool alert){
|
|||||||
bool MainWindow::ensureKeyNotStuck(QString const& text){
|
bool MainWindow::ensureKeyNotStuck(QString const& text){
|
||||||
// be annoying and drop messages with all the same character to reduce spam...
|
// be annoying and drop messages with all the same character to reduce spam...
|
||||||
if(text.length() > 5 && QString(text).replace(text.at(0), "").trimmed().isEmpty()){
|
if(text.length() > 5 && QString(text).replace(text.at(0), "").trimmed().isEmpty()){
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::ensureNotIdle(){
|
||||||
|
if (!m_config.watchdog()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_idleMinutes < m_config.watchdog ()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
tx_watchdog (true); // disable transmit and auto replies
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::createMessage(QString const& text){
|
void MainWindow::createMessage(QString const& text){
|
||||||
if(!ensureCallsignSet()){
|
if(!ensureCallsignSet()){
|
||||||
on_stopTxButton_clicked();
|
on_stopTxButton_clicked();
|
||||||
@ -5724,6 +5736,11 @@ void MainWindow::createMessage(QString const& text){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ensureNotIdle()){
|
||||||
|
on_stopTxButton_clicked();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!ensureKeyNotStuck(text)){
|
if(!ensureKeyNotStuck(text)){
|
||||||
on_stopTxButton_clicked();
|
on_stopTxButton_clicked();
|
||||||
|
|
||||||
@ -11000,9 +11017,24 @@ void MainWindow::tx_watchdog (bool triggered)
|
|||||||
tx_status_label.setText ("Inactive watchdog");
|
tx_status_label.setText ("Inactive watchdog");
|
||||||
|
|
||||||
// if the watchdog is triggered...we're no longer active
|
// if the watchdog is triggered...we're no longer active
|
||||||
|
bool wasAuto = ui->autoReplyButton->isChecked();
|
||||||
|
bool wasActive = ui->activeButton->isChecked();
|
||||||
|
bool wasHB = ui->hbMacroButton->isChecked();
|
||||||
|
bool wasCQ = ui->cqMacroButton->isChecked();
|
||||||
|
|
||||||
|
// save the button states
|
||||||
|
ui->autoReplyButton->setChecked(false);
|
||||||
ui->activeButton->setChecked(false);
|
ui->activeButton->setChecked(false);
|
||||||
|
ui->hbMacroButton->setChecked(false);
|
||||||
|
ui->cqMacroButton->setChecked(false);
|
||||||
|
|
||||||
MessageBox::warning_message(this, QString("Attempting to transmit, but you have been inactive for more than %1 minutes.").arg(m_config.watchdog()));
|
MessageBox::warning_message(this, QString("Attempting to transmit, but you have been inactive for more than %1 minutes.").arg(m_config.watchdog()));
|
||||||
|
|
||||||
|
// restore the button states
|
||||||
|
ui->autoReplyButton->setChecked(wasAuto);
|
||||||
|
ui->activeButton->setChecked(wasActive);
|
||||||
|
ui->hbMacroButton->setChecked(wasHB);
|
||||||
|
ui->cqMacroButton->setChecked(wasCQ);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -153,6 +153,7 @@ public slots:
|
|||||||
bool ensureCallsignSet(bool alert=true);
|
bool ensureCallsignSet(bool alert=true);
|
||||||
bool ensureSelcalCallsignSelected(bool alert=true);
|
bool ensureSelcalCallsignSelected(bool alert=true);
|
||||||
bool ensureKeyNotStuck(QString const& text);
|
bool ensureKeyNotStuck(QString const& text);
|
||||||
|
bool ensureNotIdle();
|
||||||
void createMessage(QString const& text);
|
void createMessage(QString const& text);
|
||||||
void createMessageTransmitQueue(QString const& text);
|
void createMessageTransmitQueue(QString const& text);
|
||||||
void resetMessageTransmitQueue();
|
void resetMessageTransmitQueue();
|
||||||
|
Loading…
Reference in New Issue
Block a user