[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 

How to increase the number of tasks or number of switches RSS feed
Forum Index » IoAbstraction & TaskManagerIO
Author Message
davetcc


Joined: Jan 19, 2019
Messages: 517
Offline
I wish to use task manager with more switches than are supported by default, how can I change the settings?
davetcc


Joined: Jan 19, 2019
Messages: 517
Offline
The number of switches can be changed from the default of 4 by setting the following define:

MAX_KEYS

It can either be done by editing SwitchInput.h in the library, or re-defining the value in the compiler settings. Changing it in your sketch will not work.

For task manager the setting to change the number of tasks from (AVR 6 tasks, SAMD 10 tasks) is:

DEFAULT_TASK_SIZE

It can either be done by editing TaskManager.h in the library, or re-defining the value in the compiler settings. Changing it in your sketch will not work.
davetcc


Joined: Jan 19, 2019
Messages: 517
Offline
As of version 1.6 of IoAbstraction you no longer need to redefine these parameters. However, if you want to avoid reallocations you can allocate these yourself to specific values just as before.

* Task Manager will grow on 32-bit boards up to 256 tasks, and up to about 80 tasks on larger 8-bit boards. It uses a tranche system, so for example on a 32-bit board, it will start with 16 tasks then allocate another 16 when needed. Until it reaches the maximum number of tranches.

* Switches will reallocate keys as needed starting with reasonable defaults. It uses the lightweight-collection that is built into IoAbstraction, so as you exceed the number of switches it reallocates the backing array.

* Note that Rotary Encoders do not automatically reallocate, this is because most people don't need more than 4 rotary encoders. You still need to change this manually if you need more.
Amed


Joined: Dec 16, 2020
Messages: 4
Offline
Hi davetcc,
I'm on a project and I need a large menu with many tasks.
But actually, buttons don't work when the number of tasks are more than 15. How can I do ?
I have the 1.7.0 version.
Many Thank's.
Amed
davetcc


Joined: Jan 19, 2019
Messages: 517
Offline
I'm sorry but we'll need a lot more details than that to be able to help. You'll need to provide the board, the configuration, some idea of what sketch is running. Even an example sketch that produces this situation on the board in question.

On most 32-bit boards, you can use a large number of tasks (usually around 256) and switches grow on-demand as long as you have enough RAM, without too many issues.

However, on Uno, because of memory limitations, the limit is around 24, and that requires you to be able to allocate that much RAM!
Amed


Joined: Dec 16, 2020
Messages: 4
Offline
Thank's dav for your quick reply.
Yes, I work with an arduino uno, and I'm about 80% in Flash and 76% in RAM. I need to scroll with the classic 3 buttons and it work nicely when I have only 15ID(idents). When I add the 16 ID , I can see the menu on the 20/4LCD screen but without the '>' before the line of the first task .

HOME >
FIGURING TECHNICS >


When I'm under 16 tasks , I have this

>HOME >
FIGURING TECHNICS >


Amed
Amed


Joined: Dec 16, 2020
Messages: 4
Offline
I finally got the solution, it's a problem of RAM. When the program need more than 75% of RAM,the buttons don't work. I need to change to MEGA.
Thank's dav for all , tcMenu is really a great solution+++
davetcc


Joined: Jan 19, 2019
Messages: 517
Offline
I suspect it may be running out of memory either allocating the additional tasks, or switches. Using 76% of RAM before the app starts is very high, as we need a few hundred bytes at runtime to start, and that would take you to about 90% immediately.

Could you do a test in the menu setup that allocates tasks until the schedule function returns TASKMGR_INVALIDID and let me know how many times you get to before it fails I suspect it will be 18?

If this is the case, you'd have little option than to either reduce the number of tasks or get a bigger board such as the Mega2560.

I mean there is a slight issue here, in that if the call to new fails in taskmanager it should not try and continue, so I've raised a bug for that, but it is unlikely to occur on anything other than an Uno.

To fix the issue in task manager: https://github.com/davetcc/TaskManagerIO/milestone/8
Amed


Joined: Dec 16, 2020
Messages: 4
Offline
No, I'haven't got any message error when I increase the tasks, but perhaps I need to add some debug routine to show the TASKMGR_INVALIDID message, since it's sent to the delegate routine from tmNotification .
davetcc


Joined: Jan 19, 2019
Messages: 517
Offline
It’s a bug, there was an assumption that the additional allocation always works. We’ll fix it in the next patch. See the link in the last message.

Thanks for reporting.
 
Forum Index » IoAbstraction & TaskManagerIO
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.