FIX kMaxGearSize and reset callback

This commit is contained in:
fastium 2025-01-07 00:35:20 +01:00
parent a183ad4858
commit e460a4f695
6 changed files with 16 additions and 13 deletions

View File

@ -25,6 +25,7 @@
#include "speedometer.hpp" #include "speedometer.hpp"
#include <chrono> #include <chrono>
#include <cstddef>
#include <ratio> #include <ratio>
#include "static_scheduling/gear_device.hpp" #include "static_scheduling/gear_device.hpp"
@ -81,7 +82,9 @@ float Speedometer::getDistance() {
void Speedometer::reset() { void Speedometer::reset() {
#if defined(MBED_TEST_MODE) #if defined(MBED_TEST_MODE)
_cbOnReset(); if (_cbOnReset != NULL) {
_cbOnReset();
}
#endif #endif
this->_totalDistanceMutex.lock(); this->_totalDistanceMutex.lock();

View File

@ -55,7 +55,7 @@ class Speedometer {
float getTraySize() const; float getTraySize() const;
std::chrono::milliseconds getCurrentPedalRotationTime() const; std::chrono::milliseconds getCurrentPedalRotationTime() const;
void setOnResetCallback(mbed::Callback<void()> cb); void setOnResetCallback(mbed::Callback<void()> cb);
mbed::Callback<void()> _cbOnReset; mbed::Callback<void()> _cbOnReset = NULL;
#endif // defined(MBED_TEST_MODE) #endif // defined(MBED_TEST_MODE)
private: private:

View File

@ -7,8 +7,9 @@
#include "mbed.h" // NOLINT #include "mbed.h" // NOLINT
#include "mbed_trace.h" // NOLINT #include "mbed_trace.h" // NOLINT
// #include "static_scheduling_with_event/bike_system.hpp" // #include "static_scheduling/bike_system.hpp"
#include "multi_tasking/bike_system.hpp" #include "static_scheduling_with_event/bike_system.hpp"
// #include "multi_tasking/bike_system.hpp"
#if defined(MBED_CONF_MBED_TRACE_ENABLE) #if defined(MBED_CONF_MBED_TRACE_ENABLE)
#define TRACE_GROUP "MAIN" #define TRACE_GROUP "MAIN"
@ -21,11 +22,12 @@ int main() {
// static_scheduling::BikeSystem bikeSystem; // static_scheduling::BikeSystem bikeSystem;
// bikeSystem.start(); // bikeSystem.start();
// static_scheduling_with_event::BikeSystem bikeSystem;
// bikeSystem.start();
multi_tasking::BikeSystem bikeSystem; static_scheduling_with_event::BikeSystem bikeSystem;
bikeSystem.start(); bikeSystem.start();
// multi_tasking::BikeSystem bikeSystem;
// bikeSystem.start();
} }
#endif // MBED_TEST_MODE #endif // MBED_TEST_MODE

Binary file not shown.

View File

@ -2,7 +2,7 @@
"macros": ["MBED_CONF_MBED_TRACE_FEA_IPV6=0"], "macros": ["MBED_CONF_MBED_TRACE_FEA_IPV6=0"],
"config": { "config": {
"main-stack-size": { "main-stack-size": {
"value": 6144 "value": 8192
} }
}, },
"target_overrides": { "target_overrides": {
@ -19,9 +19,7 @@
}, },
"DISCO_H747I": { "DISCO_H747I": {
"mbed-trace.enable": true, "mbed-trace.enable": true,
"mbed-trace.max-level": "TRACE_LEVEL_DEBUG", "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"
} }
} }
} }