[SOLVED]Simple while freeze loop...

stefanoxjx
Posts: 25
Joined: Mon Feb 12, 2018 6:26 pm

[SOLVED]Simple while freeze loop...

Postby stefanoxjx » Thu Feb 22, 2018 9:42 am

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
Last edited by stefanoxjx on Thu Feb 22, 2018 10:04 am, edited 1 time in total.

stefanoxjx
Posts: 25
Joined: Mon Feb 12, 2018 6:26 pm

Re: Simple while freeze loop...

Postby stefanoxjx » Thu Feb 22, 2018 10:03 am

Pardon, I understanding.
The problem is not created from this loop but from another task.

Stefano

Who is online

Users browsing this forum: HighVoltage and 110 guests