From fbea6d1bf1057c5d2014b0c7d176dd85bed081df Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Fri, 17 Nov 2017 20:24:59 +1100 Subject: [PATCH] Skip power values with sensor is offline #81 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). --- src/polar/v2/trainingsession.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/polar/v2/trainingsession.cpp b/src/polar/v2/trainingsession.cpp index f3662af1..d42bc3c5 100644 --- a/src/polar/v2/trainingsession.cpp +++ b/src/polar/v2/trainingsession.cpp @@ -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