Commit Graph

699 Commits

Author SHA1 Message Date
Sean Rhea
2f23582d08 call computeMetrics, not htmlSummary 2009-12-10 11:11:24 -08:00
Sean Rhea
5e4dc2ce57 add RideSummaryWindow
This change allows us to connect the zonesChanged signal to the ride summary,
so that we don't have to call ride->htmlSummary as a special case whenever
we call zonesChanged.  It will also come in useful later when I introduce a
rideSelected signal.
2009-12-10 11:05:10 -08:00
Sean Rhea
f5bee4ce89 rename function 2009-12-10 10:16:58 -08:00
Sean Rhea
e7a76022bb new zonesChanged signal 2009-12-10 10:16:58 -08:00
Sean Rhea
1169ca9239 public zones in MainWindow is const 2009-12-10 10:16:58 -08:00
Sean Rhea
19c63883d0 MetricAgg gets const Zones 2009-12-10 10:16:58 -08:00
Sean Rhea
f1a28616a6 ConfigDialog gets ptr to zones, not ptr to ptr 2009-12-10 10:16:58 -08:00
Sean Rhea
a4a2ca136a CyclistPage gets const Zones ptr 2009-12-10 10:16:57 -08:00
Sean Rhea
95b44b7752 make zones ptr const 2009-12-10 10:16:57 -08:00
Sean Rhea
1096fb4125 make some functions const 2009-12-10 10:16:57 -08:00
Sean Rhea
b2ef8940a7 cp plot gets zones in its constructor 2009-12-10 10:16:57 -08:00
Sean Rhea
90ce36f984 make some functions const 2009-12-10 10:16:57 -08:00
Sean Rhea
772de9f364 RideItem::zones is just a pointer
...not a pointer to a pointer.
2009-12-10 10:16:57 -08:00
Sean Rhea
eb9eddfb66 zones ptr is never null 2009-12-10 10:16:56 -08:00
Sean Rhea
3bb50ec996 whitespace and other nonfunctional cleanup 2009-12-10 10:16:56 -08:00
Sean Rhea
21782c4e6f remove duplicate addZoneRange function
The cp argument wasn't being used, so just call the one that
doesn't take a cp argument.
2009-12-10 10:16:56 -08:00
Sean Rhea
27d55025ac nit: cleanup function 2009-12-10 10:16:56 -08:00
Sean Rhea
d2d0ac9f1c QList<ZoneRange*> --> QList<ZoneRange>
Again, get rid of deletes at the slight expense of a few cheap copies.
2009-12-10 10:16:56 -08:00
Sean Rhea
9cb955e9b3 QList<ZoneInfo*> --> QList<ZoneInfo>
Gets rid of some deletes, and shouldn't be much slower,
as QStrings are copy-on-write.
2009-12-10 10:16:56 -08:00
Sean Rhea
1c5b8e4168 remove printfs and cleanup whitespace
No functional change.  Note, however, that removing the printf from
addZoneRange(int cp) revealed that the cp argument was unused.
2009-12-10 10:16:55 -08:00
Steve Gribble
ec696a14e9 Another bug fix to handle rides that start in the middle of a course.
Computrainer 3D software lets you start your ride partway into
a course.  But, if you do this, the first distance recorded
in the log file is the distance you started at, rather than zero.
GC expects the first data point to be at distance zero, however,
and therefore this causes total distance to be reported incorrectly.

This patch fixes the bug by remembering the distance of the
first data point, and subtracting that from all distances
reported to GC, so that distances are zero-based (i.e.,
so that the first data point is always at distance zero.)
2009-12-08 08:51:55 -08:00
Sean Rhea
27ab607d1f remove gratuitous returns 2009-12-08 08:51:13 -08:00
Justin Knotzke
bff2880965 Fixed a SEGV when user clicked stop in Realtime.
Fixed a crash due to threading of the socket.
Improved performance of discovery()
Improved ability to recover from a lost channel
Fixed bug where channel ID's weren't being correctly sent.
GC wasn't waiting for Qt to return from connecting to the host. It now is.
Fixed When the user hit stop then start, the realtime thread did not start.
2009-12-08 08:45:10 -08:00
Steve Gribble
ac2a2d4f82 fix bugs and add features to Computrainer3dpFile
Specifically:

1.  The previous code assumed the wrong units while extracting
    speed and distance from a .3dp file.  Computrainer stores
    speed in (miles per hour / 160), and distance in kilometers.
    This patch converts .3dp speed/distance data points into
    kph and km correctly.  As a side-effect, speed and distance
    are displayed correctly in GC windows and calculations.

2.  This patch adds code to extract altitude data from a .3dp
    file and include it in a ride.

3.  .3dp files do not have a consistent inter-datapoint time
    interval.  Since GC expects one, the earlier version of this
    code averaged 1000 data points from the middle of the ride to
    estimate this interval.  Unfortunately, this approach caused
    a bunch of problems for various calculations that GC does,
    such as calculating the riding time (vs. workout time),
    average speed, xPower, critical power plot and FTP, and so
    on.  [GC assumes that # data points * inter-datapoint-interval
    = workout time, but this isn't true when you used an estimated
    interval.]

    To fix this, this patch adds averaging and interpolation code
    to covert the data point sequence in the .3dp file to an
    averaged sequence with a data point every 250ms.  Since the
    inter-data-point interval is now fixed, these calculation bugs
    went away, and correct values are now calculated and displayed
    by GC.

4.  Fix (3.) has another useful side-effect:  the number of data
    points per ride given to GC goes down by 10x.  (Raw .3dp files
    have a data point every 30-50ms.  This averaging/smoothing
    code emits a data point every 250ms.)  Since the critical
    power calculation is an O(n^2) calculation, the time for
    this calculation is reduced by 100x.  Instead of an hour
    to do the calculation for a typical 2hr ride, it now takes
    less than a minute.

5.  The code was cleaned up in several regards:  comments
    were added to help document the .3dp format and explain
    the averaging/smoothing code, and types from boost/cstdint.hpp
    were used instead of native C types when using a variable
    of a specific size  (e.g., the code now uses uint16_t instead
    of unsigned short, etc.).

This patch was built by Steve Gribble and Daniel Stark.
2009-12-03 20:25:33 -08:00
Sean Rhea
ea2b1909ae don't add interval 0 if it's the only one 2009-12-01 06:22:48 -05:00
Sean Rhea
06dacae358 fix compiler warning
A class with virtual functions needs a vitual destructor.
2009-12-01 05:37:51 -05:00
Sean Rhea
9e588ad413 fix unused variable warning 2009-12-01 05:37:46 -05:00
Mark Liversedge
c1704ebf97 Fixed SEGV when no devices are configured and workout mode is selected 2009-12-01 05:19:29 -05:00
Sean Rhea
7a3d154afa temporary patch to estimate dp from bs
I want to add Daniels Points to the ManualRideFile format, but until then,
simply estimate them from the BikeScore based on a weighting I took from some
of my long rides.  It's mostly on long steady rides that I estimate BikeScore
as part of a ManualRideFile, so hopefully this isn't too terrible as a
temporary patch.  A better fix is in the works.
2009-11-28 18:50:49 -05:00
Jamie Kimberley
74cbddff5b update developers guide for patch qwt
Removed qwt from the list of dependencies. Changed build instructions to
reflect the use of the patched version of qwt.
2009-11-28 18:50:47 -05:00
Mark Liversedge
d83ba74ae3 Fix Stress.Cache refresh on wrong tab 2009-11-28 11:51:11 -05:00
Sean Rhea
828562ec3d bug fix: xPower shouldn't count coffee breaks
Commit 420b2b6 introduced a bug whereby it used the total workout time,
rather than the time riding, to compute xPower.  This should only affect
your data if you take long breaks during rides, like to stop for brunch,
or if you store multiple rides in the same ride file--i.e., you don't
use the split ride feature.  Nonetheless, it's worth deleting your
stress.cache file after applying this commit, just in case.

I've also added three rides, notes, and a zones file to the test directory to
illustrate the differences discussed above.  The first ride is just an hour at
CP/FTP.  It should have a BikeScore of very close to 100, and Daniels Points
very close to 33.  The next ride is the same as the first, but followed by 20
minutes of coasting.  Its Daniels Points should be the same as the former,
but its BikeScore should be a good bit higher.  The final ride is the same as
the first, but interrupted partway through by 30 minutes of no riding at all,
as though the cyclist stopped for coffee and a pastry.  It should have
nearly identical BikeScore and Daniels Points to the first ride.  In the
broken implementation of xPower that this commit fixes, it did not.

Dan C: I reverted your changes to the xPower calculation in this commit and
went back to my implementation.  It's just easier for me to think about the
code that way.  My apologies.  I kept the other changes you made, though.
2009-11-28 11:42:34 -05:00
Sean Rhea
39ef9efc4d bug fix: don't compute Daniels Points if no CP set 2009-11-27 22:55:41 -05:00
Sean Rhea
3429f2d5a4 add DanielsPoints metric
Fit a curve to the points system in Table 2.2 of "Daniel's Running Formula",
Second Edition, assume that power at VO2Max is 1.2 * FTP, further assume that
pace is proportional to power (which is not too far off in running), and scale
so that one hour at FTP is worth 33 points (which is the arbirary value
Daniels chose).
2009-11-27 18:23:52 -05:00
Mark Liversedge
d4f8ce5b07 Remove Notes Tab and place notes on Summary Tab
Adding splitter for the ride summary/notes layout
2009-11-27 18:19:18 -05:00
Sean Rhea
7324ebda06 fix season selector in cp plot 2009-11-27 16:46:09 -05:00
Sean Rhea
411abf55b8 stop PM chart at max(today, latest ride)
I've been using the manual ride feature to plan my weeks in advance, so it's
helpful to have the x-axis on the PM chart extend past today's date.
2009-11-27 16:46:09 -05:00
Mark Liversedge
82ac0f5e1f add realtime mode
Joint work between Mark L, Justin, and Steve Gribble.
2009-11-23 10:42:48 -05:00
Mark Liversedge
e3426c1024 win32 and linux build fixes
- change SeasonParser include from <> to "" for Windows
- include stdio.h in PowerTapUtil for Linux
2009-11-21 17:21:47 -05:00
Sean Rhea
6394483df4 link to msg about building on windows 2009-11-21 15:27:41 -05:00
Sean Rhea
e7b762333d ugly fix for zones file without a BEGIN
Just attribute all earlier rides to the first zone.  We should do better in
the future, maybe by complaining to the user in a dialog, but for now,
not crashing definitely seems better than crashing.
2009-11-21 15:23:04 -05:00
Sean Rhea
51aafe7ede rest during intervals counts against averages
This seems like the right call to me.  If I'm doing an interval and I stop
riding for some reason, I'm resting, and that should affect my average power.
I thought it was always this way, but apparently not.
2009-11-21 14:34:49 -05:00
Jamie Kimberley
182843896d test file with two intervals in first 10 secs
Good for testing what happens in the Ride Plot when there are interval
markers within the first smoothing period.
2009-11-21 14:33:36 -05:00
Sean Rhea
6914185680 don't plot intervals before first smoothing window 2009-11-21 14:27:13 -05:00
Sean Rhea
ab28d32b65 rename ergomo csv files 2009-11-21 14:03:43 -05:00
Sean Rhea
5c3896b6cc fix intervals for ergomo csv 2009-11-21 14:02:37 -05:00
Sean Rhea
25e8658592 fail gracefully if rec_int changes mid-ride
Includes test ride that demonstrates the problem.
2009-11-21 13:48:23 -05:00
Sean Rhea
6d33d10944 inject a little philosophy onto the front page 2009-11-15 20:03:14 -08:00
Sean Rhea
02cf0ac83d need <algorithm> for std::lower_bound in Linux
Thanks to Mark Liversedge for pointing this out.
2009-11-15 19:53:18 -08:00
Sean Rhea
93d62cc5c2 fix Ride Plot shading bug introduced in 79ced76
The default position of the power combo box in the Ride Plot is to shade
power.  Change the default value of the shade_power variable to match.  This
didn't matter before 79ced76, since prior to that commit we (mostly
redundantly) called showPower from setAllPlotWidgets, whereas now we only call
showPower after a change in the combo box.
2009-11-15 08:52:23 -08:00