realtime mode: during a workout, if the +/- keys are hit during a workout,

then the rider is able to control the controlller manually.

When the next Lap marker is hit, the workout continues.

Signed-off-by: Greg Lonnon <greg.lonnon@gmail.com>
This commit is contained in:
Greg Lonnon
2011-07-17 19:52:09 -06:00
parent 22a43f000d
commit 8f7670d93b
2 changed files with 34 additions and 2 deletions

View File

@@ -183,6 +183,7 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
load_msecs = total_msecs = lap_msecs = 0;
displayWorkoutDistance = displayDistance = displayPower = displayHeartRate =
displaySpeed = displayCadence = displayGradient = displayLoad = 0;
manualOverride = false;
rideFile = boost::shared_ptr<RideFile>(new RideFile(QDateTime::currentDateTime(),1));
@@ -621,6 +622,7 @@ void TrainTool::Stop(int deviceStatus) // when stop button is pressed
hrcount = 0;
spdcount = 0;
lodcount = 0;
manualOverride = false;
displayWorkoutLap = displayLap =0;
session_elapsed_msec = 0;
session_time.restart();
@@ -812,6 +814,7 @@ void TrainTool::metricsUpdate()
void TrainTool::loadUpdate()
{
int curLap;
long load;
double gradient;
// the period between loadUpdate calls is not constant, and not exactly LOADRATE,
@@ -821,7 +824,18 @@ void TrainTool::loadUpdate()
if (deviceController == NULL) return;
if (status&RT_MODE_ERGO) {
load = ergFile->wattsAt(load_msecs, displayWorkoutLap);
load = ergFile->wattsAt(load_msecs, curLap);
if(displayWorkoutLap != curLap)
{
// we are onto a new lap/interval, reset the override
manualOverride = false;
}
if(manualOverride == false)
{
displayLoad = load;
}
displayWorkoutLap = curLap;
// we got to the end!
if (load == -100) {
@@ -832,7 +846,18 @@ void TrainTool::loadUpdate()
main->notifySetNow(load_msecs);
}
} else {
gradient = ergFile->gradientAt(displayWorkoutDistance*1000, displayWorkoutLap);
gradient = ergFile->gradientAt(displayWorkoutDistance*1000, curLap);
if(displayWorkoutLap != curLap)
{
// we are onto a new lap/interval, reset the override
manualOverride = false;
}
if(manualOverride == false)
{
displayGradient = gradient;
}
displayWorkoutLap = curLap;
// we got to the end!
if (gradient == -100) {
@@ -882,6 +907,8 @@ void TrainTool::Higher()
{
if (deviceController == NULL) return;
manualOverride = true;
if (status&RT_MODE_ERGO) displayLoad += 5;
else displayGradient += 0.1;
@@ -897,6 +924,8 @@ void TrainTool::Lower()
{
if (deviceController == NULL) return;
manualOverride = true;
if (status&RT_MODE_ERGO) displayLoad -= 5;
else displayGradient -= 0.1;

View File

@@ -179,6 +179,9 @@ class TrainTool : public GcWindow
double kjoules;
double bikescore;
double xpower;
bool manualOverride; // during an erg woprkout, if the Higher/Lower
// signals are called, it switches to manual
// until the next lap/interval
// for non-zero average calcs
int pwrcount, cadcount, hrcount, spdcount, lodcount, grdcount; // for NZ average calc