FIX kMinGearSize value

This commit is contained in:
fastium 2025-01-03 20:20:44 +01:00
parent 95e92e2564
commit 62fd302d84
2 changed files with 7 additions and 10 deletions

View File

@ -36,7 +36,7 @@ static constexpr uint8_t kMaxGear = 9;
// smallest gear (= 1) corresponds to a gear size of 20
// when the gear increases, the gear size descreases
static constexpr uint8_t kMaxGearSize = 20;
static constexpr uint8_t kMinGearSize = kMaxGearSize - kMaxGear;
static constexpr uint8_t kMinGearSize = kMaxGearSize - kMinGear;
// pedal related constants
// When compiling and linking with gcc, we get a link error when using static
@ -52,9 +52,8 @@ static constexpr std::chrono::milliseconds kMaxPedalRotationTime = 1500ms;
static constexpr std::chrono::milliseconds kDeltaPedalRotationTime = 25ms;
static constexpr uint32_t kNbrOfSteps = static_cast<uint32_t>(
(
bike_computer::kMaxPedalRotationTime - bike_computer::kMinPedalRotationTime
).count() / bike_computer::kDeltaPedalRotationTime.count()
);
(bike_computer::kMaxPedalRotationTime - bike_computer::kMinPedalRotationTime)
.count() /
bike_computer::kDeltaPedalRotationTime.count());
} // namespace bike_computer
} // namespace bike_computer

View File

@ -79,13 +79,11 @@ class Speedometer {
float _currentSpeed = 0.0f;
Mutex _totalDistanceMutex;
float _totalDistance = 0.0f;
uint8_t _gearSize = 1;
Thread _thread;
uint8_t _gearSize = bike_computer::kMinGearSize;
#if defined(MBED_TEST_MODE)
mbed::Callback<void()> _cb;
#endif
};
} // namespace bike_computer
} // namespace bike_computer