Merge pull request #1130 from Joern-R/gear1

Fix Gear Ratio SEGV - addition to Hack Fix
This commit is contained in:
Mark Liversedge
2014-11-14 19:47:27 +01:00

View File

@@ -1551,6 +1551,7 @@ AllPlot::recalc(AllPlotObject *objects)
objects->smoothWatts.resize(rideTimeSecs + 1);
objects->smoothNP.resize(rideTimeSecs + 1);
objects->smoothGear.resize(rideTimeSecs + 1);
objects->smoothRV.resize(rideTimeSecs + 1);
objects->smoothRCad.resize(rideTimeSecs + 1);
objects->smoothRGCT.resize(rideTimeSecs + 1);
@@ -1809,6 +1810,13 @@ AllPlot::recalc(AllPlotObject *objects)
}
objects->smoothDistance[secs] = totalDist;
objects->smoothTime[secs] = secs / 60.0;
// set data series (gearRatio) which are not smoothed at all
if (objects->gearArray.empty() || secs >= objects->gearArray.count()) {
objects->smoothGear[secs] = 0.0f;
} else {
objects->smoothGear[secs] = objects->gearArray[secs];
}
}
} else {
@@ -1816,6 +1824,7 @@ AllPlot::recalc(AllPlotObject *objects)
// no standard->smoothing .. just raw data
objects->smoothWatts.resize(0);
objects->smoothNP.resize(0);
objects->smoothGear.resize(0);
objects->smoothRV.resize(0);
objects->smoothRCad.resize(0);
objects->smoothRGCT.resize(0);
@@ -1907,13 +1916,6 @@ AllPlot::recalc(AllPlotObject *objects)
}
}
// and now set data series which MUST not be smoothed AT ALL (e.g. gear ratio)
objects->smoothGear.resize(rideTimeSecs + 1);
foreach (RideFilePoint *dp, rideItem->ride()->dataPoints()) {
objects->smoothGear.append(dp->gear);
}
QVector<double> &xaxis = bydist ? objects->smoothDistance : objects->smoothTime;
int startingIndex = qMin(smooth, xaxis.count());
int totalPoints = xaxis.count() - startingIndex;