From 796569fa310bc11cf3ebec1f5a7a119a1384330f Mon Sep 17 00:00:00 2001 From: doudar Date: Mon, 5 Sep 2022 08:29:55 -0500 Subject: [PATCH] reverted ERG change --- CHANGELOG.md | 1 + src/ERG_Mode.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc1ad5d9..0d6b5e06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/src/ERG_Mode.cpp b/src/ERG_Mode.cpp index fd8946c0..a828cfed 100644 --- a/src/ERG_Mode.cpp +++ b/src/ERG_Mode.cpp @@ -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;