Skip to content

Commit

Permalink
Interrogate Progress View progress bars now properly reflect 0-100% p…
Browse files Browse the repository at this point in the history
…rogress
  • Loading branch information
malcom2073 committed Oct 13, 2013
1 parent f7d941b commit b09528f
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 18 deletions.
14 changes: 7 additions & 7 deletions core/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1720,17 +1720,17 @@ void MainWindow::interrogationComplete()
void MainWindow::interrogateTaskStart(QString task, int sequence)
{
if(task.contains("Location ID"))
{
progressView->addTask(task,sequence,0);
}
else if (task.contains("Ram Location"))
{
progressView->addTask(task,sequence,1);
}
else if (task.contains("Flash Location"))
else if (task.contains("Ram Location") || task.contains("Flash Location"))
{
progressView->addTask(task,sequence,2);
}
else if (task.contains("Ecu Info"))
{
progressView->addTask(task,sequence,0);
}
}

void MainWindow::interrogateTaskSucceed(int sequence)
Expand Down Expand Up @@ -1840,7 +1840,7 @@ void MainWindow::commandSuccessful(int sequencenumber)
QLOG_INFO() << "Command succesful:" << QString::number(sequencenumber);
if (m_interrogationInProgress)
{
if (progressView) progressView->taskSucceed(sequencenumber);
//if (progressView) progressView->taskSucceed(sequencenumber);
}

}
Expand Down Expand Up @@ -1989,7 +1989,7 @@ void MainWindow::commandFailed(int sequencenumber,unsigned short errornum)
}
else
{
if (progressView) progressView->taskFail(sequencenumber);
//if (progressView) progressView->taskFail(sequencenumber);
}
}

Expand Down
55 changes: 45 additions & 10 deletions plugins/freeems/freeemscomms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,13 @@ void FreeEmsComms::startInterrogation()
{
if (!m_interrogateInProgress)
{
RequestClass req;
req.type = INTERROGATE_START;
m_reqListMutex.lock();
m_reqList.append(req);
m_reqListMutex.unlock();
m_interrogatePacketList.clear();
m_interrogateInProgress = true;
m_interrogatePacketList.append(getFirmwareVersion());
m_interrogatePacketList.append(getInterfaceVersion());
m_interrogatePacketList.append(getCompilerVersion());
m_interrogatePacketList.append(getDecoderName());
m_interrogatePacketList.append(getFirmwareBuildDate());
m_interrogatePacketList.append(getMaxPacketSize());
m_interrogatePacketList.append(getOperatingSystem());
m_interrogatePacketList.append(getLocationIdList(0x00,0x00));
m_interrogateTotalCount=8;
}
}

Expand Down Expand Up @@ -889,6 +885,45 @@ void FreeEmsComms::run()
serialconnected = false;
emit disconnected();
}
else if (m_threadReqList[i].type == INTERROGATE_START)
{
int seq = getFirmwareVersion();
emit interrogateTaskStart("Ecu Info FW Version",seq);
m_interrogatePacketList.append(seq);

seq = getInterfaceVersion();
emit interrogateTaskStart("Ecu Info Interface Version",seq);
m_interrogatePacketList.append(seq);

seq = getCompilerVersion();
emit interrogateTaskStart("Ecu Info Compiler Version",seq);
m_interrogatePacketList.append(seq);

seq = getDecoderName();
emit interrogateTaskStart("Ecu Info Decoder Name",seq);
m_interrogatePacketList.append(seq);

seq = getFirmwareBuildDate();
emit interrogateTaskStart("Ecu Info Firmware Build Date",seq);
m_interrogatePacketList.append(seq);

seq = getMaxPacketSize();
emit interrogateTaskStart("Ecu Info Max Packet Size",seq);
m_interrogatePacketList.append(seq);

seq = getOperatingSystem();
emit interrogateTaskStart("Ecu Info Operating System",seq);
m_interrogatePacketList.append(seq);

seq = getLocationIdList(0x00,0x00);
emit interrogateTaskStart("Ecu Info Location ID List",seq);
m_interrogatePacketList.append(seq);

m_interrogateTotalCount=8;
m_threadReqList.removeAt(i);
i--;
continue;
}
else if (m_threadReqList[i].type == GET_LOCATION_ID_LIST)
{
m_waitingInfoMutex.lock();
Expand Down Expand Up @@ -1607,7 +1642,7 @@ void FreeEmsComms::parsePacket(Packet parsedPacket)
{
int task = retrieveBlockFromFlash(flashlist[i],0,0);
m_interrogatePacketList.append(task);
emit interrogateTaskStart("flash Location: 0x" + QString::number(flashlist[i],16),task);
emit interrogateTaskStart("Flash Location: 0x" + QString::number(flashlist[i],16),task);
}
emit interrogationProgress(m_interrogateTotalCount - m_interrogatePacketList.size(),m_interrogateTotalCount);
}
Expand Down
3 changes: 2 additions & 1 deletion plugins/freeems/freeemscomms.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ class FreeEmsComms : public EmsComms
GET_OPERATING_SYSTEM=0xEEF4,
GET_LOCATION_ID_INFO=0xF8E0,
SERIAL_CONNECT=0xFFFF01,
SERIAL_DISCONNECT=0xFFFF02
SERIAL_DISCONNECT=0xFFFF02,
INTERROGATE_START=0xFFFF03
};

class Packet
Expand Down

0 comments on commit b09528f

Please sign in to comment.