mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 22:59:47 +08:00
Merge remote-tracking branch 'origin/development'
# Conflicts: # include/etl/version.h # support/Release notes.txt
This commit is contained in:
parent
dee811efd0
commit
09b769a8ba
@ -423,13 +423,13 @@ namespace etl
|
||||
ETL_DISABLE_TIMER_UPDATES;
|
||||
active_list.remove(timer.id, false);
|
||||
ETL_ENABLE_TIMER_UPDATES;
|
||||
|
||||
// Reset in-place.
|
||||
new (&timer) callback_timer_data();
|
||||
--registered_timers;
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
// Reset in-place.
|
||||
new (&timer) callback_timer_data();
|
||||
--registered_timers;
|
||||
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -588,8 +588,9 @@ namespace etl
|
||||
ETL_DISABLE_TIMER_UPDATES;
|
||||
active_list.remove(timer.id, false);
|
||||
ETL_ENABLE_TIMER_UPDATES;
|
||||
result = true;
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -604,7 +605,7 @@ namespace etl
|
||||
if (stop(id_))
|
||||
{
|
||||
timer_array[id_].period = period_;
|
||||
return start(id_);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -618,7 +619,7 @@ namespace etl
|
||||
if (stop(id_))
|
||||
{
|
||||
timer_array[id_].repeating = repeating_;
|
||||
return start(id_);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -392,13 +392,13 @@ namespace etl
|
||||
ETL_DISABLE_TIMER_UPDATES;
|
||||
active_list.remove(timer.id, true);
|
||||
ETL_ENABLE_TIMER_UPDATES;
|
||||
|
||||
// Reset in-place.
|
||||
new (&timer) message_timer_data();
|
||||
--registered_timers;
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
// Reset in-place.
|
||||
new (&timer) message_timer_data();
|
||||
--registered_timers;
|
||||
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -557,8 +557,9 @@ namespace etl
|
||||
ETL_DISABLE_TIMER_UPDATES;
|
||||
active_list.remove(timer.id, false);
|
||||
ETL_ENABLE_TIMER_UPDATES;
|
||||
result = true;
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -573,7 +574,7 @@ namespace etl
|
||||
if (stop(id_))
|
||||
{
|
||||
timer_array[id_].period = period_;
|
||||
return start(id_);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -587,7 +588,7 @@ namespace etl
|
||||
if (stop(id_))
|
||||
{
|
||||
timer_array[id_].repeating = repeating_;
|
||||
return start(id_);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -37,10 +37,10 @@ SOFTWARE.
|
||||
/// Definitions of the ETL version
|
||||
///\ingroup utilities
|
||||
|
||||
#define ETL_VERSION "11.8.0"
|
||||
#define ETL_VERSION "11.9.1"
|
||||
#define ETL_VERSION_MAJOR 11
|
||||
#define ETL_VERSION_MINOR 8
|
||||
#define ETL_VERSION_PATCH 0
|
||||
#define ETL_VERSION_MINOR 9
|
||||
#define ETL_VERSION_PATCH 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -340,13 +340,13 @@ ecl_timer_result_t ecl_timer_unregister(ecl_timer_id_t id_)
|
||||
ECL_TIMER_DISABLE_PROCESSING;
|
||||
ecl_timer_list_remove(ptimer->id, 0);
|
||||
ECL_TIMER_ENABLE_PROCESSING;
|
||||
|
||||
// Reset in-place.
|
||||
ecl_timer_data_init_default(ptimer);
|
||||
--ecl.registered_timers;
|
||||
|
||||
result = ECL_TIMER_PASS;
|
||||
}
|
||||
|
||||
// Reset in-place.
|
||||
ecl_timer_data_init_default(ptimer);
|
||||
--ecl.registered_timers;
|
||||
|
||||
result = ECL_TIMER_PASS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,8 +506,9 @@ ecl_timer_result_t ecl_timer_stop(ecl_timer_id_t id_)
|
||||
ECL_TIMER_DISABLE_PROCESSING;
|
||||
ecl_timer_list_remove(ptimer->id, 0);
|
||||
ECL_TIMER_ENABLE_PROCESSING;
|
||||
result = ECL_TIMER_PASS;
|
||||
}
|
||||
|
||||
result = ECL_TIMER_PASS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -524,7 +525,7 @@ ecl_timer_result_t ecl_timer_set_period(ecl_timer_id_t id_, ecl_timer_time_t per
|
||||
if (ecl_timer_stop(id_))
|
||||
{
|
||||
ecl.ptimers[id_].period = period_;
|
||||
return ecl_timer_start(id_, 0);
|
||||
return ECL_TIMER_PASS;
|
||||
}
|
||||
|
||||
return ECL_TIMER_FAIL;
|
||||
@ -540,7 +541,7 @@ ecl_timer_result_t ecl_timer_set_mode(ecl_timer_id_t id_, ecl_timer_mode_t repea
|
||||
if (ecl_timer_stop(id_))
|
||||
{
|
||||
ecl.ptimers[id_].repeating = repeating_;
|
||||
return ecl_timer_start(id_, 0);
|
||||
return ECL_TIMER_PASS;
|
||||
}
|
||||
|
||||
return ECL_TIMER_FAIL;
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
===============================================================================
|
||||
11.9.1
|
||||
Fix Github issue #73 (Timers)
|
||||
|
||||
===============================================================================
|
||||
11.9.0
|
||||
Added CRC32-C (Castagnoli)
|
||||
|
||||
===============================================================================
|
||||
11.8.0
|
||||
Added more binary utilities.
|
||||
|
||||
@ -149,6 +149,52 @@ namespace
|
||||
CHECK_ARRAY_EQUAL(compare3.data(), callback_list3.data(), compare3.size());
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
TEST(message_timer_one_shot_after_timeout)
|
||||
{
|
||||
ecl_timer_init(timers, NTIMERS);
|
||||
|
||||
ecl_timer_id_t id1 = ecl_timer_register(callback1, 37, ECL_TIMER_SINGLE_SHOT);
|
||||
callback_list1.clear();
|
||||
|
||||
ecl_timer_enable(ECL_TIMER_ENABLED);
|
||||
ecl_timer_start(id1, ECL_TIMER_START_DELAYED);
|
||||
|
||||
ticks = 0;
|
||||
|
||||
const uint32_t step = 1;
|
||||
|
||||
while (ticks <= 100U)
|
||||
{
|
||||
ticks += step;
|
||||
ecl_timer_tick(step);
|
||||
}
|
||||
|
||||
// Timer should have timed out.
|
||||
|
||||
CHECK(ecl_timer_set_period(id1, 50));
|
||||
ecl_timer_start(id1, ECL_TIMER_START_DELAYED);
|
||||
|
||||
callback_list1.clear();
|
||||
|
||||
ticks = 0;
|
||||
|
||||
while (ticks <= 100U)
|
||||
{
|
||||
ticks += step;
|
||||
ecl_timer_tick(step);
|
||||
}
|
||||
|
||||
// Timer should have timed out.
|
||||
|
||||
CHECK_EQUAL(50, *callback_list1.data());
|
||||
|
||||
CHECK(ecl_timer_unregister(id1));
|
||||
CHECK(!ecl_timer_unregister(id1));
|
||||
CHECK(!ecl_timer_start(id1, ECL_TIMER_START_DELAYED));
|
||||
CHECK(!ecl_timer_stop(id1));
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
TEST(ecl_timer_repeating)
|
||||
{
|
||||
|
||||
@ -169,6 +169,52 @@ namespace
|
||||
CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size());
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
TEST(message_timer_one_shot_after_timeout)
|
||||
{
|
||||
etl::callback_timer<1> timer_controller;
|
||||
|
||||
etl::timer::id::type id1 = timer_controller.register_timer(member_callback, 37, etl::timer::mode::SINGLE_SHOT);
|
||||
test.tick_list.clear();
|
||||
|
||||
timer_controller.start(id1);
|
||||
timer_controller.enable(true);
|
||||
|
||||
ticks = 0;
|
||||
|
||||
const uint32_t step = 1;
|
||||
|
||||
while (ticks <= 100U)
|
||||
{
|
||||
ticks += step;
|
||||
timer_controller.tick(step);
|
||||
}
|
||||
|
||||
// Timer should have timed out.
|
||||
|
||||
CHECK(timer_controller.set_period(id1, 50));
|
||||
timer_controller.start(id1);
|
||||
|
||||
test.tick_list.clear();
|
||||
|
||||
ticks = 0;
|
||||
|
||||
while (ticks <= 100U)
|
||||
{
|
||||
ticks += step;
|
||||
timer_controller.tick(step);
|
||||
}
|
||||
|
||||
// Timer should have timed out.
|
||||
|
||||
CHECK_EQUAL(50, *test.tick_list.data());
|
||||
|
||||
CHECK(timer_controller.unregister_timer(id1));
|
||||
CHECK(!timer_controller.unregister_timer(id1));
|
||||
CHECK(!timer_controller.start(id1));
|
||||
CHECK(!timer_controller.stop(id1));
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
TEST(callback_timer_repeating)
|
||||
{
|
||||
|
||||
@ -191,6 +191,52 @@ namespace
|
||||
CHECK_ARRAY_EQUAL(compare3.data(), router1.message3.data(), compare3.size());
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
TEST(message_timer_one_shot_after_timeout)
|
||||
{
|
||||
etl::message_timer<1> timer_controller;
|
||||
|
||||
etl::timer::id::type id1 = timer_controller.register_timer(message1, router1, 37, etl::timer::mode::SINGLE_SHOT);
|
||||
router1.clear();
|
||||
|
||||
timer_controller.start(id1);
|
||||
timer_controller.enable(true);
|
||||
|
||||
ticks = 0;
|
||||
|
||||
const uint32_t step = 1;
|
||||
|
||||
while (ticks <= 100U)
|
||||
{
|
||||
ticks += step;
|
||||
timer_controller.tick(step);
|
||||
}
|
||||
|
||||
// Timer should have timed out.
|
||||
|
||||
CHECK(timer_controller.set_period(id1, 50));
|
||||
timer_controller.start(id1);
|
||||
|
||||
router1.clear();
|
||||
|
||||
ticks = 0;
|
||||
|
||||
while (ticks <= 100U)
|
||||
{
|
||||
ticks += step;
|
||||
timer_controller.tick(step);
|
||||
}
|
||||
|
||||
// Timer should have timed out.
|
||||
|
||||
CHECK_EQUAL(50, *router1.message1.data());
|
||||
|
||||
CHECK(timer_controller.unregister_timer(id1));
|
||||
CHECK(!timer_controller.unregister_timer(id1));
|
||||
CHECK(!timer_controller.start(id1));
|
||||
CHECK(!timer_controller.stop(id1));
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
TEST(message_timer_repeating)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user