Author |
Message |
20/01/2019 07:35:14
|
#1
|
davetcc
Joined: Jan 19, 2019
Messages: 686
Offline
|
I wish to use task manager with more switches than are supported by default, how can I change the settings?
|
|
|
20/01/2019 07:38:45
|
#2
|
davetcc
Joined: Jan 19, 2019
Messages: 686
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.
|
|
|
15/10/2020 07:54:49
|
#3
|
davetcc
Joined: Jan 19, 2019
Messages: 686
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.
|
|
|
16/12/2020 19:05:00
|
#4
|
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
|
|
|
16/12/2020 19:45:17
|
#5
|
davetcc
Joined: Jan 19, 2019
Messages: 686
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!
|
|
|
16/12/2020 20:16:59
|
#6
|
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
|
|
|
16/12/2020 20:32:05
|
#7
|
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+++
|
|
|
16/12/2020 21:02:07
|
#8
|
davetcc
Joined: Jan 19, 2019
Messages: 686
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
|
|
|
17/12/2020 17:46:46
|
#9
|
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 .
|
|
|
17/12/2020 18:00:24
|
#10
|
davetcc
Joined: Jan 19, 2019
Messages: 686
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.
|
|
|
|