From babbaa7e2cf7b138b3c4876f19a52444ffdaa162 Mon Sep 17 00:00:00 2001 From: "Sean C. Rhea" Date: Sun, 18 May 2008 14:19:37 +0000 Subject: [PATCH] Sane failure for rides longer than a week, which usually happen because someone sets the date on their PT and doesn't reset the device before going for a ride. This fix will keep GC working until the user splits the ride (and until we add a ride-splitting function). --- src/AllPlot.cpp | 8 ++++++++ src/CpintPlot.cpp | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/AllPlot.cpp b/src/AllPlot.cpp index ef2806d9f..4444c12e6 100644 --- a/src/AllPlot.cpp +++ b/src/AllPlot.cpp @@ -82,6 +82,14 @@ AllPlot::recalc() if (!timeArray) return; int rideTimeSecs = (int) ceil(timeArray[arrayLength - 1]); + if (rideTimeSecs > 7*24*60*60) { + QwtArray data; + wattsCurve->setData(data, data); + hrCurve->setData(data, data); + speedCurve->setData(data, data); + cadCurve->setData(data, data); + return; + } double totalWatts = 0.0; double totalHr = 0.0; double totalSpeed = 0.0; diff --git a/src/CpintPlot.cpp b/src/CpintPlot.cpp index b60c4d901..f91ea3688 100644 --- a/src/CpintPlot.cpp +++ b/src/CpintPlot.cpp @@ -118,6 +118,10 @@ update_cpi_file(const cpi_file_info *info, QProgressDialog *progress, assert(out); int total_secs = (int) ceil(data.points.back().secs); + if (total_secs > 7*24*60*60) { + fclose(out); + return; + } double *bests = (double*) calloc(total_secs + 1, sizeof(double)); bool canceled = false;