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.
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
// Include the event broker
...
...
@@ -22,7 +22,9 @@ void someFunction()
sEventBroker->post({EV_ADA_READY},TOPIC_ADA);
}
```
### Delayed events
The delayed events are posted in a very similar way:
```cpp
// Include the event broker
...
...
@@ -83,10 +85,8 @@ class MyClass : public FSM<MyClass>
}
```
### 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
...
...
@@ -118,10 +118,10 @@ void someFunction()
sEventBroker->post(ev,TOPIC_TC);
}
```
** ⚠️ WARNING ⚠️ **
The `postDelayed` function does not work with "non-standard" events, all the payload is lost!
> :warning: **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`: