Commit Graph

1155 Commits

Author SHA1 Message Date
Mark Liversedge
f686f2f262 Ride Statistics performance improvements
The metric code for calculating NP was sub-optimal (actually
it was pretty crap). This patch improves the performance of
the calculation quite substantially (>50% improved).

Additionally, the critical durations code has been adjusted
to reduce the amount of work for long rides (>3hrs or more).
2011-05-02 10:33:58 +01:00
Mark Liversedge
77358fd3a3 Tooltip in CP chart
A tooltip is now shown on the CP chart if you move
the cursor over a point in the chart. The old picker
ribbon is still shown when using left-click with
the dates and values shown in the controls.
2011-04-29 14:14:20 +01:00
Mark Liversedge
498a7e3ec4 Add xPower and Normalized Power to Critical Plot
The Skiba and Coggan metrics for xPower and NP
respectively can now be plotted on the CP curve.

There are two issues;
* Downsampling of data to 5s samples skews xPower's EWMA
* Setting scale to start at 30mins breaks the x-axis scale engine

Both issues need fixing, since the first skews xPower upwards and
the second suggests that xPower/NP are meaningful for durations
less than 30 minutes.

Fixes #307.
2011-04-28 23:51:55 +01:00
Mark Liversedge
aec11f8c66 Fix typo to get cadence CP chart back. 2011-04-27 21:29:23 +01:00
Mark Liversedge
f57ac7d2b1 Fix CP calculation for files with sub-recIntSecs samples
Peak 1s - 5s critical heartrate was way off the charts and did
not represent the data within the ride file.

Almost certainly caused by the WKO+ file importer, or possibly
by the WKO+ files themselves. It is possible to have ride files
with samples that are shorter than recIntSecs, e.g. where the
recording sample rate is 1s you might see:

Time       HR
01:21:32.0 157
01:21:32.7 157
01:21:33.0 157

In this case there are two samples between 1:21:32 and 1:21:33 rather
than the expected one sample. The code to compute averages used the
duration and recIntSecs to determine the average. This patch now
maintains a count instead.

Fixes #319
2011-04-27 20:48:39 +01:00
Mark Liversedge
64d44cdd0f 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.
2011-04-26 21:56:05 +01:00
Mark Liversedge
e8d213c444 Temporary Fix for Ride Selection after NULL ride selected
When you clicked on 'All Rides' mainwindow emits a rideSelected
signal with a ridefile of NULL. When then selecting a valid ride
a SEGV occurred.

This temporary fix removes that signal, but the underlying issue
related to actions after a NULL ride is selected need to be resolved.

Fixes #318.
2011-04-26 21:31:43 +01:00
Mark Liversedge
2ad6c3d252 Remove dumb cut/paste error that increased CP calc work. 2011-04-26 21:02:23 +01:00
Mark Liversedge
7dd47e5197 Fill in Gaps in recording when computing CP charts
The new implementation of CP calculation uses a different
approach to identifying critical power/cadence etc which
makes it sensitive to gaps in recording (it assumes all
samples are temporally contiguous).

This patch ensures the data series are pre-processed to
add 0 values for any gaps in recording -- it does NOT
try to smooth data, since there are tools available to
do this, and if the data as presented has gaps we will
not attempt to 'correct' them -- the user can do this
themselves.

It leaves ride data intact.
2011-04-26 20:28:57 +01:00
Mark Liversedge
f7416fe0fd merge srhea/GoldenCheetah.git release_3.0.0dev fixups. 2011-04-25 17:43:08 +01:00
Mark Liversedge
659d35406c Fix CP calculation crash
Fixes SEGV in RideFileCache caused by incorrect recIntSecs setting
for a ridefile. Other reported issues with high power values for
short intervals was data related and not a bug.

Fixes #314.
2011-04-25 16:44:16 +01:00
Mark Liversedge
3a5c7822cc Missed from previous commit. 2011-04-25 02:58:19 +01:00
Mark Liversedge
0df8b73743 Plot more data on the CP plot and use a binary cache file
This patch enables more data series to be plotted on a CP plot.
We can now show curves for heartrate, cadence, speed and torque
as well as the original power and energy.

The CP code is refactored into the plotting functions and a new
RideFileCache that precomputes the mean-max as well as distribution
data (for a later patch to show histograms across date ranges).

The code for computing mean-max values has been re-written and
significantly optimised by;
* computing 1s intervals up to 5mins only
* computing 20s intervals for the remainder of the ride
* downsampling data to 5s samples for longer durations
* using a binary file format (cpx) for faster read/aggregation
* using multiple threads

Testing on an old Athlon dual-core showed an increase in performance
over the old cpi code of approximately x20, but since new data series
are now computed it is only x4 faster. Quad/Octo core systems will
show a greater performance increase though.

Fixes #312.
Fixes #285.
2011-04-25 02:46:53 +01:00
Mark Liversedge
41eaaa866b Plot more data on the CP plot and use a binary cache file
This patch enables more data series to be plotted on a CP plot.
We can now show curves for heartrate, cadence, speed and torque
as well as the original power and energy.

The CP code is refactored into the plotting functions and a new
RideFileCache that precomputes the mean-max as well as distribution
data (for a later patch to show histograms across date ranges).

The code for computing mean-max values has been re-written and
significantly optimised by;
* computing 1s intervals up to 5mins only
* computing 20s intervals for the remainder of the ride
* downsampling data to 5s samples for longer durations
* using a binary file format (cpx) for faster read/aggregation
* using multiple threads

Testing on an old Athlon dual-core showed an increase in performance
over the old cpi code of approximately x20, but since new data series
are now computed it is only x4 faster. Quad/Octo core systems will
show a greater performance increase though.
2011-04-25 02:20:19 +01:00
Mark Liversedge
cc5c3115bd No more CPU hog in Native ANT. 2011-04-18 23:01:19 +01:00
Mark Liversedge
ec3c7a2b5a Less jarring use of pixmaps in look and feel. 2011-04-18 22:48:49 +01:00
Mark Liversedge
15741d6017 Merge branch 'release_3.0.0dev' of github.com:/srhea/GoldenCheetah into release_3.0.0dev 2011-04-17 22:09:27 +01:00
Mark Liversedge
7a63d1f5dc More NULL ride bug fixes
The controls for the RideEditor (find) and AllPlotWindow
still try and do their thing when the current ride item
is NULL. This was either because it wasn't checked (or
expected) or the widgets in question were not notified. This
patch fixes this.

When I get a chance the whole codebase needs to be refactored
to gracefully handle NULL rideItems -- each plot/window should
clear state when it is notified that NO ride is selected.
2011-04-17 21:39:16 +01:00
Mark Liversedge
97053386d8 Fix RideEditor crash on last delete
If you delete the last ride and scroll down in the ride editor
GC will crash. This patch ensures the model is invalidated when
a ride is deleted.
2011-04-17 19:47:36 +01:00
Mark Liversedge
888ec7a6d9 Fix Crash on Interval selection when last ride deleted
If you delete the last ride and then select an interval in the
interval widget Interval summary window crashes. This patch fixes
this. It should have been picked up in the Null ride files tests
from last week, but slipped through.
2011-04-17 18:59:30 +01:00
Josef Gebel
d7d89e63e5 Fix AllPlot Show by Distance Bug
I discovered a crash of GC when doing the following:
* Load two rides (you can load the same ride for 2 different days)
* Go to the Ride Plot tab
* At the bottom, choose "x-Axis shows distance"
* Switch rides in the "All Rides" widget
* GoldenCheetah should crash. At least, it does for me when I load the attached ride file.

Fixes #242
2011-04-17 18:32:16 +01:00
Mark Liversedge
4660a368ca Fix Crash in Histogram for show in Zones before Zones configured
Fix an assert crash in Zones if you choose to chart power by zone before the cyclist CP
configuration has been set.

Fixes #300.
2011-04-17 14:31:50 +01:00
Mark Liversedge
1a12f8979f Fix Workout Code null string for Bin (Joule) ride files. 2011-04-16 20:44:15 +01:00
Mark Liversedge
21afde2d0b Realtime checkpoint - WIN32 and Configurable Realtime
Fixups to compile video on WIN32 and added more configurability
in the realtime screens, but still not the chart and video use-case
needs to be decided.
2011-04-10 18:03:21 +01:00
Mark Liversedge
26402f0c36 Merge branch 'release_3.0.0dev' of github.com:/srhea/GoldenCheetah into release_3.0.0dev 2011-04-09 14:31:55 +01:00
Mark Liversedge
62852f74be Reintroduce Heartrate Zone Summary on WeeklySummary Window
The refactoring of the weekly summary window to use metricDB
and the introduction of HR zone config in options removed
the hr time in zone table on weekly summary.

This patch re-introduces it.
2011-04-09 14:30:30 +01:00
Mark Liversedge
50863cbf96 Merge branch 'release_3.0.0dev' of github.com:/srhea/GoldenCheetah into release_3.0.0dev 2011-04-09 14:12:02 +01:00
Mark Liversedge
8698aaa76b Reintroduce Heartrate Zone Summary on RideSummary Window
The refactoring of the summary window to use metricDB and the
introduction of HR zone config in options removed (temporarily)
the table on ride summary.

This patch re-introduces it.
2011-04-09 14:08:28 +01:00
Mark Liversedge
14236416a0 Merge branch 'release_3.0.0dev' of github.com:/srhea/GoldenCheetah into release_3.0.0dev 2011-04-09 12:21:27 +01:00
Mark Liversedge
08110333c7 Fix Crash on show/hide sidebar in V3
GoogleMapControl crashes when the sidebar is hidden then shown
before a map has been drawn. This is because the resize event
attempts to redraw the map before all private data has been
initialised (in this case rideData is empty).
2011-04-09 12:15:17 +01:00
Mark Liversedge
ea02242558 Merge branch 'release_3.0.0dev' of github.com:/srhea/GoldenCheetah into release_3.0.0dev 2011-04-09 11:42:55 +01:00
Mark Liversedge
6af6b347bf Version 3 - No Ridefiles Bugs Bonanza
When no ridefiles are available (new cyclist) or the last ridefile
is deleted the current ride will be null. In addition the ride
importer deletes the memory for a ride imported to ensure VM is not
exhausted on large imports.

This patch fixes a whole host of null errors across the codebase. They
were identified by creating a new cyclist, executing every menu option
and tab/chart and then importing a file choosing everything and then
deleting the file and choosing every option again.

This negative testing should be performed before every stable release since
it has identified at least 6 bugs which are almost certainly present in the
current V2 code.
2011-04-09 11:24:40 +01:00
Mark Liversedge
53a8167787 Fix Weekly Summary Crash
Refactoring of WeeklySummary to use the metricDB (speed optimisation)
introduced a bug where the ridefile iterator was erroneously used
whilst computing daily averages. This patch fixes this by using the
daily iterator instead.

Many thanks to John Ehrlinger for identifying, reporting and helping
to diagnose this defect.
2011-04-09 08:20:06 +01:00
Mark Liversedge
0d307e0c5b HomeWindow takes a name to load/save layout. 2011-04-06 21:14:36 +01:00
Mark Liversedge
2d30be9811 Fix video on startup. 2011-04-06 21:00:23 +01:00
Mark Liversedge
714ab730b3 Training Mode Improvements - Part 1 of 3
Update to training mode to improve the UI and overall
user experience. This initial patch introduces:

* Video Window - but ghetto and not fully functional
* Congigurable - drag and drop 'dials' onto homewindow

In future updates we need to:
* Support Video fully - Only Linux in this patch
* HomeWindow - Make Training mode the same as HomeWindow
* More Dials - Support metrics (e.g. BikeScore)
* RT Charts - Make RT plot drag/drop and support other
              types of charts (e.g. Time In Zone)
* Controls - Add more controls for FFWD/REW, Skip etc

This patch has been tested on Linux ONLY. It is being committed
to support further build/deployment work for Win32 and Mac OSX.
2011-04-03 18:30:35 +01:00
Darren Hague
010e27e50c Fix CycleOps Fluid 2 virtual power calculation
Fixes #239
There was a missing "break" after the CycleOps calc, so it went ahead
and overwrote the value with the BT-ATS calc. "break" now inserted.
2011-03-27 18:34:08 +01:00
Darren Hague
847340e098 Improve stability when libusb0.dll is not present 2011-03-24 07:26:35 +00:00
Darren Hague
7efa27d5b3 Dynamic load of libusb0.dll
This means that libusb0.dll does not have to be included in the
Golden Cheetah distribution - the code will load it automatically
from windows\system32 on demand when realtime mode is invoked in
Native ANT+ mode. Insertion of a USB2 ANT+ stick will cause Windows
to download and install libusb0 automatically.
2011-03-22 07:12:29 +00:00
Mark Liversedge
1c7a8b5e83 Fix SEGV in WorkoutWizard when no ride selected. 2011-03-19 22:54:55 +00:00
Mark Liversedge
1a01b789db USBXpress SDK fixup missed USBXpress.cpp on last commit. 2011-03-19 22:11:43 +00:00
Mark Liversedge
40855b8773 Fixup USBXpress.h when SDK is not installed. 2011-03-19 22:01:36 +00:00
Darren Hague
f8d60bfbe2 Native ANT+ part 2 - USB2 Support and minor improvements
This patch adds support for the Garmin USB2 stick using
libusb-win library. Instructions are included in gcconfig.pri.in
for configuring and installing the neccessary libs.

To enable support for USB1 and USB2 support in the same binary
stubs are created when UsbXpress/Libusb are not available and the
device i/o attempts to use USB2 before falling back to USB1.

Since I was also in the middle of some coding changes I merged
my developments (Mark) with Darren's patch whilst fixing it up
for commit, namely:

1. the configuration screen no longer demands a COMx port
   when using Native ANT+ on Windows.
2.  new signals in ANTChannel notify the ANT class when info is
   stale or lost (but they are not used at present).
3. The previous debug messages have been removed, although new
   debug messages are added for stale/drop/timeout signals.
2011-03-19 21:03:43 +00:00
Mark Liversedge
22d04f8524 Native ANT+ Part 2 - antlog.bin dignostics
A patch to create an 'antlog.bin' in the current working
directory when working with ANT+ devices. This is to enable
users to test the ANT+ support and share the received messages
to diagnose issues related to parsing messages and displaying
telemetry.

This 'antlog.bin' will ultimately become a native ant file format
and have an associated extension (.ant) and a ridefile reader.
For now it just writes a stream of fixed length messages (12 bytes)
of all received messages.
2011-03-14 21:57:35 +00:00
Mark Liversedge
35b4ea81c1 QMAKE_DEL should have been QMAKE_DEL_FILE in previous commit. 2011-03-10 20:08:00 +00:00
Mark Liversedge
6df1ca1865 Fix Flex/Bison issues on Win32
Added the QMAKE_DEL setting to gcconfig.pri.in to signpost
setting to rm -f on Win32.
2011-03-10 20:00:08 +00:00
Mark Liversedge
3cfbfd446a Native ANT+ Part 2 - Improved Power Support
Fix SRM power decoding to stop requiring a new message
pair whenever a zero change occurs - this was erroneous
and severely limited the update rate. Power and Cadence
updates for SRM are now immediate.

Desk check of support for Standard Power messages showed
that the code was interfering with normal cranktorque or
wheeltorque power calculations. This did not show up with
SRM cranks since they do not send standard power messages.

This should help to resolve issues with erratic/incorrect
power readings from Powertaps. I am not sure if Quarq cranks
send standard power messages, but if they do then this should
improve power readings for those too.
2011-03-10 14:26:12 +00:00
Mark Liversedge
10819d05fa Remove RideSummary from Metadata default config in V3 2011-03-10 08:28:48 +00:00
Mark Liversedge
b62be23fc0 Fix ASSERT crash in Weekly Summary for No Zones
If you have no valid zones configured for the week being
displayed the weekly summary window crashes on an assert.
This was caused by new code for v3 which uses the metricDB
to avoid unneccessary computation -- but introduced this
error.
2011-03-08 18:07:30 +00:00
Mark Liversedge
fc51026aa7 Native ANT+ Part 2 - Garmin USB1 Stick on Windows
This patch provides support for Garmin USB1 sticks under
Windows. Since the device does not present a serial port
this code uses the USBXpress API from SiLabs that the
Garmin device uses.

Support for USB2 sticks is pending.

To build you will need to download and install the SiLabs
development kit from http://www.silabs.com/products/mcu/Pages/USBXpress.aspx
and set USBXPRESS_INSTALL appropriately in gcconfig.pri. I
have provided instructions in gcconfig.pri.in.

At runtime the SiUSBXp.dll will need to be in the path, I will
assume that Gareth will fix up the windows installer for this, but
for now just copy the file manually.

Tested with a GARMIN USB1 stick on Windows 7 with SRM, Garmin HR and
a GSC-10 dual speed/cadence device.

There are other minor fixes to the ANTMessage code in this patch
related to decoding of calibration messages.
2011-03-07 13:39:17 +00:00