FIX Static scheduling with event
This commit is contained in:
parent
b4d5f8028d
commit
818daaa9a0
@ -150,7 +150,7 @@ static utest::v1::status_t greentea_setup(const size_t number_of_cases) {
|
||||
// List of test cases in this file
|
||||
static Case cases[] = {
|
||||
Case("test bike system", test_bike_system),
|
||||
Case("test bike system with event queue", test_bike_system_event_queue)
|
||||
Case("test bike system with event queue", test_bike_system_event_queue),
|
||||
Case("test bike system with event handling", test_bike_system_with_event),
|
||||
};
|
||||
|
||||
|
@ -75,48 +75,6 @@ BikeSystem::BikeSystem() :
|
||||
}
|
||||
|
||||
void BikeSystem::start() {
|
||||
tr_info("Starting Super-Loop without event handling");
|
||||
|
||||
init();
|
||||
|
||||
while (true) {
|
||||
auto startTime = _timer.elapsed_time();
|
||||
|
||||
gearTask(); // 100ms : 0ms -> 100ms
|
||||
speedDistanceTask(); // 200ms : 100ms -> 300ms
|
||||
displayTask1(); // 200ms : 300ms -> 500ms
|
||||
speedDistanceTask(); // 200ms : 500ms -> 700ms
|
||||
resetTask(); // 100ms : 700ms -> 800ms
|
||||
gearTask(); // 100ms : 800ms -> 900ms
|
||||
speedDistanceTask(); // 200ms : 900ms -> 1100ms
|
||||
temperatureTask(); // 100ms : 1100ms -> 1200ms
|
||||
displayTask2(); // 100ms : 1200ms -> 1300ms
|
||||
speedDistanceTask(); // 200ms : 1300ms -> 1500ms
|
||||
resetTask(); // 100ms : 1500ms -> 1600ms
|
||||
|
||||
|
||||
|
||||
// register the time at the end of the cyclic schedule period and print the
|
||||
// elapsed time for the period
|
||||
std::chrono::microseconds endTime = _timer.elapsed_time();
|
||||
const auto cycle =
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
|
||||
tr_debug("Repeating cycle time is %" PRIu64 " milliseconds", cycle.count());
|
||||
|
||||
bool stopFlag = false;
|
||||
core_util_atomic_load(&stopFlag);
|
||||
if (stopFlag) {
|
||||
break;
|
||||
}
|
||||
|
||||
#if !defined(MBED_TEST_MODE)
|
||||
_cpuLogger.printStats();
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void BikeSystem::startWithEventQueue() {
|
||||
|
||||
tr_info("Starting Super-Loop with event handling");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user