Skip to content

Commit

Permalink
FreeEmsPlugin: Change so useris notified in the log how much time the…
Browse files Browse the repository at this point in the history
… ECU was silent for
  • Loading branch information
malcom2073 committed May 29, 2014
1 parent fef753d commit 00e02d4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions core/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,15 @@ 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";
ui.statusLabel->setStyleSheet("background-color: rgb(255, 0, 0);");
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()
Expand All @@ -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("<font bgcolor=\"#00FF00\">Status Normal</font>");
emsSilenceTimer->stop();
QLOG_WARN() << "EMS HAS GONE NOISEY";
QLOG_WARN() << "EMS HAS GONE NOISEY" << QDateTime::currentMSecsSinceEpoch() - m_emsSilentLastTime << "milliseconds of silence";
ui.statusLabel->setStyleSheet("");
}

Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion core/src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,14 @@ class MainWindow : public QMainWindow
QMap<QMdiSubWindow*,QAction*> m_mdiSubWindowToActionMap;
bool m_EcuResetPopup;
QMap<QString,QList<QAction*> > m_gaugeActionMap;
qint64 m_emsSilentLastTime;
private slots:
void showTable(QString table);
void windowHidden(QMdiSubWindow* window);
void bringToFrontAndShow();
void windowDestroyed(QObject *window);
void interrogationData(QMap<QString,QString> datamap);
void emsCommsSilence();
void emsCommsSilence(qint64 lasttime);
void emsCommsSilenceBroken();
void locationIdInfo(unsigned short locationid,MemoryLocationInfo info);
void tableview3d_show3DTable(unsigned short locationid,Table3DData *data);
Expand Down
2 changes: 1 addition & 1 deletion plugins/freeems/freeemscomms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugins/freeems/freeemscomms.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 00e02d4

Please sign in to comment.