diff --git a/core/src/mainwindow.cpp b/core/src/mainwindow.cpp index 88a791f..ff03116 100644 --- a/core/src/mainwindow.cpp +++ b/core/src/mainwindow.cpp @@ -606,7 +606,7 @@ void MainWindow::menu_file_loadOfflineDataClicked() data->setData(locid,true,bytearray); } } -void MainWindow::emsCommsSilence() +void MainWindow::emsCommsSilence(qint64 lasttime) { //This is called when the ems has been silent for 5 seconds, when it was previously talking. QLOG_WARN() << "EMS HAS GONE SILENT"; @@ -614,6 +614,7 @@ void MainWindow::emsCommsSilence() ui.statusLabel->setText("EMS SILENT"); emsSilenceTimer->start(250); QMessageBox::information(this,"Warning","ECU has gone silent. If this is unintentional, it may be a sign that something is wrong..."); + m_emsSilentLastTime = lasttime; } void MainWindow::emsCommsSilenceTimerTick() @@ -635,7 +636,7 @@ void MainWindow::emsCommsSilenceBroken() //This is called when ems had previously been talking, gone silent, then started talking again. ui.statusLabel->setText("Status Normal"); emsSilenceTimer->stop(); - QLOG_WARN() << "EMS HAS GONE NOISEY"; + QLOG_WARN() << "EMS HAS GONE NOISEY" << QDateTime::currentMSecsSinceEpoch() - m_emsSilentLastTime << "milliseconds of silence"; ui.statusLabel->setStyleSheet(""); } @@ -709,7 +710,7 @@ void MainWindow::setPlugin(QString plugin) connect(emsComms,SIGNAL(interrogateTaskSucceed(int)),this,SLOT(interrogateTaskSucceed(int)),Qt::QueuedConnection); connect(emsComms,SIGNAL(interrogateTaskFail(int)),this,SLOT(interrogateTaskFail(int)),Qt::QueuedConnection); connect(emsComms,SIGNAL(connected()),this,SLOT(emsCommsConnected()),Qt::QueuedConnection); - connect(emsComms,SIGNAL(emsSilenceStarted()),this,SLOT(emsCommsSilence()),Qt::QueuedConnection); + connect(emsComms,SIGNAL(emsSilenceStarted(qint64)),this,SLOT(emsCommsSilence(qint64)),Qt::QueuedConnection); connect(emsComms,SIGNAL(emsSilenceBroken()),this,SLOT(emsCommsSilenceBroken()),Qt::QueuedConnection); connect(emsComms,SIGNAL(error(QString)),this,SLOT(error(QString)),Qt::QueuedConnection); connect(emsComms,SIGNAL(error(SerialPortStatus,QString)),this,SLOT(error(SerialPortStatus,QString)),Qt::QueuedConnection); diff --git a/core/src/mainwindow.h b/core/src/mainwindow.h index 5375ab4..38dca30 100644 --- a/core/src/mainwindow.h +++ b/core/src/mainwindow.h @@ -178,13 +178,14 @@ class MainWindow : public QMainWindow QMap m_mdiSubWindowToActionMap; bool m_EcuResetPopup; QMap > m_gaugeActionMap; + qint64 m_emsSilentLastTime; private slots: void showTable(QString table); void windowHidden(QMdiSubWindow* window); void bringToFrontAndShow(); void windowDestroyed(QObject *window); void interrogationData(QMap datamap); - void emsCommsSilence(); + void emsCommsSilence(qint64 lasttime); void emsCommsSilenceBroken(); void locationIdInfo(unsigned short locationid,MemoryLocationInfo info); void tableview3d_show3DTable(unsigned short locationid,Table3DData *data); diff --git a/plugins/freeems/freeemscomms.cpp b/plugins/freeems/freeemscomms.cpp index 4166c2a..2ca344c 100644 --- a/plugins/freeems/freeemscomms.cpp +++ b/plugins/freeems/freeemscomms.cpp @@ -1640,7 +1640,7 @@ void FreeEmsComms::datalogTimerTimeout() //It's been 1.5 seconds since our last datalog. We've likely either reset, or stopped responding. m_isSilent = true; m_lastDatalogUpdateEnabled = false; - emit emsSilenceStarted(); + emit emsSilenceStarted(m_lastDatalogTime); } } Table2DData* FreeEmsComms::get2DTableData(unsigned short locationid) diff --git a/plugins/freeems/freeemscomms.h b/plugins/freeems/freeemscomms.h index 7c32786..ea8c157 100644 --- a/plugins/freeems/freeemscomms.h +++ b/plugins/freeems/freeemscomms.h @@ -197,7 +197,7 @@ class FreeEmsComms : public EmsComms void commandSuccessful(int sequencenumber); void commandFailed(int sequencenumber,unsigned short errornum); void commandTimedOut(int sequencenumber); - void emsSilenceStarted(); + void emsSilenceStarted(qint64 lastdatalogtime); void emsSilenceBroken(); void interrogateTaskStart(QString task, int sequence); void interrogateTaskSucceed(int sequence);