FIX clang format
This commit is contained in:
		| @@ -24,11 +24,11 @@ | ||||
|  | ||||
| #include "speedometer.hpp" | ||||
|  | ||||
| #include "static_scheduling/gear_device.hpp" | ||||
|  | ||||
| #include <chrono> | ||||
| #include <ratio> | ||||
|  | ||||
| #include "static_scheduling/gear_device.hpp" | ||||
|  | ||||
| // from disco_h747i/wrappers | ||||
| #include "joystick.hpp" | ||||
| #include "mbed_trace.h" | ||||
| @@ -108,10 +108,14 @@ void Speedometer::computeSpeed() { | ||||
|     // ~= 560 m / min = 33.6 km/h | ||||
|  | ||||
|     // 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); | ||||
|     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 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 wheel_dist_km = static_cast<float>(this->kWheelCircumference) / 1000.0; | ||||
|     this->_currentSpeed = gear_ratio * wheel_dist_km * pedal_rotation_per_hour; | ||||
| } | ||||
| @@ -132,7 +136,7 @@ void Speedometer::computeDistance() { | ||||
|     const std::chrono::microseconds timeNow  = _timer.elapsed_time(); | ||||
|     const std::chrono::microseconds timeDiff = timeNow - _lastTime; | ||||
|     constexpr float ms_in_hour               = static_cast<float>(3600 * 1000); | ||||
|     float traveled_dist = _currentSpeed * timeDiff.count() / (ms_in_hour*1000.0/*μs*/); | ||||
|     float traveled_dist = _currentSpeed * timeDiff.count() / (ms_in_hour * 1000.0 /*μs*/); | ||||
|  | ||||
|     this->_totalDistanceMutex.lock(); | ||||
|     this->_totalDistance += traveled_dist; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user