Skip to content

Conversation

faxe1008
Copy link
Contributor

Adds a check to prevent transitions from the current to the current screen and loading of a new screen if a load for that one is already in progress.

Description of the feature or fix

Addresses the issue over at: issues/4482.
From my perspective it does not really make sense that a screen can load with animation to itsself.
Also it prohibits the loading of a screen which is currently already loading, which also seems like it should not be possible.

I do not know if this is the 'correct' way to fix it,. When looking at the code, what struck me as odd is the fact that on scr_load_anim_start the "screen swap" already occurs. So if you somehow manage to trigger the same lv_scr_load_anim you will run into the situation lv_act_scr() == new_scr.

Anyways I let the minimal reproducible example from the issue run for about 30 minutes and have not observed the issue since.

Checkpoints

Be sure the following conventions are followed:

  • Follow the Styling guide
  • Prefer enums instead of macros. If inevitable to use defines export them with LV_EXPORT_CONST_INT(defined_value) right after the define.
  • In function arguments prefer type name[] declaration for array parameters instead of type * name
  • [x Use typed pointers instead of void * pointers
  • Do not malloc into a static or global variables. Instead declare the variable in lv_global_t structure in lv_global.h and mark the variable with (LV_GLOBAL_DEFAULT()->variable) when it's used. See a detailed description here.
  • Widget constructor must follow the lv_<widget_name>_create(lv_obj_t * parent) pattern.
  • Widget members function must start with lv_<modul_name> and should receive lv_obj_t * as first argument which is a pointer to widget object itself.
  • structs should be used via an API and not modified directly via their elements.
  • struct APIs should follow the widgets' conventions. That is to receive a pointer to the struct as the first argument, and the prefix of the struct name should be used as the prefix of the function name too (e.g. lv_disp_set_default(lv_disp_t * disp))
  • Functions and structs which are not part of the public API must begin with underscore in order to mark them as "private".
  • Arguments must be named in H files too.
  • To register and use callbacks one of the following needs to be followed (see a detailed description here):
    • For both the registration function and the callback pass a pointer to a struct as the first argument. The struct must contain void * user_data field.
    • The last argument of the registration function must be void * user_data and the same user_data needs to be passed as the last argument of the callback.
    • Callback types not following these conventions should end with xcb_t.

Adds a check to prevent transitions from the current to the current
screen and loading of a new screen if a load for that one is already in
progress.
@kisvegabor
Copy link
Member

Makes sense, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants