FIX kMaxGearSize and reset callback
This commit is contained in:
		| @@ -25,6 +25,7 @@ | ||||
| #include "speedometer.hpp" | ||||
|  | ||||
| #include <chrono> | ||||
| #include <cstddef> | ||||
| #include <ratio> | ||||
|  | ||||
| #include "static_scheduling/gear_device.hpp" | ||||
| @@ -81,7 +82,9 @@ float Speedometer::getDistance() { | ||||
|  | ||||
| void Speedometer::reset() { | ||||
| #if defined(MBED_TEST_MODE) | ||||
|     _cbOnReset(); | ||||
|     if (_cbOnReset != NULL) { | ||||
|         _cbOnReset(); | ||||
|     } | ||||
| #endif | ||||
|  | ||||
|     this->_totalDistanceMutex.lock(); | ||||
|   | ||||
| @@ -55,7 +55,7 @@ class Speedometer { | ||||
|     float getTraySize() const; | ||||
|     std::chrono::milliseconds getCurrentPedalRotationTime() const; | ||||
|     void setOnResetCallback(mbed::Callback<void()> cb); | ||||
|     mbed::Callback<void()> _cbOnReset; | ||||
|     mbed::Callback<void()> _cbOnReset = NULL; | ||||
| #endif  // defined(MBED_TEST_MODE) | ||||
|  | ||||
|    private: | ||||
|   | ||||
							
								
								
									
										12
									
								
								main.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								main.cpp
									
									
									
									
									
								
							| @@ -7,8 +7,9 @@ | ||||
|  | ||||
| #include "mbed.h"        // NOLINT | ||||
| #include "mbed_trace.h"  // NOLINT | ||||
| // #include "static_scheduling_with_event/bike_system.hpp" | ||||
| #include "multi_tasking/bike_system.hpp" | ||||
| // #include "static_scheduling/bike_system.hpp" | ||||
| #include "static_scheduling_with_event/bike_system.hpp" | ||||
| // #include "multi_tasking/bike_system.hpp" | ||||
|  | ||||
| #if defined(MBED_CONF_MBED_TRACE_ENABLE) | ||||
| #define TRACE_GROUP "MAIN" | ||||
| @@ -21,11 +22,12 @@ int main() { | ||||
|  | ||||
|     // static_scheduling::BikeSystem bikeSystem; | ||||
|     // bikeSystem.start(); | ||||
|     // static_scheduling_with_event::BikeSystem bikeSystem; | ||||
|     // bikeSystem.start(); | ||||
|  | ||||
|     multi_tasking::BikeSystem bikeSystem; | ||||
|     static_scheduling_with_event::BikeSystem bikeSystem; | ||||
|     bikeSystem.start(); | ||||
|  | ||||
|     // multi_tasking::BikeSystem bikeSystem; | ||||
|     // bikeSystem.start(); | ||||
| } | ||||
|  | ||||
| #endif  // MBED_TEST_MODE | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| @@ -2,7 +2,7 @@ | ||||
|   "macros": ["MBED_CONF_MBED_TRACE_FEA_IPV6=0"], | ||||
|   "config": { | ||||
|     "main-stack-size": { | ||||
|       "value": 6144 | ||||
|       "value": 8192 | ||||
|     } | ||||
|   }, | ||||
|   "target_overrides": { | ||||
| @@ -19,9 +19,7 @@ | ||||
|     }, | ||||
|     "DISCO_H747I": { | ||||
|       "mbed-trace.enable": true, | ||||
|       "mbed-trace.max-level": "TRACE_LEVEL_DEBUG", | ||||
|       "target.bootloader_img": "./mbed-os-bootloader/BUILD/DISCO_H747I/GCC_ARM/mbed-os-bootloader.bin", | ||||
|       "target.app_offset": "0x20000" | ||||
|       "mbed-trace.max-level": "TRACE_LEVEL_DEBUG" | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -62,7 +62,7 @@ static constexpr std::chrono::milliseconds kDisplayTask2ComputationTime = 100ms; | ||||
| static constexpr std::chrono::milliseconds kCPUTaskPeriod          = 1600ms; | ||||
| static constexpr std::chrono::milliseconds kCPUTaskDelay           = 1200ms; | ||||
| static constexpr std::chrono::milliseconds kCPUTaskComputationTime = 100ms; | ||||
|    | ||||
|  | ||||
| BikeSystem::BikeSystem() | ||||
|     : _gearDevice(), | ||||
|       _pedalDevice(), | ||||
| @@ -178,7 +178,7 @@ void BikeSystem::speedDistanceTask() { | ||||
|     _taskLogger.logPeriodAndExecutionTime( | ||||
|         _timer, advembsof::TaskLogger::kSpeedTaskIndex, taskStartTime); | ||||
| } | ||||
|    | ||||
|  | ||||
| void BikeSystem::displayTask1() { | ||||
|     auto taskStartTime = _timer.elapsed_time(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user