added lap timer in traing- and racemode

This commit is contained in:
2018-12-27 20:50:30 +01:00
parent 954ed988ab
commit 7d98499fc8
5 changed files with 373 additions and 104 deletions

View File

@@ -36,7 +36,6 @@ Training::Training(QWidget * parent, DataBase * db)
firstTimeDea = true;
firstTimeShell = true;
started = true;
paused = false;
this->Hardware = new HardwareSetup;
@@ -87,6 +86,7 @@ Training::Training(QWidget * parent, DataBase * db)
}
}
void Training::ResetShell() {
this->VecShell.clear();
// this->ui->lWShellTime->clear();
@@ -101,6 +101,7 @@ void Training::ResetShell() {
this->ui->lStraightShellTop->setText("");
this->ui->lCurvesShellTop->setText("");
this->ui->lDeltaTopTimeShell->setText("");
this->ui->lShellLaps->setText("0");
}
void Training::ResetDea() {
this->VecDea.clear();
@@ -119,6 +120,7 @@ void Training::ResetDea() {
this->ui->lStraightDeaTop->setText("");
this->ui->lCurvesDeaTop->setText("");
this->ui->lDeltaTopTimeDea->setText("");
this->ui->lDeaLaps->setText("0");
}
void Training::Reset() {
this->ResetDea();
@@ -234,6 +236,15 @@ void Training::shellSlot(int time, int sector) {
QVectorHelper::getMin(VecShell) - theoreticalMinShell;
this->ui->lDeltaTopTimeShell->setText(
QString::number(static_cast<double>(deltaShell) / 1000));
// count valid laps
int validLaps = 0;
for (auto vec : VecShell) {
if (vec.size() == 3) {
validLaps += 1;
}
}
this->ui->lShellLaps->setText(QString::number(validLaps));
break;
}
ui->lWShellTime->scrollToBottom();
@@ -331,6 +342,13 @@ void Training::deaSlot(int time, int sector) {
this->ui->lDeltaTopTimeDea->setText(
QString::number(static_cast<double>(deltaDea) / 1000));
}
int validLaps = 0;
for (auto vec : VecDea) {
if (vec.size() == 3) {
validLaps += 1;
}
}
this->ui->lDeaLaps->setText(QString::number(validLaps));
break;
}
ui->lWDeaTime->scrollToBottom();