Skip to content

Commit

Permalink
Skip power values with sensor is offline #81
Browse files Browse the repository at this point in the history
This doesn't actually make any difference to any of the current test
data, but is a sensible thing to do anyway (and may be relevant to
more extensive activity sessions).
  • Loading branch information
pcolby committed Nov 17, 2017
1 parent 12abe57 commit fbea6d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/polar/v2/trainingsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2169,9 +2169,13 @@ QStringList TrainingSession::toHRM(const bool rrDataOnly) const
? qRound(altitude.at(index).toFloat()) : (int)0);
}
if (havePower) {
const int currentPowerLeft = (index < powerLeft.length()) ?
const int currentPowerLeft =
((index < powerLeft.length()) &&
(!sensorOffline(samples.value(QLatin1String("left-pedal-power-offline")).toList(), index))) ?
first(powerLeft.at(index).toMap().value(QLatin1String("current-power"))).toInt() : 0;
const int currentPowerRight = (index < powerRight.length()) ?
const int currentPowerRight =
((index < powerRight.length()) &&
(!sensorOffline(samples.value(QLatin1String("right-pedal-power-offline")).toList(), index))) ?
first(powerRight.at(index).toMap().value(QLatin1String("current-power"))).toInt() : 0;
const int currentPower = (havePowerLeft && havePowerRight)
? currentPowerLeft + currentPowerRight
Expand Down

0 comments on commit fbea6d1

Please sign in to comment.