diff --git a/hardwaresetup.cpp b/hardwaresetup.cpp index aa933f1..60d2f5e 100644 --- a/hardwaresetup.cpp +++ b/hardwaresetup.cpp @@ -26,6 +26,7 @@ // V3 STM32F07 #define PORT_PATH "/dev/ttyACM0" +//#define PORT_PATH "/dev/pts/4" using namespace std; // not needed anymore -> usb diff --git a/timemodel.cpp b/timemodel.cpp index fe07f0f..f2a2ee6 100644 --- a/timemodel.cpp +++ b/timemodel.cpp @@ -80,20 +80,29 @@ QColor TimeModel::getColor(const QVector> data, const int col, } QVector compare; - for (int i = 0; i <= row; i++) { - if (data.at(i).size() > col) { - compare.append(data.at(i).at(col)); + if (col == 3) { // lap time + for (int i = 0; i <= row; i++) { + if (data.at(i).size() > col && + data.at(i).at(col) > this->minimumTimes.at(col) && + data.at(i).at(0) > this->minimumTimes.at(0) && + data.at(i).at(1) > this->minimumTimes.at(1) && + data.at(i).at(2) > this->minimumTimes.at(2)) { + compare.append(data.at(i).at(col)); + } + } + } + else { + for (int i = 0; i <= row; i++) { + if (data.at(i).size() > col && + data.at(i).at(col) > this->minimumTimes.at(col)) { + compare.append(data.at(i).at(col)); + } } } if (data.at(row).at(col) == getMin(compare)) { // at least personal best time if (col < 3) { // sector time - // std::cout << this->topTime.size() << - // std::endl; - if (this->topTime.size() > - col) { // absolute top time exists - // std::cout << "local besttime" - // << std::endl; + if (this->topTime.size() > col) { if (this->topTime.at(col) >= data.at(row).at(col)) { return QColor(Qt::magenta); } @@ -125,9 +134,13 @@ QColor TimeModel::getColor(const QVector> data, const int col, int TimeModel::getMin(const QVector x) const { int min = 9999; - if (x.size() > 0) { - min = x.at(0); + + // find first matching minimum + for (auto i : x) { + min = i; + break; } + for (int i = 1; i < x.size(); i++) { if (x.at(i) < min) { min = x.at(i);