Old flight modes system was very inconvenient so I figured out the new way to implement it. This enables code reusability and makes flight modes simple.
Idea is as follows:
Flight modes now could be represented as a tree. Every flight mode should be based on other flight mode and extend its functionality (there are some base flight modes like stabilize that begin the tree). Every flight mode inherits from abstract FlightMode class to enable creating a pointer to the current one. Every flight mode adds its execute() method to the Tasker through the lambda expression (or override the () operator) [this part can change because there are some problems with Arduino and standard library for c++11 which enables std::function feature to store all function objects]
Old flight modes system was very inconvenient so I figured out the new way to implement it. This enables code reusability and makes flight modes simple.
Idea is as follows:
Flight modes now could be represented as a tree. Every flight mode should be based on other flight mode and extend its functionality (there are some base flight modes like stabilize that begin the tree). Every flight mode inherits from abstract FlightMode class to enable creating a pointer to the current one. Every flight mode adds its execute() method to the Tasker through the lambda expression (or override the () operator) [this part can change because there are some problems with Arduino and standard library for c++11 which enables std::function feature to store all function objects]