diff --git a/include/etl/fsm.h b/include/etl/fsm.h index 6123539b..2f71d587 100644 --- a/include/etl/fsm.h +++ b/include/etl/fsm.h @@ -195,6 +195,7 @@ namespace etl //******************************************* /// Adds a child to this state. + /// Only of use when part of an HFSM. //******************************************* void add_child_state(etl::ifsm_state& state) { @@ -210,6 +211,7 @@ namespace etl //******************************************* /// Adds a list of child states. + /// Only of use when part of an HFSM. //******************************************* template void set_child_states(etl::ifsm_state** state_list, TSize size) @@ -224,30 +226,6 @@ namespace etl } } - //******************************************* - /// Get the parent state for this state. - //******************************************* - etl::ifsm_state* get_parent_state() const - { - return p_parent; - } - - //******************************************* - /// Get the active child state for this state. - //******************************************* - etl::ifsm_state* get_active_child_state() const - { - return p_active_child; - } - - //******************************************* - /// Get the default child state for this state. - //******************************************* - etl::ifsm_state* get_default_child_state() const - { - return p_default_child; - } - protected: //******************************************* diff --git a/include/etl/hfsm.h b/include/etl/hfsm.h index 134f18d1..deb233ff 100644 --- a/include/etl/hfsm.h +++ b/include/etl/hfsm.h @@ -5,7 +5,7 @@ Embedded Template Library. https://github.com/ETLCPP/etl https://www.etlcpp.com -Copyright(c) 2021 +Copyright(c) 2021 Jeremy Overesch, John Wellbelove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal @@ -88,41 +88,41 @@ namespace etl //******************************************* /// Return the first common ancester of the two states. //******************************************* - static etl::ifsm_state* common_ancestor(etl::ifsm_state* p1, etl::ifsm_state* p2) + static etl::ifsm_state* common_ancestor(etl::ifsm_state* s1, etl::ifsm_state* s2) { - size_t depth1 = get_depth(p1); - size_t depth2 = get_depth(p2); + size_t depth1 = get_depth(s1); + size_t depth2 = get_depth(s2); - // Adjust p1 and p2 to the same depth. + // Adjust s1 and s2 to the same depth. if (depth1 > depth2) { - p1 = adjust_depth(p1, depth1 - depth2); + s1 = adjust_depth(s1, depth1 - depth2); } else { - p2 = adjust_depth(p2, depth2 - depth1); + s2 = adjust_depth(s2, depth2 - depth1); } // Now they're aligned to the same depth they can step towards the root together. - while (p1 != p2) + while (s1 != s2) { - p1 = p1->p_parent; - p2 = p2->p_parent; + s1 = s1->p_parent; + s2 = s2->p_parent; } - return p1; + return s1; } //******************************************* /// Find the depth of the state. //******************************************* - static size_t get_depth(etl::ifsm_state* p) + static size_t get_depth(etl::ifsm_state* s) { size_t depth = 0; - while (p != ETL_NULLPTR) + while (s != ETL_NULLPTR) { - p = p->p_parent; + s = s->p_parent; ++depth; } @@ -132,15 +132,15 @@ namespace etl //******************************************* /// Align the depths of the states. //******************************************* - static etl::ifsm_state* adjust_depth(etl::ifsm_state* p, size_t offset) + static etl::ifsm_state* adjust_depth(etl::ifsm_state* s, size_t offset) { while (offset != 0U) { - p = p->p_parent; + s = s->p_parent; --offset; } - return p; + return s; } //******************************************* diff --git a/include/etl/version.h b/include/etl/version.h index b80198b3..5a95ecd8 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -38,8 +38,8 @@ SOFTWARE. ///\ingroup utilities #define ETL_VERSION_MAJOR 20 -#define ETL_VERSION_MINOR 9 -#define ETL_VERSION_PATCH 3 +#define ETL_VERSION_MINOR 10 +#define ETL_VERSION_PATCH 0 #define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH) diff --git a/library.json b/library.json index ae9e5b9a..5f1e835b 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "ETL Embedded Template Library", - "version": "20.9.3", + "version": "20.10.0", "author s": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/library.properties b/library.properties index 8b9d4db7..295d134a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library ETL -version=20.9.3 +version=20.10.0 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/support/Release notes.txt b/support/Release notes.txt index f419d1b2..2d89550f 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,7 @@ +=============================================================================== +20.10.0 +Added Hierarchical Finite State Machine (etl::hfsm) derived from etl::fsm + =============================================================================== 20.9.3 Fixed misspelt DBL_MAX macro.