BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: Widget limit  (Read 10200 times)

Rad

  • Newbie
  • *
  • Posts: 9
    • View Profile
Widget limit
« on: March 17, 2021, 05:26:48 AM »

Hi there,

I am trying to place on one screen approx 50 tagged push buttons , however I think there is some kind of limitation same with EVE1,EVE2,EVE3. With the same code I am able to display up to approx 30 buttons on one display frame.
Please can you advice what it the limitation and if there is a way to place much more tagged push buttons (50..100)?

Thank you in advance.
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Widget limit
« Reply #1 on: March 17, 2021, 03:35:42 PM »

Hello,

Thank you for your question.

Can you clarify if you are using the CMD_Button widget to create your buttons? or are you using bitmaps in place of the button widget and tagging these as desired?

There is a limitation in regards to how many buttons can be drawn on the screen with CMD_Button, this relates to the usage of RAM_DL. A quick test on EVE Screen Editor shows that drawing 10 buttons on an otherwise blank screen utilises 28% of RAM_DL. As such it is likely that you are running out of available display list ram when utilising CMD_Button for 30+ buttons.

Best Regards,
BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: Widget limit
« Reply #2 on: March 17, 2021, 05:23:33 PM »

That is an interesting topic and I wish EVE would be smarter when generating the display lists.

Short answer, if you need a high number of elements, do not use widgets.
This is not exclusive to buttons but to some degree also applies to simpler things like text.
The widgets are conveniant but resource-hungry.

Alternatives for buttons would be:
Use images, find some online button generator tool that allows downloading the images, play with it to generate two images,
one plain, one with shadow, display the one or the other when needed
In addition, use images for the text on the buttons as well.

Use rectangles.
To stick with EVE Screen Editor for experiments, this is a button:
CLEAR_COLOR_RGB(255, 255, 255)
CLEAR(1, 1, 1)
COLOR_RGB(170, 170, 255)
BEGIN(RECTS)
TAG(10)
VERTEX2F(1600, 1600)
VERTEX2F(2880, 1920)
RECT
COLOR_RGB(0, 0, 0)
TAG(10)
CMD_TEXT(140, 110, 28, OPT_CENTER, "Button")

Too simple?

CLEAR_COLOR_RGB(255, 255, 255)
CLEAR(1, 1, 1)
LINE_WIDTH(128)
BEGIN(RECTS)
TAG(10)
COLOR_RGB(0, 0, 0)
VERTEX2F(1600, 1600)
VERTEX2F(2912, 1952)
COLOR_RGB(170, 170, 255)
VERTEX2F(1600, 1600)
VERTEX2F(2880, 1920)
COLOR_RGB(0, 0, 0)
TAG(10)
CMD_TEXT(140, 110, 28, OPT_CENTER, "Button")

Now we have rounded corners and a shadow.

Two buttons:
CLEAR_COLOR_RGB(255, 255, 255)
CLEAR(1, 1, 1)
LINE_WIDTH(80)
BEGIN(RECTS)
COLOR_RGB(0, 0, 0)
TAG(10)
VERTEX2F(1600, 1600)
VERTEX2F(2912, 1952)
TAG(11)
VERTEX2F(1600, 2400)
VERTEX2F(2912, 2752)
COLOR_RGB(170, 170, 255)
TAG(10)
VERTEX2F(1600, 1600)
VERTEX2F(2880, 1920)
TAG(11)
VERTEX2F(1600, 2400)
VERTEX2F(2880, 2720)

COLOR_RGB(0, 0, 0)
TAG(10)
CMD_TEXT(140, 110, 28, OPT_CENTER, "Button")
TAG(11)
CMD_TEXT(140, 160, 28, OPT_CENTER, "Test")

Even simpler?
Use one rectangle and change it's color based on if it is active or selected or pressed.
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: Widget limit
« Reply #3 on: March 17, 2021, 06:22:58 PM »

The more complicated and slightly off-topic answer.  ;)

CMD_BUTTON(90, 179, 120, 36, 27, 0, "Button")

The result in the display-list is this:
Code: [Select]
Raw Text
0 0x22000000 SAVE_CONTEXT()
1 0x27000002 VERTEX_FORMAT(2)
2 0x0500000f BITMAP_HANDLE(15)
3 0x06000000 CELL(0)
4 0x0120004c BITMAP_SOURCE(2097228)
5 0x28000000 BITMAP_LAYOUT_H(0, 0)
6 0x07180219 BITMAP_LAYOUT(L8, 1, 25)
7 0x29000000 BITMAP_SIZE_H(0, 0)
8 0x0808f024 BITMAP_SIZE(NEAREST, REPEAT, BORDER, 120, 36)
9 0x20000001 COLOR_MASK(0, 0, 0, 1)
10 0x0b000000 BLEND_FUNC(ZERO, ZERO)
11 0x1f000001 BEGIN(BITMAPS)
12 0x40b402cc VERTEX2F(360, 716)
13 0x2000000f COLOR_MASK(1, 1, 1, 1)
14 0x0b000014 BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA)
15 0x0e00003c LINE_WIDTH(60)
16 0x1f000009 BEGIN(RECTS)
17 0x04ffffff COLOR_RGB(255, 255, 255)
18 0x40ba82d9 VERTEX2F(373, 729)
19 0x419b834b VERTEX2F(823, 843)
20 0x04000000 COLOR_RGB(0, 0, 0)
21 0x40bd82df VERTEX2F(379, 735)
22 0x419e8351 VERTEX2F(829, 849)
23 0x04003870 COLOR_RGB(0, 56, 112)
24 0x40bb82db VERTEX2F(375, 731)
25 0x419c834d VERTEX2F(825, 845)
26 0x1f000001 BEGIN(BITMAPS)
27 0x20000001 COLOR_MASK(0, 0, 0, 1)
28 0x0b000018 BLEND_FUNC(DST_ALPHA, ZERO)
29 0x40b402cc VERTEX2F(360, 716)
30 0x2000000e COLOR_MASK(1, 1, 1, 0)
31 0x0b00001d BLEND_FUNC(DST_ALPHA, ONE_MINUS_DST_ALPHA)
32 0x04ffffff COLOR_RGB(255, 255, 255)
33 0x40b402cc VERTEX2F(360, 716)
34 0x2000000f COLOR_MASK(1, 1, 1, 1)
35 0x0b000014 BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA)
36 0x04000000 COLOR_RGB(0, 0, 0)
37 0x0500001b BITMAP_HANDLE(27)
38 0x8f8badc2 VERTEX2II(124, 186, 27, 'B')
39 0x90cbadf5 VERTEX2II(134, 186, 27, 'u')
40 0x91ebadf4 VERTEX2II(143, 186, 27, 't')
41 0x92cbadf4 VERTEX2II(150, 186, 27, 't')
42 0x93abadef VERTEX2II(157, 186, 27, 'o')
43 0x94ebadee VERTEX2II(167, 186, 27, 'n')
44 0x23000000 RESTORE_CONTEXT()
45 0x22000000 SAVE_CONTEXT()
46 0x27000002 VERTEX_FORMAT(2)
47 0x0500001b BITMAP_HANDLE(27)
48 0x8fabbdc2 VERTEX2II(125, 187, 27, 'B')
49 0x90ebbdf5 VERTEX2II(135, 187, 27, 'u')
50 0x920bbdf4 VERTEX2II(144, 187, 27, 't')
51 0x92ebbdf4 VERTEX2II(151, 187, 27, 't')
52 0x93cbbdef VERTEX2II(158, 187, 27, 'o')
53 0x950bbdee VERTEX2II(168, 187, 27, 'n')
54 0x23000000 RESTORE_CONTEXT()

Yes, 54 32-bit words for a single button and repeated for every button.

But it gets worse with buttons that have the text at coordinates above 511:

CMD_BUTTON(521, 14, 120, 36, 27, 0, "Button")

Code: [Select]
Raw Text
1 0x27000002 VERTEX_FORMAT(2)
2 0x0500000f BITMAP_HANDLE(15)
3 0x06000000 CELL(0)
4 0x0120004c BITMAP_SOURCE(2097228)
5 0x28000000 BITMAP_LAYOUT_H(0, 0)
6 0x07180219 BITMAP_LAYOUT(L8, 1, 25)
7 0x29000000 BITMAP_SIZE_H(0, 0)
8 0x0808f024 BITMAP_SIZE(NEAREST, REPEAT, BORDER, 120, 36)
9 0x20000001 COLOR_MASK(0, 0, 0, 1)
10 0x0b000000 BLEND_FUNC(ZERO, ZERO)
11 0x1f000001 BEGIN(BITMAPS)
12 0x44120038 VERTEX2F(2084, 56)
13 0x2000000f COLOR_MASK(1, 1, 1, 1)
14 0x0b000014 BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA)
15 0x0e00003c LINE_WIDTH(60)
16 0x1f000009 BEGIN(RECTS)
17 0x04ffffff COLOR_RGB(255, 255, 255)
18 0x44188045 VERTEX2F(2097, 69)
19 0x44f980b7 VERTEX2F(2547, 183)
20 0x04000000 COLOR_RGB(0, 0, 0)
21 0x441b804b VERTEX2F(2103, 75)
22 0x44fc80bd VERTEX2F(2553, 189)
23 0x04003870 COLOR_RGB(0, 56, 112)
24 0x44198047 VERTEX2F(2099, 71)
25 0x44fa80b9 VERTEX2F(2549, 185)
26 0x1f000001 BEGIN(BITMAPS)
27 0x20000001 COLOR_MASK(0, 0, 0, 1)
28 0x0b000018 BLEND_FUNC(DST_ALPHA, ZERO)
29 0x44120038 VERTEX2F(2084, 56)
30 0x2000000e COLOR_MASK(1, 1, 1, 0)
31 0x0b00001d BLEND_FUNC(DST_ALPHA, ONE_MINUS_DST_ALPHA)
32 0x04ffffff COLOR_RGB(255, 255, 255)
33 0x44120038 VERTEX2F(2084, 56)
34 0x2000000f COLOR_MASK(1, 1, 1, 1)
35 0x0b000014 BLEND_FUNC(SRC_ALPHA, ONE_MINUS_SRC_ALPHA)
36 0x04000000 COLOR_RGB(0, 0, 0)
37 0x0500001b BITMAP_HANDLE(27)
38 0x06000042 CELL(66)
39 0x44560054 VERTEX2F(2220, 84)
40 0x06000075 CELL(117)
41 0x446a0054 VERTEX2F(2260, 84)
42 0x06000074 CELL(116)
43 0x447c0054 VERTEX2F(2296, 84)
44 0x06000074 CELL(116)
45 0x448a0054 VERTEX2F(2324, 84)
46 0x0600006f CELL(111)
47 0x44980054 VERTEX2F(2352, 84)
48 0x0600006e CELL(110)
49 0x44ac0054 VERTEX2F(2392, 84)
50 0x23000000 RESTORE_CONTEXT()
51 0x22000000 SAVE_CONTEXT()
52 0x27000002 VERTEX_FORMAT(2)
53 0x0500001b BITMAP_HANDLE(27)
54 0x06000042 CELL(66)
55 0x44580058 VERTEX2F(2224, 88)
56 0x06000075 CELL(117)
57 0x446c0058 VERTEX2F(2264, 88)
58 0x06000074 CELL(116)
59 0x447e0058 VERTEX2F(2300, 88)
60 0x06000074 CELL(116)
61 0x448c0058 VERTEX2F(2328, 88)
62 0x0600006f CELL(111)
63 0x449a0058 VERTEX2F(2356, 88)
64 0x0600006e CELL(110)
65 0x44ae0058 VERTEX2F(2396, 88)
66 0x23000000 RESTORE_CONTEXT()

Yes, this is just the price for getting an easy to use and compared to the effort very fancy button.
It is 3D with a color gradient. Even the text has a shadow.

An option or options to control the degree of fancyness would be nice.
OPT_TEXT_PLAIN -> several 32-bit words less
OPT_BACKGROUND_PLAIN -> no gradient, again several 32-bit words less.

Secondly EVE could be smarter and give the generated display list a second pass to optimize it before activation.
Group similar commands together while maintaining the drawing order for overlapping objects.
I have no idea though if this is even feasible with a benefical outcome while not adding a noticeable dent in the perfomance.
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Widget limit
« Reply #4 on: March 18, 2021, 12:10:17 PM »

Hello,

Thank you Rudolph for your excellent explanation.

On the point concerning using images to replace buttons, it is also possible to use bitmap cells for your button icons. A brief explanation of bitmap cells can be found in the following:
AN 314 FT800 Advanced Techniques Working with Bitmaps

The normal approach would be to update the display list when a touch is detected and draw a different cell in the bitmap for a given button. For example cell(0) could be button1 un-pressed, and cell(1) could be button1 pressed, etc.

Best Regards,
BRT Community
Logged

Rad

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Widget limit
« Reply #5 on: March 19, 2021, 07:58:08 AM »

I am just a beginner with EVE. Of course I use CMD button.
I was expecting ready to use commands to be the most optimal to use in every respect especially comparing to bitmaps....
I'd say the programming manual is very poor regarding such info (regarding what's more or less efficient way to use), or even most info...

Thank you Rudolph a lot, I will try to use something less resource consuming.
BTW: OPT_FLAT makes buttons using ways less lines.

Maybe it could be an idea for developers to add more OPTs for widgets to make them more fancy or less resource consuming.

Regarding EVE SE the code generated is such overloaded with unnecessary lines for other than FT/BT platforms that cleaning this up takes more time than writing code ourselves. Maybe there could be an option for exporting the code for just "other MCU". That's why I found this app unusable.
« Last Edit: March 19, 2021, 08:14:04 AM by Rad »
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: Widget limit
« Reply #6 on: March 19, 2021, 02:49:58 PM »

I am just a beginner with EVE. Of course I use CMD button.
I was expecting ready to use commands to be the most optimal to use in every respect especially comparing to bitmaps....
I'd say the programming manual is very poor regarding such info (regarding what's more or less efficient way to use), or even most info...

Well now, the programming manual gives a good overview of all the capabilities and how to use them.
It is not a tutorial on how to design GUIs.
And be fair, a GUI with 50+ buttons is really not that common.

Oh, and this could be helpfull:
https://github.com/RudolphRiedel/FT800-FT813

Quote
Thank you Rudolph a lot, I will try to use something less resource consuming.
BTW: OPT_FLAT makes buttons using ways less lines.

Yes but using it only with OPT_FLAT it is not really a button anymore but a flat surface that provides no visual feedback.
The widgets are great for getting simple yet fancy GUIs done but they have limits.

Quote
Maybe it could be an idea for developers to add more OPTs for widgets to make them more fancy or less resource consuming.

Regarding EVE SE the code generated is such overloaded with unnecessary lines for other than FT/BT platforms that cleaning this up takes more time than writing code ourselves. Maybe there could be an option for exporting the code for just "other MCU". That's why I found this app unusable.

I have not tried to export code from EVE Screen Editor for some time now and right now it does not even work for me.
"Error: (Python) "run() missing 1 required positional argument: 'screenResolution'"
So I can not even check the result.
I would like to see an option to export in BRT_AN025 style format as this is pretty close to my own library.

Anyways, the Coprocessor sub-window is a text-editor gadget so you can always copy from there.
« Last Edit: March 19, 2021, 06:14:58 PM by Rudolph »
Logged

chadpham75

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Widget limit
« Reply #7 on: April 07, 2021, 07:09:22 AM »

Hi Rudolph,
Sorry to coasting along with this thread, since your explanation for the buttons in very details.
I am looking for the way to design the partial circle to show the temperature/humidity/oxygen level like interface like in this youtube link but I couldn't find any tutorial how to draw the partial circle. 
The widgets offer the gauge but it is a complete circle and I would like to draw the interface at the same as this example link in the CES 2018 Smart Greenhouse Demonstration from Bridgetek.  Can you please help to point me to the information?
https://www.youtube.com/watch?v=0DXu6LGbvnU
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: Widget limit
« Reply #8 on: April 07, 2021, 08:31:47 PM »

I am afraid that I can not really help with that.
There are a couple of things I have not really tried with EVE as I am not developing GUIs for products but mostly functional tools in single digit numbers to be used by engineers.
So my GUIs tend to lean on the functional side of things rather than the Eye Candy side of things.
I really like that things like the display in the video can be done but I need something else.

That said I still looked a little and there is this for example:
C:\Users\Public\Documents\EVE Screen Editor\Examples\BT81X\circular_progress_bar

I am not sure if there is documentation for it available though.
This is definately something to play with.

And then there is this:
https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/AN_311_FT800_App_Dials.pdf

It looks like "Figure 3-2" is showing a volume indicator around the circular dial.
But I could not find source code for AN_311.
Logged

darkjezter

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Widget limit
« Reply #9 on: April 08, 2021, 03:49:59 PM »

Generally, 'partial' anything on the eve requires masking or alpha tricks.  Stencil buffers are one easier way to approach this, and work similarly to how openGL uses them.  However, stencil buffers tend to produce visible aliasing artifacts.

What the built-in widgets use instead are alpha-blending tricks to accomplish much the same thing.  If you're curious to learn how the built in widgets work, you can generate a display list using the coprocessor command, and then read back the display list memory which will contain the resulting display list commands.  It's a bit of work, but I learned a great deal about how to avoid aliasing artifacts when doing the 3d buttons for example.

Looking at the youtube video you linked, the thin circle can be composed of a point with the circle color and radius, a smaller background-colored circle, and then something to overlay at the bottom to give you the gap.

The thicker circle bar that grows along that line though, as it has the rounded ends is likely made up of a line-strip tracing the outline of the circle.  Not how I would have done it personally, but alpha-masking wouldn't have given the rounded ends as easily.
Logged