Two types of events can be posted: "standard" events are posted at the moment of the function call, while delayed events are posted after a specified amount of time.
### Standard events
To post a "standard" event the following code is used:
```cpp
...
...
@@ -79,7 +82,11 @@ class MyClass : public FSM<MyClass>
}
```
### Events with parameters
### Events with payload
If the event has some parameter associated (a typical example is a remote command from the ground station) the event has to be manually instanciated
```cpp
// Include the event broker
...
...
@@ -113,3 +120,20 @@ void someFunction()
```
** ⚠️ WARNING ⚠️ **
The `postDelayed` function does not work with "non-standard" events, all the payload is lost!
## Troubleshooting
Check all the following points before beating your head against the wall :)
- Call the `.start()` method on all the `FSM` subclasses used and on `sEventBroker`:
```cpp
#include<events/EventBroker.h>
ADAada;
intmain()
{
sEventBroker->start();
ada.start();
}
```
- Don't post events with payload using `postDelayed`(see warning above)