Skip to content

Commit

Permalink
Limit Gear Ratio
Browse files Browse the repository at this point in the history
.. to whatever the maximumFor value is as dodgy data can
   yield really high values; anything over 6 is probably
   wrong for most high gears (53x10 = 5.3)
  • Loading branch information
liversedge committed Oct 16, 2014
1 parent db1a1cb commit 4f49843
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/RideFile.cpp
Expand Up @@ -1069,7 +1069,7 @@ RideFile::maximumFor(SeriesType series)
case rcad : return 500; break;
case rvert : return 50; break;
case rcontact : return 1000; break;
case gear : return 30; break;
case gear : return 7; break; // 53x8
case wprime : return 99999; break;
default :
case none : break;
Expand Down Expand Up @@ -1493,6 +1493,9 @@ RideFile::recalculateDerivedSeries()
// to do something to it in order to identify gear)
// speed and wheelsize in meters
p->gear = (1000.00f * p->kph) / (p->cad * 60.00f * wheelsize);

// truncate big values
if (p->gear > maximumFor(RideFile::gear)) p->gear = 0;

} else {
p->gear = 0.0f;
Expand Down

0 comments on commit 4f49843

Please sign in to comment.