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