[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Widget change current state outside of main loop RSS feed
Forum Index » tcMenu Arduinio library
Author Message
k


Joined: Jun 17, 2021
Messages: 18
Offline
Hello, I am using the widget function (like the wireless connection on some of the examples, esp8266 etc...)

The functionality works. But when I want to change the widget state inside of a function, it only changes once the function ends and effectively goes to another iteration of the loop.

What I want to do:
Is call an external function to do something (like wifimanager). This causes the menu to stop, until the function ends.
I want to change the widget in the title to reflect (like a save icon on video game save areas).
I want to set the icon at the beginning of the function, then change it again at the end of the function. But doing this doesn't do anything until the function ends which defeats the purpose.

is there any way to update the widgets outside of the main loop? I tried
taskManager.runLoop();
inside the external function but to no avail.

any help is appreciated
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
TaskManagerIO requires that all the functions that you call are either asynchronous or can frequently call taskManager.yieldForMicros(..) if they need to be long-running or block for any reason. Tasks (including everything that tcMenu does) need the run loop to constantly run. I recommend that you read through the TaskManagerIO documentation: https://github.com/davetcc/TaskManagerIO.

On ESP32 or mbed, if you cannot arrange for this then you could create an additional thread to do the long running task, as long as the library in question is thread-safe enough to support that.

To be honest, most Arduino libraries don't block and in most cases just integrate with the loop pattern easily.
 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.