From 2e803a6f94aea8d574ebe058a3fe9ae394045372 Mon Sep 17 00:00:00 2001
From: EspoTek <admin@espotek.com>
Date: Tue, 28 Nov 2017 15:31:33 +1100
Subject: [PATCH] extended last patch to CH2 also.

---
 Desktop_Interface/mainwindow.cpp       | 12 ++++++++++++
 Desktop_Interface/uartstyledecoder.cpp |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Desktop_Interface/mainwindow.cpp b/Desktop_Interface/mainwindow.cpp
index 7e0b22d8..ce060f66 100644
--- a/Desktop_Interface/mainwindow.cpp
+++ b/Desktop_Interface/mainwindow.cpp
@@ -1693,6 +1693,7 @@ void MainWindow::serialEmergencyDisable(int channel){
         //Bring back the lost text.
         ui->console1->setVisible(true);
         //Warn the user that the wire has been disconnected.
+        QApplication::beep();
         ui->console1->appendPlainText("\n\n***Error:UART is not connected***\n***Serial Decoding has been disabled***");
         //Scroll to end of console.
         QTextCursor c =  ui->console1->textCursor();
@@ -1700,7 +1701,18 @@ void MainWindow::serialEmergencyDisable(int channel){
         ui->console1->setTextCursor(c);
     }
     else{
+        //Disable the serial as if the user turned it off manually.
         ui->serialDecodingCheck_CH2->setChecked(false);
+
+        //Bring back the lost text.
+        ui->console2->setVisible(true);
+        //Warn the user that the wire has been disconnected.
+        QApplication::beep();
+        ui->console2->appendPlainText("\n\n***Error:UART is not connected***\n***Serial Decoding has been disabled***");
+        //Scroll to end of console.
+        QTextCursor c =  ui->console2->textCursor();
+        c.movePosition(QTextCursor::End);
+        ui->console2->setTextCursor(c);
     }
 
 }
diff --git a/Desktop_Interface/uartstyledecoder.cpp b/Desktop_Interface/uartstyledecoder.cpp
index a5c05176..700ac8cf 100644
--- a/Desktop_Interface/uartstyledecoder.cpp
+++ b/Desktop_Interface/uartstyledecoder.cpp
@@ -68,7 +68,7 @@ void uartStyleDecoder::serialDecode(double baudRate)
     //Not a single stop bit, or idle bit, in the whole stream.  Wire must be disconnected.
     if(allZeroes){
         qDebug() << "Wire Disconnect detected!";
-        wireDisconnected(1);
+        wireDisconnected(parent->channel);
         parent->stopDecoding = true;
         updateTimer->stop();
     }