Skip to content

define delay() to vTaskDelay() #113

Closed

Description

@feilipu

Describe the issue
Users expect to use delay() which breaks FreeRTOS. So define it to be useful.

Expected behavior
Using delay() breaks everything. Redefine it to vTaskDelay() to stop that happening.

Additional context
See discussion here.

Activity

  1. self-assigned this
    on May 23, 2022
  2. technofreak74 commented on May 29, 2022

    @technofreak74

    Apologies if this is the wrong place to raise this, but I think this change may have broken the platformIO integration.

    I'm attempting to build this project: https://github.com/mrwolfjunior/TrigPLC

    but I'm getting the following errors building the FreeRTOS code:

    In file included from .pio/libdeps/controllino_mega/FreeRTOS/src/portable.h:53:0,
                     from .pio/libdeps/controllino_mega/FreeRTOS/src/Arduino_FreeRTOS.h:65,
                     from src/main.cpp:1:
    .pio/libdeps/controllino_mega/FreeRTOS/src/portmacro.h:99:47: error: variable or field 'vTaskDelay' declared void
     #define delay(ms)                   vTaskDelay((TickType_t)(ms)/portTICK_PERIOD_MS)
                                                   ^
    /home/rob/.platformio/packages/framework-arduino-avr/cores/arduino/Arduino.h:143:6: note: in expansion of macro 'delay'
     void delay(unsigned long ms);
          ^~~~~
    /home/rob/.platformio/packages/framework-arduino-avr/cores/arduino/Arduino.h:143:12: error: expected primary-expression before 'unsigned'
     void delay(unsigned long ms);
                ^
    .pio/libdeps/controllino_mega/FreeRTOS/src/portmacro.h:99:61: note: in definition of macro 'delay'
     #define delay(ms)                   vTaskDelay((TickType_t)(ms)/portTICK_PERIOD_MS)
                                                                 ^~
    /home/rob/.platformio/packages/framework-arduino-avr/cores/arduino/Arduino.h:143:12: error: expected ')' before 'unsigned'
     void delay(unsigned long ms);
                ^
    .pio/libdeps/controllino_mega/FreeRTOS/src/portmacro.h:99:61: note: in definition of macro 'delay'
     #define delay(ms)                   vTaskDelay((TickType_t)(ms)/portTICK_PERIOD_MS)
                                                                 ^~
    

    Commenting out this #define or rolling back to 10.4.6-2 allows the project to build without error.

  3. feilipu commented on May 29, 2022

    @feilipu
    OwnerAuthor

    Try 10.4.6-4 Release. Please report if still broken.
    See #114 discussion for more details.

  4. technofreak74 commented on May 29, 2022

    @technofreak74

    10.4.6-4 builds without issue! Great timing 😄 thank you!

  5. added a commit that references this issue on Jan 28, 2025
    1cd91fc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions