Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LVGL] Add slider range #745

Open
derWarst opened this issue Mar 10, 2025 · 3 comments
Open

[LVGL] Add slider range #745

derWarst opened this issue Mar 10, 2025 · 3 comments
Assignees

Comments

@derWarst
Copy link

derWarst commented Mar 10, 2025

Is your feature request related to a problem? Please describe.
I would like to change the range of a [NORMAL) slider with a seperate [RANGE] slider without having to implement it later in the code.

Describe the solution you'd like
Add
[lv_slider_set_range]
to be supported by the eez flow

@mvladic
Copy link
Contributor

mvladic commented Mar 11, 2025

I do not understand completely the description of this feature request:

I would like to change the range of a [NORMAL) slider with a seperate [RANGE] slider without having to implement it later in the code.

I do understand what lv_slider_set_range function does and I can support this function from the EEZ Flow by adding a new LVGL action called "Slider Set Range" . But, the text marked as bold is the one that confuses me. If the request description is without this part it would be perfectly clear to me, but with this part it is confusing. Can you clarify this for me?

@derWarst
Copy link
Author

Ah, Ok. Sorry if my explanation was a bit unclear.
There is a slider_1 on my main screen which will eventually control a digital potentiometer acting as a voltage divider. On a second screen, there will be a slider_2 with two knobs which can be used to adjust the range of slider_1, so I can choose to have it not go all the way to GND or V+.
I hope this makes more sense to you.

@mvladic mvladic changed the title [LVGL] - Add slider range [LVGL] Add slider range Mar 11, 2025
@mvladic
Copy link
Contributor

mvladic commented Mar 11, 2025

I understand now. It definitely makes sense to implement "Slider Set Range" LVGL action. But, until this is implemented consider the solution presented in this project:

lvgl_slider_range_test.zip

So, in this project, Slider 2 is used to define range, i.e. variables range_min and range_max. Slider 1 works with the range 0 to 100, but slider1_value is normalized (to be inside range_min to range_max) using this formula:

range_min + slider1_value * (range_max - range_min) / 100

So, at the end, variable slider1_value_normalized is always equal to the value selected in Slider 1 but within selected range given by range_min and range_max (we use Watch action to update slider1_value_normalized).

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

No branches or pull requests

2 participants