FIX cast with chrono duration
This commit is contained in:
		| @@ -110,7 +110,7 @@ void Speedometer::computeSpeed() { | |||||||
|     // TODO : done |     // TODO : done | ||||||
|     //Distance run with one pedal turn = tray size / rear gear size * circumference of the wheel |     //Distance run with one pedal turn = tray size / rear gear size * circumference of the wheel | ||||||
|     constexpr float ms_in_hour = static_cast<float>(3600 * 1000); |     constexpr float ms_in_hour = static_cast<float>(3600 * 1000); | ||||||
|     float pedal_rotation_per_hour = ms_in_hour / static_cast<float>(_pedalRotationTime.count()); |     float pedal_rotation_per_hour = ms_in_hour / std::chrono::duration_cast<std::chrono::milliseconds>(_pedalRotationTime).count(); | ||||||
|     float gear_ratio = static_cast<float>(kTraySize) / static_cast<float>(this->_gearSize); |     float gear_ratio = static_cast<float>(kTraySize) / static_cast<float>(this->_gearSize); | ||||||
|     float wheel_dist_km = static_cast<float>(this->kWheelCircumference) / 1000.0; |     float wheel_dist_km = static_cast<float>(this->kWheelCircumference) / 1000.0; | ||||||
|     this->_currentSpeed = gear_ratio * wheel_dist_km * pedal_rotation_per_hour; |     this->_currentSpeed = gear_ratio * wheel_dist_km * pedal_rotation_per_hour; | ||||||
| @@ -141,4 +141,4 @@ void Speedometer::computeDistance() { | |||||||
|     _lastTime = _timer.elapsed_time(); |     _lastTime = _timer.elapsed_time(); | ||||||
| } | } | ||||||
|  |  | ||||||
| }  // namespace bike_computer | }  // namespace bike_computer | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user