fix: coloring in timemodel. Fastest lap was not colored green if a not valid faster lap exists
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
// V3 STM32F07
|
// V3 STM32F07
|
||||||
|
|
||||||
#define PORT_PATH "/dev/ttyACM0"
|
#define PORT_PATH "/dev/ttyACM0"
|
||||||
|
//#define PORT_PATH "/dev/pts/4"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
// not needed anymore -> usb
|
// not needed anymore -> usb
|
||||||
|
|||||||
@@ -80,20 +80,29 @@ QColor TimeModel::getColor(const QVector<QVector<int>> data, const int col,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QVector<int> compare;
|
QVector<int> compare;
|
||||||
for (int i = 0; i <= row; i++) {
|
if (col == 3) { // lap time
|
||||||
if (data.at(i).size() > col) {
|
for (int i = 0; i <= row; i++) {
|
||||||
compare.append(data.at(i).at(col));
|
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) ==
|
if (data.at(row).at(col) ==
|
||||||
getMin(compare)) { // at least personal best time
|
getMin(compare)) { // at least personal best time
|
||||||
if (col < 3) { // sector time
|
if (col < 3) { // sector time
|
||||||
// std::cout << this->topTime.size() <<
|
if (this->topTime.size() > col) {
|
||||||
// std::endl;
|
|
||||||
if (this->topTime.size() >
|
|
||||||
col) { // absolute top time exists
|
|
||||||
// std::cout << "local besttime"
|
|
||||||
// << std::endl;
|
|
||||||
if (this->topTime.at(col) >= data.at(row).at(col)) {
|
if (this->topTime.at(col) >= data.at(row).at(col)) {
|
||||||
return QColor(Qt::magenta);
|
return QColor(Qt::magenta);
|
||||||
}
|
}
|
||||||
@@ -125,9 +134,13 @@ QColor TimeModel::getColor(const QVector<QVector<int>> data, const int col,
|
|||||||
|
|
||||||
int TimeModel::getMin(const QVector<int> x) const {
|
int TimeModel::getMin(const QVector<int> x) const {
|
||||||
int min = 9999;
|
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++) {
|
for (int i = 1; i < x.size(); i++) {
|
||||||
if (x.at(i) < min) {
|
if (x.at(i) < min) {
|
||||||
min = x.at(i);
|
min = x.at(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user