post merge master into release3.0.0dev

This commit is contained in:
Mark Liversedge
2011-02-26 13:58:40 +00:00
2 changed files with 20 additions and 9 deletions

View File

@@ -377,8 +377,8 @@ void RealtimeWindow::Start() // when start button is pressed
if (streamController != NULL) status |= RT_STREAMING;
trainTool->setStartText(tr("Lap/Interval"));
//recordSelector->setEnabled(false);
load_period.restart();
session_time.start();
session_elapsed_msec = 0;
lap_time.start();
@@ -445,6 +445,7 @@ void RealtimeWindow::Pause() // pause capture to recalibrate
metrics_timer->start(METRICSRATE);
if (status & RT_STREAMING) stream_timer->start(STREAMRATE);
if (status & RT_RECORDING) disk_timer->start(SAMPLERATE);
load_period.restart();
if (status & RT_WORKOUT) load_timer->start(LOADRATE);
} else {
session_elapsed_msec += session_time.elapsed();
@@ -457,6 +458,7 @@ void RealtimeWindow::Pause() // pause capture to recalibrate
if (status & RT_STREAMING) stream_timer->stop();
if (status & RT_RECORDING) disk_timer->stop();
if (status & RT_WORKOUT) load_timer->stop();
load_msecs += load_period.restart();
}
}
@@ -585,18 +587,24 @@ void RealtimeWindow::guiUpdate() // refreshes the telemetry
// Cadence, HR and Power needs to be rounded to 0 decimal places
powerLCD->display(round(displayPower));
displaySpeed *=(useMetricUnits ? 1.0 : MILES_PER_KM);
speedLCD->display(QString::number(displaySpeed,'f', 1));
double val = round(displaySpeed * (useMetricUnits ? 1.0 : MILES_PER_KM) * 10.00)/10.00;
speedLCD->display(QString::number(val, 'f', 1)); // always show 1 decimal point
cadenceLCD->display(round(displayCadence));
heartrateLCD->display(round(displayHeartRate));
lapLCD->display(displayWorkoutLap+displayLap);
// load or gradient depending on mode we are running
if (status&RT_MODE_ERGO) loadLCD->display(displayLoad);
else loadLCD->display(round(displayGradient*10)/10.00);
if (status&RT_MODE_ERGO)
loadLCD->display(displayLoad);
else
{
val = round(displayGradient*10)/10.00;
loadLCD->display(QString::number(val, 'f', 1)); // always show 1 decimal point
}
// distance
distanceLCD->display(QString::number(displayDistance*(useMetricUnits ? 1.0 : MILES_PER_KM),'f',1));
val = round(displayDistance*(useMetricUnits ? 1.0 : MILES_PER_KM) *10.00) /10.00;
distanceLCD->display(QString::number(val, 'f', 1)); // always show 1 decimal point
// NZ Averages.....
if (displayPower) { //NZAP is bogus - make it configurable!!!
@@ -630,8 +638,8 @@ void RealtimeWindow::guiUpdate() // refreshes the telemetry
}
avgpowerLCD->display((int)avgPower);
avgspeedLCD->display(QString::number(avgSpeed,'f', 1));
val = round(avgSpeed * (useMetricUnits ? 1.0 : MILES_PER_KM) * 10.00)/10.00;
avgspeedLCD->display(QString::number(val, 'f', 1)); // always show 1 decimal point
avgcadenceLCD->display((int)avgCadence);
avgheartrateLCD->display((int)avgHeartRate);
kjouleLCD->display(round(kjoules));
@@ -850,7 +858,9 @@ void RealtimeWindow::loadUpdate()
{
long load;
double gradient;
load_msecs += LOADRATE;
// the period between loadUpdate calls is not constant, and not exactly LOADRATE,
// therefore, use a QTime timer to measure the load period
load_msecs += load_period.restart();
if (deviceController == NULL) return;

View File

@@ -134,6 +134,7 @@ class RealtimeWindow : public GcWindow
long total_msecs,
lap_msecs,
load_msecs;
QTime load_period;
uint session_elapsed_msec, lap_elapsed_msec;
QTime session_time, lap_time;