Page 1 of 1

[SOLVED]Simple while freeze loop...

Posted: Thu Feb 22, 2018 9:42 am
by stefanoxjx
Hi, I've a question...
Why this code freeze the loop?

Code: Select all

    printf("Start\n");
    while(1)
    //while (!gpio_get_level(CLOSESWITCH))
    {
        printf("%d\n", curServoPos);
        //curServoPos -= changeDelta;
        /*ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, curServoPos);
        ledc_update_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0);
        vTaskDelay(VALUECHANGERATE / portTICK_PERIOD_MS);
        if(gpio_get_level(CLOSESWITCH)) break;*/
        vTaskDelay(20 / portTICK_PERIOD_MS);
    }
    printf("Val %d\n", curServoPos);
The result is this:

Code: Select all

Start
2500
2500
2500
2500
2500
2500
2500
2500
2500
2500
2500
2500
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
 - IDLE (CPU 0)
Tasks currently running:
CPU 0: blinkLed
CPU 1: IDLE
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
 - IDLE (CPU 0)
Tasks currently running:
CPU 0: blinkLed
CPU 1: IDLE
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
 - IDLE (CPU 0)
Tasks currently running:
CPU 0: blinkLed
CPU 1: IDLE
The lines commented were removed attempting to understanding which line was creates the problem.
So, I've seen that none of those lines have problems.

I don't understand.
Is this a bug?
Thanks.

Best regards.

Stefano

Re: Simple while freeze loop...

Posted: Thu Feb 22, 2018 10:03 am
by stefanoxjx
Pardon, I understanding.
The problem is not created from this loop but from another task.

Stefano