m5stack / M5Unified

Unified library for M5Stack series
MIT License
324 stars 58 forks source link

Develop #18

Closed mayopan closed 2 years ago

mayopan commented 2 years ago

Thank you for AquesTalk example of asynchronous version! I tried it and it works fine. But when I applied it for my project using wifi UDP function, it doesn't work well because the AquesTalk task was set on the same core of esp32 (PRO_CPU_NUM = core0) as the wifi task.

xTaskCreate function is not for dual core esp32. So it always sets task on core0. When there is some network function, the task runs on PRO_CPU_NUM (= core 0). In this situation, it's better for the other function like AquesTalk to be set on APP_CPU_NUM (= core 1).

xTaskCreateUniversal has upward compatibility of xTaskCreate, it can set a task on each core like xTaskCreatePinnedToCore.

I changed xTask from xTaskCreate to xTaskCreateUniversal so that it sets task on core1. It works fine on a program with wifi function like my project.

lovyan03 commented 2 years ago

@mayopan Thanks for the pull request!