diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f2f75d7b1ac..c2fe46df8c7 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -104,4 +104,5 @@ jobs: run: | . ${IDF_PATH}/export.sh idf.py create-project test + echo CONFIG_FREERTOS_HZ=1000 > test/sdkconfig.defaults idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build diff --git a/CMakeLists.txt b/CMakeLists.txt index f5c324db580..8e065f90605 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,6 +210,12 @@ set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl b idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) +if(NOT CONFIG_FREERTOS_HZ EQUAL 1000 AND NOT "$ENV{ARDUINO_SKIP_TICK_CHECK}") + # See delay() in cores/esp32/esp32-hal-misc.c. + message(FATAL_ERROR "esp32-arduino requires CONFIG_FREERTOS_HZ=1000 " + "(currently ${CONFIG_FREERTOS_HZ})") +endif() + string(TOUPPER ${CONFIG_ARDUINO_VARIANT} idf_target_caps) target_compile_options(${COMPONENT_TARGET} PUBLIC -DARDUINO=10812 diff --git a/docs/source/esp-idf_component.rst b/docs/source/esp-idf_component.rst index f153f267e6b..e2049b4e2bf 100644 --- a/docs/source/esp-idf_component.rst +++ b/docs/source/esp-idf_component.rst @@ -140,8 +140,7 @@ If you are writing code that does not require Arduino to compile and you want yo FreeRTOS Tick Rate (Hz) ----------------------- -You might notice that Arduino-esp32's `delay()` function will only work in multiples of 10ms. That is because, by default, esp-idf handles task events 100 times per second. -To fix that behavior, you need to set FreeRTOS tick rate to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`. +The Arduino component requires the FreeRTOS tick rate `CONFIG_FREERTOS_HZ` set to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`. Compilation Errors ------------------