From 48db19213b040406999bca11fdc734e61fee257d Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Fri, 29 Jan 2016 15:56:19 -0500 Subject: [PATCH] Fix potential crash bug in serial worker, add ability to define ECU scanning range in UDS scanner --- serialworker.cpp | 1 + udsscanwindow.cpp | 5 ++++- udsscanwindow.ui | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/serialworker.cpp b/serialworker.cpp index d6f212b..8b0786e 100644 --- a/serialworker.cpp +++ b/serialworker.cpp @@ -435,6 +435,7 @@ void SerialWorker::handleTick() { if (!gotValidated) { + if (serial == NULL) return; if (serial->isOpen()) //if it's still false we have a problem... { qDebug() << "Comm validation failed. "; diff --git a/udsscanwindow.cpp b/udsscanwindow.cpp index 3ac94e6..37c9d07 100644 --- a/udsscanwindow.cpp +++ b/udsscanwindow.cpp @@ -36,13 +36,16 @@ void UDSScanWindow::scanUDS() sendingFrames.clear(); CANFrame frame; + int startID, endID; + startID = Utility::ParseStringToNum(ui->txtStartID->text()); + endID = Utility::ParseStringToNum(ui->txtEndID->text()); int buses = ui->cbBuses->currentIndex(); buses++; if (buses < 1) buses = 1; for (int typ = 1; typ < 5; typ++) { - for (int id = 0x7E0; id < 0x7E8; id++) + for (int id = startID; id < endID; id++) { frame.ID = id; frame.len = 8; diff --git a/udsscanwindow.ui b/udsscanwindow.ui index 73bd3d0..14aff43 100644 --- a/udsscanwindow.ui +++ b/udsscanwindow.ui @@ -24,6 +24,46 @@ + + + + + + + + Starting ID + + + + + + + 0x7E0 + + + + + + + + + + + Ending ID + + + + + + + 0x7E7 + + + + + + +