From ec04f3340bf3bd7c3cd5d24311f47f26220cdf51 Mon Sep 17 00:00:00 2001 From: NeoTheFox Date: Fri, 6 Mar 2015 18:04:34 +0300 Subject: [PATCH] SD printing progress fix --- mainwindow.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 444ee33..094cf66 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -473,7 +473,7 @@ void MainWindow::readSerial() } else if(data.startsWith("Done")) sdprinting = false; else if(data.startsWith("start") && checkingTemperature) injectCommand("M105"); - else if(data.startsWith("SD printing byte") && sdWatcher.isFinished()) + else if(data.startsWith("SD printing byte")) { QFuture parseSDThread = QtConcurrent::run(this, &MainWindow::parseSDStatus, data); sdWatcher.setFuture(parseSDThread); @@ -767,18 +767,17 @@ void MainWindow::initSDprinting() double MainWindow::parseSDStatus(QByteArray data) { - /* Old parsing + // Old parsing QString tmp; QString fragment = data.split(' ').at(3); for(int i = 0; fragment.at(i) != '/'; ++i) { tmp += fragment.at(i); } - */ - - if(SDStatusRegxp.indexIn(QString(data)) != 0) - return SDStatusRegxp.cap(0).toDouble(); - else return -1; + return tmp.toDouble(); + //if(SDStatusRegxp.indexIn(QString(data)) != 0) + // return SDStatusRegxp.cap(0).toDouble(); + //else return -1; } void MainWindow::selectSDfile(QString file)