Skip to content

feat(bar): add bar's orientation - #6212

Merged
kisvegabor merged 10 commits into
lvgl:masterfrom
TridentTD:bar_orientation
Jun 24, 2024
Merged

kisvegabor merged 10 commits into
lvgl:masterfrom
TridentTD:bar_orientation

Conversation

@TridentTD

@TridentTD TridentTD commented May 10, 2024 •

Copy link
Copy Markdown
Contributor

Description of the feature or fix

image

Add feature bar's orientation.

Notes

TridentTD added 3 commits May 10, 2024 07:14
- add bar' orientation feature
- add feature bar orientation
- add test_case for bar orientation
@TridentTD TridentTD changed the title [featBar orientation [feat] add bar's orientation May 10, 2024
@TridentTD TridentTD changed the title [feat] add bar's orientation feat(bar) : add bar's orientation May 10, 2024
@TridentTD TridentTD changed the title feat(bar) : add bar's orientation feat(bar): add bar's orientation May 10, 2024

@liamHowatt liamHowatt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #6172

The test took me a moment to understand but it seems reliable 😁

Comment thread src/widgets/bar/lv_bar.h Outdated
void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode);

/**
* Set the type of bar.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated docstring

Suggested change
* Set the type of bar.
* Set the orientation of the bar.

Comment thread src/widgets/bar/lv_bar.h Resolved
- change comment
type --> orientation  for orientation APIs
Comment thread src/widgets/bar/lv_bar.h Resolved
Comment thread src/widgets/bar/lv_bar.h Resolved
Comment thread tests/src/test_cases/widgets/test_bar.c Resolved
TridentTD added 2 commits May 13, 2024 08:04
orient->orientation
orient -> orientation

@kisvegabor kisvegabor left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening this PR. Please fix the last two things pointed out @PGNetHun and I think it can be merged.

Comment thread src/widgets/bar/lv_bar.h Resolved
Comment thread tests/src/test_cases/widgets/test_bar.c Resolved
@kisvegabor

Copy link
Copy Markdown
Member

@TridentTD Do you have time to finalize this PR?

@lvgl-bot

Copy link
Copy Markdown

We need some feedback on this pull request.

Now we mark this as "stale" because there was no activity here for 14 days.

Remove the "stale" label or comment else this will be closed in 7 days.

@lvgl-bot lvgl-bot added the stale label Jun 15, 2024
@kisvegabor

Copy link
Copy Markdown
Member

I've updated the test and renamed the parameter name to orientation.

Comment thread tests/src/test_cases/widgets/test_bar.c Resolved
Comment thread tests/src/test_cases/widgets/test_bar.c Resolved
@PGNetHun
PGNetHun self-requested a review June 21, 2024 16:57
@kisvegabor
kisvegabor merged commit fd9e901 into lvgl:master Jun 24, 2024
@FloHomi

FloHomi commented Sep 12, 2024

Copy link
Copy Markdown
Contributor

I found an Issue.
the enums lv_bar_mode_t & lv_bar_orientation_t are both only 2 bit in size. Therfore the bar struct is implemented as such:

struct lv_bar_t {
lv_obj_t obj;
int32_t cur_value; /< Current value of the bar*/
int32_t min_value; /< Minimum value of the bar*/
int32_t max_value; /< Maximum value of the bar*/
int32_t start_value; /< Start value of the bar*/
lv_area_t indic_area; /< Save the indicator area. Might be used by derived types*/
bool val_reversed; /< Whether value been reversed /
lv_bar_anim_t cur_value_anim;
lv_bar_anim_t start_value_anim;
lv_bar_mode_t mode; /< Type of bar/
lv_bar_orientation_t orientation; /
< Orientation of bar*/
};

but, in my visual studio simulator the enums are handled as int and this results in wrong behavior. when assigning a 2 to it (LV_BAR_ORIENTATION_VERTICAL = 2)
same for mode.

removing the ": 2" or
uint8_t mode instead of lv_bar_mode_t mode; solves the issue. I wish C would have type assignment to enums, as does c++....

@kisvegabor

Copy link
Copy Markdown
Member

Ah, I see. Could you send a Pull request to fix it? Just change :2 to :3.

@FloHomi

FloHomi commented Sep 12, 2024

Copy link
Copy Markdown
Contributor

I never done it, but I will try! Do I fork the main, or 9.2 branch for that?

@kisvegabor

Copy link
Copy Markdown
Member

It's great that you will create your first PR here 🙂 We have a guide about it here.

Please fork master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants