Profile detection events generation

When the logger is configured with settings castdetection = on, it generates cast events in the recorded data (see EasyParse format events markers and Standard format events markers).
There are basically three types of cast events: beginning of an upcast, beginning of a downcast and end of cast.

The following state machine is used to determine those events.

profiledetectionstatemachine