Reset the lap timer based on erg file

Resets the lap timer when we get to a new lap in a training plan.
Previously it would only reset when the user pressed lap

fixes Bug #576
This commit is contained in:
Andrew Bryson
2012-01-05 18:55:14 +00:00
committed by Mark Liversedge
parent 0a2b0f6c68
commit 1b1fe43238
2 changed files with 16 additions and 3 deletions

View File

@@ -222,6 +222,7 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
connect(forward, SIGNAL(clicked()), this, SLOT(FFwd()));
connect(rewind, SIGNAL(clicked()), this, SLOT(Rewind()));
connect(lap, SIGNAL(clicked()), this, SLOT(newLap()));
connect(main, SIGNAL(newLap()), this, SLOT(resetLapTimer()));
connect(intensitySlider, SIGNAL(valueChanged(int)), this, SLOT(adjustIntensity()));
// not used but kept in case re-instated in the future
@@ -1036,13 +1037,16 @@ void TrainTool::newLap()
hrcount = 0;
spdcount = 0;
lap_time.restart();
lap_elapsed_msec = 0;
main->notifyNewLap();
}
}
void TrainTool::resetLapTimer()
{
lap_time.restart();
lap_elapsed_msec = 0;
}
// can be called from the controller
void TrainTool::nextDisplayMode()
{
@@ -1148,6 +1152,10 @@ void TrainTool::loadUpdate()
if (status&RT_MODE_ERGO) {
load = ergFile->wattsAt(load_msecs, curLap);
if(displayWorkoutLap != curLap)
{
resetLapTimer();
}
displayWorkoutLap = curLap;
// we got to the end!
@@ -1160,6 +1168,10 @@ void TrainTool::loadUpdate()
} else {
slope = ergFile->gradientAt(displayWorkoutDistance*1000, curLap);
if(displayWorkoutLap != curLap)
{
resetLapTimer();
}
displayWorkoutLap = curLap;
// we got to the end!

View File

@@ -144,6 +144,7 @@ class TrainTool : public GcWindow
void Higher(); // set load/gradient higher
void Lower(); // set load/gradient higher
void newLap(); // start new Lap!
void resetLapTimer(); //reset the lap timer
// Timed actions
void guiUpdate(); // refreshes the telemetry