static boolean_t WORKING = FALSE;
static boolean_t SHUTDOWN = FALSE;
static xSemaphoreHandle step_signal = NULL;
+ static xSemaphoreHandle initialized_signal = NULL;
static uint32_t steps_control = 0;
static uint32_t steps_working = 0;
void control_task(void* p)
{
+ xSemaphoreTake(initialized_signal, portMAX_DELAY);
+
static const portTickType freq_ticks = STEP_SIZE_MILLIS / portTICK_RATE_MS;
portTickType last_wake_time = xTaskGetTickCount();
*/
void working_task(void* p)
{
+ /* Initialize model */
+ %<LibCallModelInitialize()>\
+
+ xSemaphoreGive(initialized_signal);
+
while(!SHUTDOWN) {
/* Lock semaphore */
);
%endif
- /* Initialize model */
- %<LibCallModelInitialize()>\
-
/* Create and lock semaphore */
vSemaphoreCreateBinary(step_signal);
xSemaphoreTake(step_signal, 0);
+ vSemaphoreCreateBinary(initialized_signal);
+ xSemaphoreTake(initialized_signal, 0);
/* Create tasks to step model and model task */
if(xTaskCreate(control_task, (const signed char*)"control_task",