diff --git a/common/speedometer.cpp b/common/speedometer.cpp index 0f1b413..4ed68be 100644 --- a/common/speedometer.cpp +++ b/common/speedometer.cpp @@ -25,6 +25,7 @@ #include "speedometer.hpp" #include +#include #include #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(); diff --git a/common/speedometer.hpp b/common/speedometer.hpp index 6326d77..e831cb2 100644 --- a/common/speedometer.hpp +++ b/common/speedometer.hpp @@ -55,7 +55,7 @@ class Speedometer { float getTraySize() const; std::chrono::milliseconds getCurrentPedalRotationTime() const; void setOnResetCallback(mbed::Callback cb); - mbed::Callback _cbOnReset; + mbed::Callback _cbOnReset = NULL; #endif // defined(MBED_TEST_MODE) private: diff --git a/main.cpp b/main.cpp index 17a3e63..45253da 100644 --- a/main.cpp +++ b/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 diff --git a/mbed-bootloader-advembsof.bin b/mbed-bootloader-advembsof.bin deleted file mode 100644 index 5a505d0..0000000 Binary files a/mbed-bootloader-advembsof.bin and /dev/null differ diff --git a/mbed_app.json b/mbed_app.json index 5d66112..45b383a 100644 --- a/mbed_app.json +++ b/mbed_app.json @@ -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" } } } diff --git a/static_scheduling_with_event/bike_system.cpp b/static_scheduling_with_event/bike_system.cpp index e9416d5..ce87c29 100644 --- a/static_scheduling_with_event/bike_system.cpp +++ b/static_scheduling_with_event/bike_system.cpp @@ -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();