When calling the function StartStateSamplingTask(), several tasks can be started. This should not be possible. A check should be made to see if a task is already running and if so just update the sampleTime and sampleDuration.
Check so that this does not occur elsewhere in the code while at it :)
It seems this can be an issue with all of the sampling tasks that can be created and run for a limited time. Check if task handle == NULL before creating new task.
When calling the function StartStateSamplingTask(), several tasks can be started. This should not be possible. A check should be made to see if a task is already running and if so just update the sampleTime and sampleDuration.
Check so that this does not occur elsewhere in the code while at it :)