Hi,
I have a comm’s “watchdog” timer that deletes the comm’s task and then restarts it.
I wish to initiate a restart from within the comm’s task on a known comm’s error using the timer callback. To “call” it from the task I wish to change the timer period to zero viz:
/**************************************************************************
* WIFI TRANSPORT TASK
***************************************************************************
*/
USE_ITCM void wiFiTask(void *argument)
{
/* Task startup stuff */
...
while(1)
{
/* Do comms stuff */
...
if(commsError == true)
{
xTimerChangePeriod(commsTimeoutTmr, 0, 5000); /* Set timer period to zero */
vTaskDelay(10000); /* wait for timer to initiate timer callback */
}
}
}
/**************************************************************************
* COMMUNICATION TIMER FUNCTION - CALLBACK
***************************************************************************
*/
static void commsTimeoutCallback(TimerHandle_t commsTimoutTimer)
{
vTaskSuspend(wiFiTskHandle);
xTimerStop(commsTimeoutTmr, 1000);
xTimerChangePeriod(commsTimeoutTmr, COMMS_TIMER_WIFI_START_DELAY, 500);
wiFiPars.WiFiState = WIFI_COMMS_TIMEOUT_OCURRED;
/* Destroy the wiFi task and then recreate it */
vTaskDelete(wiFiTskHandle);
vTaskDelay(100);
startWiFiSystem(); /* create the wifi comms task */
}
Is this the correct way to do this or is there a better way? Is it OK to set a timer period to zero or does it have to be greater than zero?
Kind regards
Rob