mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
Fix CP curve only shows first 6 seconds bug
Many thanks to Gary Smith for helping to diagnose and fix this error. It is caused by ridefiles that have a gap in recording at the very start of the ride (i.e. the first sample is > recIntSecs). Hopefully this means the CP code is now robust. It is also worth noting that after fixing the erroneous copy/paste code in compute() it is now 5 times faster than the original code and computes 5 times more data series. Fixes #316.
This commit is contained in:
@@ -269,15 +269,13 @@ MeanMaxComputer::run()
|
||||
// timestamps on each sample
|
||||
cpintdata data;
|
||||
data.rec_int_ms = (int) round(ride->recIntSecs() * 1000.0);
|
||||
double lastsecs = -1;
|
||||
double lastsecs = 0;
|
||||
foreach (const RideFilePoint *p, ride->dataPoints()) {
|
||||
|
||||
// fill in any gaps in recording - use same dodgy rounding as before
|
||||
if (lastsecs != -1) {
|
||||
int count = (p->secs - lastsecs - ride->recIntSecs()) / ride->recIntSecs();
|
||||
for(int i=0; i<count; i++)
|
||||
data.points.append(cpintpoint(round(lastsecs+((i+1)*ride->recIntSecs() *1000.0)/1000), 0));
|
||||
}
|
||||
int count = (p->secs - lastsecs - ride->recIntSecs()) / ride->recIntSecs();
|
||||
for(int i=0; i<count; i++)
|
||||
data.points.append(cpintpoint(round(lastsecs+((i+1)*ride->recIntSecs() *1000.0)/1000), 0));
|
||||
lastsecs = p->secs;
|
||||
|
||||
double secs = round(p->secs * 1000.0) / 1000;
|
||||
|
||||
Reference in New Issue
Block a user