Skip to content

Commit

Permalink
reverted ERG change
Browse files Browse the repository at this point in the history
  • Loading branch information
doudar committed Sep 5, 2022
1 parent 6f01fbb commit 796569f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Enabled CORS for doudar/StreamFit.
- Re-arranged index.html.
- restored link to bluetooth scanner
- Reverted conditional variable initialization in powertable lookup function.

## [2.7.9]

Expand Down
7 changes: 4 additions & 3 deletions src/ERG_Mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ int32_t PowerTable::lookup(int watts, int cad) {
float cad;
};

int i = (POWERTABLE_SIZE < round(watts / POWERTABLE_INCREMENT)) ? round(watts / POWERTABLE_INCREMENT) : POWERTABLE_SIZE; // find the closest entry. Cap at POWERTABLE_SIZE
float scale = (i == POWERTABLE_SIZE) ? POWERTABLE_SIZE - 1 : (watts / POWERTABLE_INCREMENT - i); // Should we look at the next higher or next lower index for comparison?
int indexPair = -1; // The next closest index with data for interpolation
int i = round(watts / POWERTABLE_INCREMENT); // find the closest entry
float scale = watts / POWERTABLE_INCREMENT - i; // Should we look at the next higher or next lower index for comparison?
int indexPair = -1; // The next closest index with data for interpolation // The next closest index
// with data for interpolation
entry above;
entry below;
above.power = 0;
Expand Down

0 comments on commit 796569f

Please sign in to comment.