AK-Homberger/NMEA2000WifiGateway-with-ESP32

parallel processing

Kingurus opened this issue · 3 comments

Hi, I thank you so much for this code, it saved me a lot of time.
I found a slight issue: GetTemperature is delaying the main loop, I found this when I added a small oled display with a counter increasing every loop. I could see the counting freezing for about 0.5 second almost every 1 second.

I fixed it by making xTaskCreatePinnedToCore priority 0, removing the "delay" from GetTemperature, and adding vTaskDelay(100) after sensors.requestTemperatures() and another vTaskDelay(100) at the end. Now the counter does not freeze and GetTemperature still working correctly.

Hi Flybysky,
Thanks for reporting this issue and also providing a solution. I will double check and update the main code.
I had other problems with lower priority. That's wha I did set it to 2. But I did not check the effct of the main loop() task.
Regards,
Andreas

I changed the code now. I noticed only a short delay but with your recommended fix, the delay of the main task is gone. Many thanks.

My pleasure. Thank you for the code :)