Fix W' calculator for bad data

Fix 1s smoothing to ensure time doesn't go backwards
as when the same timestamp is used more than once the
QwtSpline used to interpolate returns all zeroes.
This commit is contained in:
Mark Liversedge
2013-11-01 16:47:15 +00:00
parent 39e22e0dc6
commit c1791b3438

View File

@@ -71,9 +71,16 @@ WPrime::setRide(RideFile *input)
// create a raw time series in the format QwtSpline wants
QVector<QPointF> points;
int last=0;
RideFilePoint *lp=NULL;
foreach(RideFilePoint *p, input->dataPoints()) {
points << QPointF(p->secs, p->watts);
// lets not go backwards -- or two sampls at the same time
if ((lp && p->secs > lp->secs) || !lp)
points << QPointF(p->secs, p->watts);
// update state
last = p->secs;
lp = p;
}
// Create a spline