Attempt to fix the progress bar issue on Companion Read Firmware function (DFU mode)

This commit is contained in:
Bertrand Songis
2020-06-13 12:46:21 +02:00
parent 0541177224
commit 5198b9a8a7
4 changed files with 17 additions and 7 deletions
+11
View File
@@ -136,6 +136,9 @@ void FlashProcess::onKillTimerElapsed()
void FlashProcess::analyseStandardOutput(const QString & text) void FlashProcess::analyseStandardOutput(const QString & text)
{ {
// qDebug() << text;
currStdoutLine.append(text); currStdoutLine.append(text);
if (currStdoutLine.contains("size = ")) { if (currStdoutLine.contains("size = ")) {
int pos = currStdoutLine.lastIndexOf("size = "); int pos = currStdoutLine.lastIndexOf("size = ");
@@ -173,6 +176,14 @@ void FlashProcess::analyseStandardOutput(const QString &text)
} }
} }
if (text.contains("Upload\t[")) {
int end = text.indexOf("%");
if (end > 0) {
int value = text.mid(end - 3, 3).toInt();
progress->setValue(value);
}
}
if (text.contains(":010000")) { if (text.contains(":010000")) {
// contains fuse info // contains fuse info
QStringList stl = text.split(":01000000"); QStringList stl = text.split(":01000000");
+1 -2
View File
@@ -253,7 +253,6 @@ void resetAvrdudeFuses(bool eepromProtect, ProgressWidget * progress)
} }
} }
bool readFirmware(const QString & filename, ProgressWidget * progress) bool readFirmware(const QString & filename, ProgressWidget * progress)
{ {
bool result = false; bool result = false;
@@ -274,7 +273,7 @@ bool readFirmware(const QString & filename, ProgressWidget * progress)
} }
} }
if (result == false) { if (!result) {
qDebug() << "readFirmware: reading" << filename << "with" << getRadioInterfaceCmd() << getReadFirmwareArgs(filename); qDebug() << "readFirmware: reading" << filename << "with" << getRadioInterfaceCmd() << getReadFirmwareArgs(filename);
FlashProcess flashProcess(getRadioInterfaceCmd(), getReadFirmwareArgs(filename), progress); FlashProcess flashProcess(getRadioInterfaceCmd(), getReadFirmwareArgs(filename), progress);
result = flashProcess.run(); result = flashProcess.run();