Sandbox application framework

Thanks, done. emcsripten creates an additional .data file which is also needed along with the other 3.

I can’t reproduce what you describe. Checked it on 2 machines (Firefox and MS Edge) as well as mobile phone.

I was able to reproduce it. I found that it enough to simply “stop up” to Mono.
Interestingly it doesn’t occur when I go back the theme test.

Is this built against dev-6.1 or master? I’d like to track down the cause of this as it looks like some type of memory corruption.

Built against master

While I was busy with the web version, I found with functions pointers, if the assigned function does not precisely match the type spec, unexpected behaviour sometimes would occur (with emcripten).
for example,

typedef void *(*sndbx_pge_unmngd_cb_t)(void*);

void callback_1(void)
{
}

void * callback_2(void * p)
{
    static char c = 'Z';
    if(!p)
        return (void*)&c;
    return NULL;
}

void dispatch(void)
{
    sndbx_pge_unmngd_cb_t app = (sndbx_pge_unmngd_cb_t)callback_1;
    app(NULL);

    app = callback_2;
    app(NULL);
}

With the above example, it seemed that the function callback_1 did not get called (callback_2 does get called).
There were other similar instances, but I cannot remember them exactly (I simply changed the API to suite the functions that needed to be called).

The reason I mention this is that there may be instances in LittlevGL itself where this technique is employed, and works correctly under C, but could cause issues under emscripten.

I will try to do a build against dev-6.1 and let you know if there is any difference.

built against dev-6.1, same behaviour.

On version related matters, is there any reaon why lv_version.h has not been changed so as to reflect the version number in development. For dev-6.1, should it not be,

/*Current version of LittlevGL*/
#define LVGL_VERSION_MAJOR   6
#define LVGL_VERSION_MINOR   1
#define LVGL_VERSION_PATCH   0
#define LVGL_VERSION_INFO    "dev-6.1"

or similar ?
That way it can be used to check branch behaviour with visual confirmation at run time.

Please also look at my previous two replies above.

I checked this running lv_test_theme_2() on its own, and there is definately something strange happening, please see below. For the record it happens on both master and dev-6.1 branches.

After selecting Mono,

Scrolling the body before selecting mono,

In either case, it is corrected once a different color is selected. Except the color roller width is not resized (for the new theme), the result being that numbers like 180 are shown as if they have a line break "1\n80". I suspect this may be a different issue though.

I have tried to reproduce these problems at https://littlevgl.com/demo-theme-selector but it does not seem to occur there for me. So this issue may have crept in since that was generated.

As this matter is not really related to this catagory per se, should it not be moved to the bug catagory ?

That demo was last updated in January, so it’s very likely that the issue has appeared since then.

It’s probably because neither of us have gone to change it yet. I don’t see any reason why it can’t be changed.

Yes, please open a topic for it in the Bug category. Please add a “minimal steps to reproduce guide” and I’ll look into it. Do you see the issue if you don’t use the Sandbox application framework?

Yes, this occurs on it’s own. I will shortly convert lv_test_theme_2() to a sandbox managed version and see if the same thing occurs then.

Will do :wink:

1 Like

I eventually got round to creating a repo with the framework.
It has been updated and tested with lvgl v6.1.1
It should run from Visual Studio if it is correctly cloned.
I have only tested it with Visual Studio Community 2019

Feedback, suggestions and collaboration are encouraged.

1 Like

Thank you!

Can this be used for a splash screen when start the machine?

I can’t see why not.
If your intention is to use the framework to manage your graphics pages then there are a few ways you could display splash screen at startup. I assume you would like to display the splash screen for a few seconds directly before running an interactive application. i.e. one where the application will respond to user input once the splash screen has timed out ?

Yes, That’s what I want to do. But how to switch to a different screen based on time? Do you have an example? Thank you very much!

I will add an example to the repo post and post here once I have done so.
Will try to get that done today sometime.

I have added an example with splash screen to the repo.

  1. Download or update master branch.
  2. Compile and run.

I hope this helps you.

Thank you!

A question regarding struct mem_t members. For example, in sndbx_pge_lv_app_benchmark.c, it doesn’t include the button objects at all, why is that? What’s rule to put the object into mem_t?

One of my objectives for the framework was to avoid using global variables where possible.
More particularly I wanted to eliminate the need for global variables (or memory that is permanently persistent) when only needed while a particular screen is active.
Hence the mem_t structure.
The intention behind this structure is to place memory items that will persist as long as its associated screen is active.

Since you mentioned sndbx_pge_lv_app_benchmark.c I suggest that you compare that particular source file with lv_benchmark.c in the lv_apps tree or benchmark.c in the lv_examples tree. (These are really the same source files and just have different names).

sndbx_pge_lv_app_benchmark.c was converted from lv_benchmark.c so that it could be managed using the framework while benefiting from the memory management objectives. As such I only placed memory that needs to persist from the original files in the mem_t structure. The button objects (actually pointers) in this case are only needed during and around creation so there is no need to place them in the mem_t.as auto variables will suffice.

In essence you could place whatever memory items there (in mem_t) that you need for a particular screen or sandbox page.

I compared sndbx_pge_lv_app_benchmark.c with benchmark.c, found those global(static) variables(pointers) are placed into mem_t structure. I understand your explanation now. Another question, why sndbx_app_test/monolith need lv_obj_t * parent in mem_t, what this parent mean? Thank you very much!