sha
December 30, 2020, 6:09pm
#1
Hello to all,
I would like to use the pcTaskGetName function from FreeRtos however it is not available.
As per the documentation :
FreeRTOS - ESP32 - — ESP-IDF Programming Guide latest documentation ,
this function does not need any particular setup in FreeRTOSConfig.h to be available (like the case of xTaskGetHandle
).
What is wrong ? Is there a mistake in the documentation?
Should I setup a particular include in FreeRTOSConfig.h for it to be available ?
Thanks for your advices on this one.
Sha.
What platformio.ini
are you using?
you mean pcTaskGetName()
. There is no xTakGetName()
.
sha
December 30, 2020, 6:15pm
#4
oops sorry
yes pcTaskGetName
bad cut and paste
Works for me in Arduino-ESP32.
[env:esp32]
platform = espressif32
board = esp32dev
monitor_filters = esp32_exception_decoder
framework = arduino
monitor_speed = 115200
with src\main.cpp
#include <Arduino.h>
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.print("Task name: ");
Serial.println(pcTaskGetTaskName(NULL));
delay(1000);
}
outputs
Task name: loopTask
Which is correct, the Arduino-ESP32 core creates the task of that name
extern "C" void app_main()
{
loopTaskWDTEnabled = false;
initArduino();
xTaskCreateUniversal(loopTask, "loopTask", CONFIG_ARDUINO_LOOP_STACK_SIZE, NULL, 1, &loopTaskHandle, CONFIG_ARDUINO_RUNNING_CORE);
}
Your platformio.ini
is what?
sha
December 30, 2020, 6:21pm
#6
I have
[env:mini32]
platform = espressif32
board = wemos_d1_mini32
upload_port = 192.168.0.16
This is the full file?
There is no framework = ..
line to describe what framework you want to use? Arduino or ESP-IDF?
sha
December 30, 2020, 6:23pm
#8
[platformio]
default_envs =
mini32
; mini66
[env]
framework = arduino
upload_speed = 921600
monitor_speed = 115200
lib_extra_dirs = .\lib
lib_deps = fastled/FastLED@3.3.3
ESP_VS1053_Library@1.1.2
ArduinoOTA
ArduinoJson@6.13.0
Time-sha@1.5.1
;https://github.com/MajicDesigns/MD_Parola@3.3.0
MD_Parola@3.3.0
;https://github.com/MajicDesigns/MD_MAX72XX@3.2.1
MD_MAX72xx@3.2.3
;https://github.com/knolleary/pubsubclient@2.8
PubSubClient@2.8
;https://github.com/plapointe6/EspHtmlTemplateProcessor@1.2.1
;EspHtmlTemplateProcessor@1.2.1
https://github.com/JoaoLopesF/RemoteDebug
;https://github.com/JoaoLopesF/RemoteDebugger
[env:mini32]
platform = espressif32
board = wemos_d1_mini32
upload_port = 192.168.0.16
upload_protocol = espota
board_build.partitions = default.csv
lib_deps =
${env.lib_deps}
WiFiManager-sha@0.19.0
This looks okay. What is the exact code you’re running that tries to use that function? What is the error message when using “Build”?
sha
December 30, 2020, 6:28pm
#10
Here is the build error:
E:/Data/PlatformIO/Sha_Clock_v52/src/Clock_support.ino:480:50: error: ‘pcTaskGetName’ was not declared in this scope
uxTaskNameArray[3] = pcTaskGetName(xWebHandle);
sha:
pcTaskGetName
Again, the function is called pcTaskGetTaskName
.
EDIT: Okay the documentation seems to be just wrong about the name of this function. pcTaskGetTaskName
is correct, everything else is false.
/**
* Get task name
*
* @return The text (human readable) name of the task referenced by the handle
* xTaskToQuery. A task can query its own name by either passing in its own
* handle, or by setting xTaskToQuery to NULL. INCLUDE_pcTaskGetTaskName must be
* set to 1 in FreeRTOSConfig.h for pcTaskGetTaskName() to be available.
*
* \ingroup TaskUtils
*/
char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
Maybe it has something to do with the fact that you’re looking at the documentation for the latest ESP-IDF, but the Arduino core is built on a slightly older ESP-IDF version.
sha
December 30, 2020, 6:37pm
#12
Bingo !
I changed the name of the function to pcTaskGetTaskName
it builds with no error
This is a mistake in the doc !!
Thank you so much
Sha